Make a Talking Clock

by Gadget Gangster in Circuits > Clocks

54194 Views, 109 Favorites, 0 Comments

Make a Talking Clock

4566017175_049ed273d9.jpg
This clock announces the time using your own voice! 

I put it together as a tribute to the old Popcorn service in Northern California.  You could dial POPCORN from any phone, and a recording would tell you the time of day. 

Originally, I wanted to use Joanne Daniels' voice (she was the voice of Popcorn), but I couldn't get enough samples of her saying all the numbers.  Pat Fleet (the lady that says "A, T, and T") actually offers recordings, but you have to pay for them.  So I settled on using my voice, and it's easy to substitute your own.

First, a little demo, then flip to the next page and I'll show you how to make it on a breadboard.



FAQ

4566001049_2674b2ac94.jpg
4512176579_e22b518b1d.jpg
Q: How does it work?
Audio samples are stored on an SD card.  The time is tracked with the DS1307 RTC.  The microcontroller polls the RTC every second to update the display and watches the big red 'announce' button.  Once you hit the button, the microcontroller plays the appropriate samples based on the current time. 

Q: How do I use my voice?
You just record your voice and copy to the SD card.  I'll show you how in a bit, but it's easy.

Q: Can I make it do x?
Probably.  You can download the code on the next step - you can poke through it and change things fairly easily.

Q: What are the technical details?
It's a Parallax Propeller running at 80Mhz connected to a DS1307 Real-time clock and an HD44780 8x2 Character LCD (4-bit interface).  The Propeller manages everything including audio playback using rayman's excellent wav playback objects.  16kHz mono or stereo wav playback is supported. 

Here's a walkthrough of how it works.  Note that I'm using an LCD UI module and Propeller Platform SD, but this instructable will show you how to build it with a breadboard.

Materials

4566624982_8cbe1baa89.jpg
4566625444_57e28da32d.jpg
4565996067_ae769020e5.jpg
4565996983_caab010d5a.jpg
4565996531_0d0a2e0604.jpg
4565995611_31ac006139.jpg
4566625590_c9eb66bf76.jpg
I built my clock with a Propeller Platform SD and an LCD UI module.  If you've got those, then the only thing you'll need is a headphone jack to connect the clock to speakers.  Setup is a little different, and I'll show you how to do that later. 

First I'll show you how to build your clock on a breadboard - and here's what you'll need for that;

Code
Here's the sourcecode.  Everything is available under the MIT license.

SD card slot
I mounted mine on a protoboard and cut to size with a dremel.  I'm using a slot from mouser, You can also solder to the pads of one of those microSD - SD adapters.  I've put mine on a protoboard to make it easier to connect.

8x2 Character LCD
Displays the time.  Sparkfun has a 16x2 LCD that will work, too

little speaker
I ripped this out of a little stereo set I had.  You can also use a headphone speaker

3xAA battery box
Mouser Part#12BH331/CS-GR

Parallax Propeller
Available at Parallax

DS1307 RTC
Mouser Part #700-DS1307N

5Mhz Crystal
Available at Parallax

32.768 KHz Crystal
Mouser Part #73-XT262

32kb EEPROM
Mouser Part #579-24LC256-I/P

10k Pot
Available at Parallax

5x Tactile Switches
Mouser Part #653-B3F-1000 

3.3v Voltage Regulator
Mouser Part #511-LD1117V33

Around 10 10k ohm Resistors

4x 4.7k ohm Resistors

3 or 4 .1uF Ceramic Caps

3 47uF Electrolytic Caps

A Prop Plug

If you want to add a battery backup to the RTC, you'll need either a 3v battery, or a super cap and diode

Breadboard and a bunch of hookup wire.

An SD or microSD card. 

Recording Your Voice

4566642820_2053096cf2.jpg
Let's start by capturing your voice samples.  If you'd rather skip this, you can use the samples I made (download here).

Audacity is a great program for recording audio.  You can download Audacity here.  When using Audacity, be sure to set the track properties to 16-bit PCM, 16khz rate.  Mono is fine, stereo will work, but I only hooked up a single speaker (and why does your clock need to be in stereo?). 

Each number gets it's own wav. file.  You'll need the following samples:

