PIC Projects
Doorbell with SD / EEPROM
SD FAT16/32 for .bmp
LCD TFT Egg Timer
LCD TFT Oscilloscope
SD Talking Clock
SD Sound Recorder,
    FAT32 wav Player
LED Thermometer

LED Egg Timer
LCD Egg Timer
Frequency Counters
TFT 10MHz
100KHz For PC
1MHz For PC
8 Digits LED 50 MHz
Scope Screen Display
LCD Module 10MHz
6MHz for Android
USB PIC18F2550
USB TFT display BMP
USB DS18B20 Sensor
USB Thermometer
USB Counter
USB Meter
USB Oscilloscope
USB Input-Output
USB 16x2 LCD

COM & LPT Ports
MCP3201 on LPT
Serial TFT Text
Serial Inputs Outputs
Serial Port LCD
Analogue Signal to LPT
MCP3201 on Serial Port
Serial Thermometer
Analogue Signal to Serial
LCD Display on LPT
Serial Thermostat

Others
Water Softener
HP Stream 7 docking
3.7V to 5V
Solar Charger

Infrared Decoder
PIC Music

Code Lock
Code Lock with LCD
HOME MOBILE Technical Tips

ARDUINO TALKING CLOCK

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

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

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.




Name:

Comments and questions

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



15.10.2017 - 22:49
Name: Moty
Comment: Hi Omar, I know too little about simulators to be any help.

15.10.2017 - 19:31
Name: Omar
Comment: Hi, I simulated your clock but unfortunately, time is not moving. We will be grateful if you help us. omarfaruksaritas@gmail.com

15.10.2017 - 15:49
Name: Moty
Comment: Hi Mr Ozgur, Yes, when you set the time by pressing the buttons the internal registers (RAM) update. The LCD and the Talk read the time from those registers.

15.10.2017 - 11:56
Name: mr. özgür
Comment: Greatings, I couldn't quite understand how clock states the real time. Does it set the time after i increase or decrease the numbers on lcd display?

15.10.2017 - 11:56
Name: mr. özgür
Comment: Greatings, I couldn't quite understand how clock states the real time. Does it set the time after i increase or decrease the numbers on lcd display?

15.10.2017 - 11:41
Name: mr. özgür
Comment: Greatings, I couldn't quite understand how clock states the real time. Does it set the time after i increase or decrease the numbers on lcd display?

02.05.2017 - 15:47
Name: Moty
Comment: Hi Sangatee, Click button DOWNLOAD SOFTWARE , If it doesn't work send your email address and I'll send you the code.

02.05.2017 - 10:57
Name: Sangatee
Comment: Please can I get program code

12.09.2016 - 21:51
Name: mike
Comment: i find this very useful, thanx pls

19.04.2016 - 08:47
Name: dipen
Comment: while simulating on proteus,clock doesnot advances

12.10.2014 - 10:33
Name: Moty
Comment: Hi Abraham. My full name is Moty Santos Jelahlibahd.

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

02.06.2014 - 12:08
Name: Moty
Comment: 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.

02.06.2014 - 02:09
Name: Yusa
Comment: How many seconds can a track be.