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.
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.

PIC and DFPlayer TALKING CLOCK

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.pdfThe LCD module is HD44780
compatible, most modules on sale are. It can be 1 or 2 lines.

PIC and SD Card TALKING CLOCK

The clock tells the time by playing back recording of sound by the user. The user record saying "one", "two"... till 59. these short recorded tracks are played by the PIC following the hours and the minutes on the display. There are 60 tracks for minutes and 24 tracks for hours. Each track is 1.6 second long. Total memory for the 84 tracks is 4.5 MB.
The Menu has the options of setting hours and minutes, recording and playing the minutes and hours tracks.
The LCD module is 1 line 16 characters. 2 lines module or 20 character modules can be used too.
The PIC16F876A's ADC digitizes the sound and store it in the SD card (not SDHC). The PIC's CCP is used as a DAC to convert the digital data back to audio. The sound is converted to 20KHz 8 bits mono in a format similar to .wav files. The quality of the audio is reasonable.
SD card interface the PIC in SPI mode. Reading and writing data is in multi-blocks. Memory is used at the rate of 20KB/s. The SD error display indicates error sent by the SD card. The software doesn't use any file system, it just uses absolute memory addresses (raw).
Audio input is 1Vp-p , you can use the mic circuit or other source. The CCP in PWM mode gives 20KHz wave with duty cycle modulated to the audio amplitude. A low pass filter removes the 20KHz component. I added a simple 2 transistors amplifier to boost the power to drive 32 Ohm speaker.
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.

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.

PIC and LCD supply is 5V. The SD Card supply is only 3.3V (3-3.6V) The 3.3V is generated by dropping the 5V with 2 diodes.
Audio input at pin 2 is 1Vp-p max. Voltage over 2Vp-p can damage the PIC input protection. 100K and 12K resistors give 0.6V DC input which is the middle of 1.25V range of the ADC.
One option is to boost the pic output by the Simple Audio Amp. You can use a 32 Ohm speaker. For use with another amplifier connect via the low pass filter.
8MHz crystal is a time base for the audio recording. 32768Hz crystal is a time base for the clock. Capacitors may need to be changed depending on the type of crystal used.
Digital outputs from the PIC 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 PIC's input.
Stop, Rec, Pause and Play are pushbuttons.
LCD display and driver has 14 way connector, 10 connections are used, 4 bits data bus is selected. There is a big selection of LCD modules, and they are very similar in characteristics i.e. DM1601, ACM1601.
Vss - Supply GRD.
Vdd - Supply 5V
Vo - Contrast Adjust
RS - Register Select
R/W - Data Read/Write
E - Enable
D4-D7 - Data Bus Lines
LCD module is 20K pot is the LCD contrast, make sure it is set.
Talk PB is also the PB for Record and Play.

TIMER1 OSCILLATOR LAYOUT
CONSIDERATIONS
The Timer1 oscillator circuit draws very little power
during operation. Due to the low-power nature of the
oscillator, it may also be sensitive to rapidly changing
signals in close proximity.
The oscillator circuit, shown in Figure 12-3, should be
located as close as possible to the microcontroller.
There should be no circuits passing within the oscillator
circuit boundaries other than VSS or VDD.
If a high-speed circuit must be located near the oscillator
(such as the CCP1 pin in Output Compare or PWM
mode, or the primary oscillator using the OSC2 pin), a
grounded guard ring around the oscillator circuit, as
shown in Figure 12-4, may be helpful when used on a
single-sided PCB or in addition to a ground plane.

Do you find this project useful?

Name:

Comments and questions

Copy the number from the pictureIt stops net-robots from adding comments.