Numbers
  • 00.wav
  • 01.wav
  • 02.wav
  • 03.wav
  • 04.wav
  • 05.wav
  • 06.wav
  • 07.wav
  • 08.wav
  • 09.wav
  • 11.wav
  • 12.wav
  • 13.wav
  • 14.wav
  • 15.wav
  • 16.wav
  • 17.wav
  • 18.wav
  • 19.wav
  • 20.wav
  • 30.wav
  • 40.wav
  • 50.wav
words
  • am.wav
  • pm.wav
  • geve.wav (good evening)
  • morn.wav (good morning)
  • anoon.wav (good afternoon)
  • and.wav (and)
  • oclock.wav (O'Clock)
  • secs.wav (seconds)
  • exact.wav (exactly)
  • beep.wav, a beep sound
  • standard.wav (Pacific standard time will be)
  • dlight.wav (Pacific daylight time will be)
Record each of them as separate files and save to the root directory on your SD card.  I recorded all of them as a single wave, then chopped them up into separate files.  It seemed easier to control the volume levels that way.

Also, if you have a laptop, you'll get better results using an external microphone.  Depending on your laptop, you might get some hiss or buzz.

Make It: Schematic

4567084868_4055807353.jpg
First, review the schematic below to understand how everything is connected.  The box on the left is the SD card slot, and the box on top is the Prop Plug.  I'll walk through breadboarding it, but the schematic is your best guide.  Here's a hi-res version, the lo-res version is below.

Make It: Power and Propeller

4566626712_64ae763f1e.jpg
4565997515_36ff9a6213.jpg
4565997865_5797df2694.jpg
4566627692_765d24fc3b.jpg
Connect the battery box to the breadboard and build the power stage. 

Then add the Prop, connecting Vdd and Vss on both sides of the chip.  Notice I've added 2 .1uF Ceramic caps to each power rail. 

Now add the EEPROM and 2 10k resistors, right above the Prop

Finally, add pin headers and wires to connect the headers to RST and P30 and P31. 

Make It: Testing

4565998621_8052764b09.jpg
4566624312_1335c9666a.jpg
Your basic Propeller setup is now complete.  Plug your Prop Plug into the headers, connect the usb cable and fire up the Propeller Tool.  Hit F7 and make sure you can communicate with the Prop

Make It: RTC

4566628520_dc00d41d94.jpg
4565999423_721638aaf3.jpg

Now, let's add the Propeller's 5Mhz crystal (at Xo and Xi). The Prop needs the crystal to run at 80mhz, which is required to do wav playback.

Add the DS1307, connecting it to P29 and P28, the same pins as the eeprom. Also add the watch crystal to the DS1307's P1 and P2.

Optionally, you can give the DS1307 a battery backup by either connecting a 3v battery to P3, or using a super cap and diode. The super cap will charge up whenever the power is applied to the circuit, and the small diode will make sure it only discharges to the DS1307 (instead of powering the entire circuit)

Make It: SD Card, Speaker, Display

4566629378_6f35850a69.jpg
4566630072_07805e1a74.jpg
4566001049_2674b2ac94.jpg
4566001709_1c23a3e14f.jpg

Connect the speaker to the Propeller, then the SD Card. Note that each line on the SD card has a pull-up 10k resistor.

Connect the LCD Display. This is a complicated connection - refer to the schematic for each pin. Note that DB4-DB7 go through 4.7k resistors.

Finally add the switches you'll use for input.

Make It: Programming

4566001049_2674b2ac94.jpg
Once you've got everything wired up, download the sourcecode (here), connect your Prop Plug and program the Propeller. Here's what it will look like;

Make It: Using the LCD UI and Propeller Platform SD

4512176579_e22b518b1d.jpg
4566002609_63dd2710fc.jpg
If you're using the Propeller Platform SD and LCD UI, setup is a little different;

1 - The Propeller Platform SD is pre-assembled.

2 - Follow this instructable to put together the LCD UI.

3 - You don't need a Prop Plug.  The Propeller Platform SD has a bootloader, so you just unzip this file and copy to the root of your SD Card.

4 - You'll need to add a headphone jack or just add hookup wire to a small speaker on the LCD UI.  You can see in the photos how I did it.

That's it!  Have fun with your new talking clock!