OLED Arduino Counter
OLED Timer Thermometer
OLED Frequency Counter
Android Oscilloscope
OBD2 Engine Rev Counter
OBD2 Diagnostic app
TFT Clock and Thermometer
WiFi, Ethernet
WiFi Thermometer
WiFi ESP8266
Doorbell with SD / EEPROM
SD FAT16/32 for .bmp
PETIT FAT bmp Display
TFT Timer, Thermometer
TFT Oscilloscope
SD Talking Clock
Android Talking Clock
SD Sound Recorder
SD FAT32 wav Player
SD Arduino Recorder
LED Thermometer
LED Timer
LCD Timer
TFT 10MHz Counter
100KHz Counter For PC
1MHz Counter For PC
8 Digits LED Counter
Scope Screen Counter
LCD Module Counter
LCD Arduino Counter
6MHz Android Counter
NIXIE Android Counter
Bluetooth Counters
USB Counter
USB TFT display BMP
USB DS18B20 Sensor
USB Thermometer
USB Meter
USB Oscilloscope
USB Input-Output
USB Input-Output Android
USB 16x2 LCD
Serial TFT Text
Serial Inputs Outputs
Serial Port LCD
MCP3201 on Serial Port
Serial Thermometer
Analogue Signal to Serial
Serial Thermostat
MCP3201 on LPT
Analogue Signal to LPT
LCD Display on LPT
Water Softener
HP Stream 7 docking
3.7V to 5V
Solar Charger
Infrared Decoder
PIC Music
Code Lock
Code Lock with LCD
HOME   Technical Tips


The clock tells the time by playing back tracks from the SD. The SD is FAT32 formatted. The tracks are wave (.wav) files of 22.050 KHz, 8 bits, mono. SD card interface the PIC in SPI mode.
The LCD module is 2 lines 16 characters.
The ATMEGA328P generates audio using PWM.
The talking_clock_hourly software is an hourly announcement of time. The NIGHT SWITCH when closed disables the hourly announcement.

Sound tracks can be any sound. The code doesn't read the file name, it goes to the file number in the list of 27 files. The code plays tracks in this order: tens of hours, hours, "hours", tens of minutes, minutes, "minutes" and then a message, for example; "have a nice day".
The SD card has to be prepared this way:
Files have to be 22.050 KHz, 8 bits, mono. With short names (max 8 characters).
Format the card with FAT32. No folders or subfolders.
Copy to the root folder the files one at a time and in this order; 0 to 19 (20 files),20,30,40,50,"hours","minutes","good day" (or any other message). Totally 27 files. If you make a mistake while copying the files to the SD it isn't good enough to delete a file, you must start again with formatting the SD. The reason for loading the files one at a time is that if you load them together the PC sends them to the card in the order it finds fit, and when the code plays them it picks up the files without searching for their name. The software includes wave files in English.


The pic drives the LCD to display hours and minutes. Time base is set by dividing 4MHz using CCP1, CCP2, TMR1, TMR2.
Pressing TALK requests relevant tracks of hours and minutes to be played. Tracks can be changed to any language, wav or mp3, you can also record your own voice. 
The SD card in the player must be formatted to FAT32. The player reads the tracks in the order they are written (not by the names), as an example track 53msg.mp3 is read by the dfplayer . Tracks files must be copied to the SD one track at a time and in the order they are in the computer folder. No other files or folders should be on the card. If you wish to change any of the tracks you need to reformate the SD first and then copy the new files.
Datasheet for the DFPlayer:  http://www.picaxe.com/docs/spe033.pdf
The LCD module is HD44780 compatible, most modules on sale are. It can be 1 or 2 lines. 

Good free specifications for SD can be found in SanDisk PDF: http://alumni.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf
You are free to use the circuit diagram and software with no limitations.


The clock uses Text To Speech built in Android device, for reading the time. It reads time hourly at the background. The app is made in B4A (basic for Android). App for Android can be downloaded from GitHub. Included code for the app, if you wish to change it download free IDE from:   https://www.b4x.com/
To install the app on Android device place the APK file in the device, when you open the file it ask if you want it installed.
Leave the clock running in your office so at least once every hour you get to hear something that makes sense.


Circuit Description
See also Technical Tips

LCD supply is 5V. The SD Card supply is only 3.3V (3-3.6V) The 3.3V and 5V are generated on the Arduino board.
The PWM output is boosted by 2 transistors push-pull. The signal to the speaker is PWM of 62 KHz and the speaker outputs the modulated audio only. The speaker should be 8 ohms or higher.
Digital outputs from the Arduino to the SD card use 1K and 2K resistors to reduce the 5V signals to 3.3V. SD output at pin 7 is 3.3V but is enough to drive the input.
The pins number are for ordinary SD card, for MicroSD the pins are different.
Link between Arduino pins 3 and 5 connect 1000 Hz clock from timer 2 to timer 1, these timers generate 1 minute time base.
LCD display and driver has 14 way connector, 10 connections are used, 4 bits data bus is selected. 10K pot adjusts the contrast. Use 16 x 2 LCD module.

Circuit Description
See also Technical Tips

DFPlayer mini module is sold as MP3 player for Arduino. https://www.ebay.co.uk
1K resistor is to reduce the 5V output of the PIC to 3.3V input of the DFPlayer.
Volume can be controlled by pushbuttons connected to pins 9, 11 of the DFPlayer, see the datasheet.
LCD display is 1 or 2 lines 16 characters module.
Link between pins 11 and 12 connects output of CCP2 to the input of TIMER1.



Comments and questions

Copy the number from the picture It stops net-robots from adding comments.

Be the first to add a comment.

moty22.co.uk  2008-2021