06.05.2019 - 22:36Name: Moty Comment: Sorry I was misleading you with the term RS232, the pic and the player communicate serially at TTL levels so their UART are connected directly' no max232 needed.
http://www.picaxe.com/docs/spe033.pdf
http://www.picbasic.co.uk/forum/attachment.php?s=4d33b151492596d92735014e4094ffd7&attachmentid=8726&d=1530090274
Are the datasheet, you can google for more docs.
https://github.com/Indo-Ware/dfplayer-mini-mp3 is a sample for interfacing arduino, it will be similar with pic. To play a track (0 to 2999) you send a command of 9 bytes. I've never written a code for the player. I may find some free time to try some code, I have a pic16f876a and a DFplayer.
My project has a disadvantage, when the cpu plays the SD it can't run the clock, so it can't display seconds. With the player or the TTS this can be overcome.
Please send me a link to the source of the TTS module, maybe I can buy one to play with (if it's up to $10). It needs assessing how much memory is needed to store all the words in the pic.

06.05.2019 - 17:18Name: coding4funComment: I forgot to add my name on the last post. Anyways, I imagine if you have to use RS232, then you must connect a MAX232 via the pic16f876a to the Dfplayer module. am i on the right track? idk, since I don't have a sample dfplayer module in my hand yet. do you have a link to the datasheet??

06.05.2019 - 17:10Name: Comment: Thank you for the great input. If you want to work on TTS with me then leave me your email address and I will send you a TTS module and PIC16F876A for FREE. I'm working on interfacing the module by UART, since the manual is in Chinese I am having trouble. You can join this project with me if you like. In regards to the "DFPlay" THANK YOU. Do you have any PIC16F876A sample code and schematic using this successfully, if so I would love to try it.
I've been following your work and I would love to see the new code for PIC16F876A for this project. Keep up the good work!
Thank you.

05.05.2019 - 19:41Name: Moty Comment: I have on my list to modify the pic project to work like the arduino. the pic's PWM isn't very clever and it gives reduced sound quality in compare to the arduino. Some new pic include DAC that will give better sound. The interference between the crystals is also a problem.
Your idea to add a TTS module (text to sound) is a good one but the cost of existing TTS is high. Another option is to use MP3 player that has SD card and you call a track using RS232. https://www.ebay.co.uk/itm/TF-Card-U-Disk-DFPlay-Mini-MP3-Player-Audio-Voice-Module-For-Arduino-Red-Black/332191775209?hash=item4d582c39e9:m:mipJiSTcU06odSU7dsEBqGA

05.05.2019 - 18:18Name: Comment: Oops, I was wrong. These .wav files are only for Arduino. Wow! For Pic, you actually have to record your own files. Is there any other way? Especially for those who don't want to record their files. I presume not because of the reading style. Have you ever used any text to speech modules? I would love to chat with you about those. Thanks.

05.05.2019 - 17:23Name: coding4funComment: Never mind, I found the .wav files in the ARDUINO folder, I'm using a PIC16F876A so I had no interest in ARDUINO. Had I never checked I would be lost.

05.05.2019 - 17:19Name: coding4funComment: Where can I download the .wav files you used to make this project? I find it hard trying to create my own. It would be easier if you could provide the same ones that you used, please. Thank you.

26.02.2019 - 23:16Name: Thanh TungComment: Hello

22.05.2018 - 23:03Name: Moty Comment: Hi Sangatee, Click the button 'download software' add the c file to your project in MPLAB or MPLAB X and you can edit the code if you need to. You can also load the hex file directly to your pic.

22.05.2018 - 08:28Name: sangatee davidComment: how can i get the peogramming software

13.01.2018 - 20:16Name: Moty Comment: Hi Konstantyn, These clocks tell the time only when you press the button. It is easy to add to the code to talk when the hour changes. To add alarm is a big change. The Arduino clock gives better sound.

13.01.2018 - 19:02Name: Konstantyn545Comment:
Is there an alarm clock here?

13.01.2018 - 19:02Name: Konstantyn545Comment:
Is there an alarm clock here?

13.01.2018 - 09:08Name: Konstantyn545Comment: Hello, I want to collect this watch, please tell me they say time every hour?

11.10.2014 - 15:32Name: Abraham Comment: can I get your name?
I want to reference u you I my Project.

02.06.2014 - 12:08Name: MotyComment: Hi Yusa. 2 GB SD allows for about 20 minutes for each track. The clock doesn't advance during playing the tracks so for the clock showing the right time a track has to be limited to 2 seconds.