Trying to make a talking clock.... stuck!! :/

Hi All,

I have been on a quest to make a talking clock as a gift for quite some time now, similar to the idea of the one sold here:

That is, a clock that plays a recorded message every hour. This I thought was a great gift idea.
The problem is, the company that sells these in the link above went on the cheap, and now the clock they offer only plays the same message every hour, not 12 different ones like it originally did. I want mine to play a different message each hour, say have family members say things.

So I wondered if I could make my own. I ended up looking around online, and found a chip that can play recorded sound files if they are converted into the right format (the soundfile conversion I can do). I purchased a few parts after talking to an electronics store on recommendation, including an Ardunio, and I'll list them here. The first part listed was what started me thinking it could be done. So now I have 4 parts altogether:

SoundOut audio module

Voltage power supply

realtime Clock

I also have bought an Ardunio Micro "without headers". This one:
http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11_12&products_id=283

So so far I've bought 4 chips altogether. The company I bought all this from claimed it should be a rather simple thing, involving connecting them with some jumper wires and then I assume hooking up a speaker and power source, like a battery. They said the whole project should 'only take an hour or so'.
The problem is....they never got around to telling me how to connect the parts. :frowning: So I'm left high and dry. I've been getting some advice on another page and the whole thread is here:
https://forum.sparkfun.com/viewtopic.php?f=32&t=36537&p=163501#p163501

So basically I'm at this point today:
I have the four chips wired together, and hooked up to a power source and speaker. I have twelve .ad4 sound files created, one for each hour on the SD flash card. I can manipulate the wires and get the sound files to play. So, so far so good. I also have the Ardunio software downloaded to Win 2008, Ardunio 1.0.5. But at this point I'm dead in the water, though it seems like I'm so close :confused:

SO......Here are my hurdles and questions. If anybody can answer ANY, I'd really appreciate:

1- I assume I need to write some kind of 'sketch' program and then upload it into the Ardunio, to run the clock and then kick off the sound files every hour. I've tried doing this, searched for samples, gone to the bookstore but no luck.
I think it would have to not be very complicated which is the frustrating part. Something along the lines of this as it would be in UNIX script:

TIME=1;
while [1]
do

sleep 3600; # wait 1 hour
case $TIME in

  1. play 0000.ad4;;
  2. play 0001.ad4;;
  3. play 0002.ad4;;
    ....
    esac
    TIME=expr $TIME + 1;

if { $TIME > 24 } then TIME=1;
done

Can anyone just give an example of how this would be done? I have some programming experience but I'm completely new to Ardunio and working with chips.

2- Right now I have the Ardunio hooked up to a 9V battery- is this OK? Is this appropriate to run a 'talking clock'?

3- The only other thing I imagine I would really want or need to figure out... this only needs to be simple as possible..... is just a button on the clock box. When you press the button, it would then play the 1am sound, again... 2am sound... then 3am. And then CONTINUE to 'clock on' after that point. So in this way, somebody could wait until the top of any hour, and set the clock.
I'm hoping the clock chip I bought, which includes a small battery, would keep the unit from resetting and the code would be saved- you know so whoever has this clock, they don't have to get hold of me and fire up Ardunio software if they change the battery.

4- Could this have been done with less hardware? The company I bought all this from, got me for over $50 dollars just for the electronics. I'd like to make another one of these if it works but this is really kind of expensive. :confused: Thanks for any help!!!

A suggestion:
Try and find a working project that will utilize as many of the parts you currently have.

You can "extend" the search to include a chip or two...

Ray

I would tackle the project in three parts.

First part - use the voice shield etc to play your recordings and work out how to make each recording play when you want. I would expect to find example sketches that do this.

Second part - learn how to read the time from the RTC and execute code at the top of the hour. I would expect to be able to find example sketches that show how to do this. If the method you use to access the RTC doesn't provide a better way then the quick and dirty solution would be to read the current hour at regular intervals, remember the previous hour value, and each time the hour changed execute code which prints out the new hour value.

Third part - instead of printing the time out, play the sound.

I was hoping I wasn't going to have to go and learn another whole entire new programming language I'll never use again, just to get this thing to check the time, and play an mp3 (ad4) file every hour......but sample code is eluding me.
The best thing I've seen so far are these two links, although both especially the 2nd seem way overboard and too many bells and whistles for what I want to do. I know this cant be very complicated, if it is Arudinos are more work than they are worth. And from what I've seen so far, they cost a lot :confused:
I'll keep looking

http://elek101.blogspot.com/2012/12/arduino-talking-clock.html

Seems like you are heading three different directions.
First of all - don't blame your setbacks on Arduino.
No matter which way you will go you need to realize that most applications are build using libraries someone else already wrote.
Download a library and sample code provided. Analyze code ( on paper) and find FIRST function to be executed - maybe even some kind of initialization / setup. Insert a print function and TEMPORARY end to such function, recompile and run the code.
print function is your friend helping you tracing your progress thru the program. When I compile in VC++ I use #define DEBUG which can be later #undefine for such purpose. But you do not have to use #define.
My approach would be to find the first voice output function by repeating this debugging process.
I believe the sample code speaks whole string of digits
Once you know you can get a voice out, than figure out how to make it to play specific file at specific time.
Add RTC last.
Your code may look messy and with lots of stuff you do not need, but as long as it fits into available memory and does what you want, don't sweat it. The computer does not care about stuff it does not use, and if you really picky there is always // comment out.
Good luck
Vaclav

jeffpas:
I was hoping I wasn't going to have to go and learn another whole entire new programming language I'll never use again, just to get this thing to check the time, and play an mp3 (ad4) file every hour......but sample code is eluding me.
The best thing I've seen so far are these two links, although both especially the 2nd seem way overboard and too many bells and whistles for what I want to do. I know this cant be very complicated, if it is Arudinos are more work than they are worth. And from what I've seen so far, they cost a lot :confused:
I'll keep looking

<data:blog.pageTitle/>

arduino speaking clock | 9i9ja

The project you're trying to tackle is not a simple one and if you want to complete it then you're going to have to deal with the technology - there's really no way around that. You don't say what programming languages you already know, but the Arduino is programmed in a language which is basically C++. This is a very common language for microcontroller development and widely used for computing in general. There are many other block structured procedural languages which share similar syntax and concepts. If you're going to do programming in future then C++ is a very useful language to learn. (The corollary is that if you're just doing this for fun and it turns out not to be fun, then there's no good reason to carry on.)

I don't know what you consider a lot, but here in the UK you can get a UNO for under twenty quid and an MP3 shield for similar money. RTCs are very cheap. If you don't want to limit yourself to official Arduinos then you can get clones that are much cheaper, down to a couple of quid to buy just a compatible chip. Quite often the Arduino solution would be more expensive than the equivalent consumer product you can buy off the shelf, but you can't always buy exactly what you want and anyway making it yourself is more satisfying, and more fun if you enjoy this sort of thing. But if you don't enjoy it, it doesn't make sense to spend your time doing it.

Sorry to sound a little exasperated there, this is my 3rd thread on the topic and I've been at this for quite some time now. I really have never heard of an Ardunio before, never even wired two electronic chips together in my life... never worked with or heard of a realtime clock, soundout module, a voltage level translator, converted ad4 files.... let alone done anything with the language, its just been a whole lot of new to swallow at once. I have done soldering once at least, though I'm pretty sure I didn't do it right. oh well. I'm not afraid to try. But its been kind of like trying to learn how to juggle on roller skates, when its my first time ever on skates. At least I haven't broken anything yet! :slight_smile:

In any case thanks for the pointers everyone, I will check the links and try chopping this up into small goals and crawl along in my blind slow way, I'm hoping I can still make Christmas on this thing. It is a neat idea. If not, there's always next year. ugh!

@PeterH good point with the hardware, and I know I could have done this cheaper. I just didn't know what to use. Anyway I am thinking at this point the 4 chips are pretty much required to make this work, though the use of the realtime clock is still a bit of a mystery to me. But I think there is something wrong with the Ardunio software I have, it does not seem to be compiling/executing I'm getting errors. Maybe when I get that figured out, things will start making more sense....

@jeffpas:

...this is my 3rd thread on the topic and I've been at this for quite some time now. I really have never heard of an Ardunio before, never even wired two electronic chips together in my life... never worked with or heard of a realtime clock, soundout module, a voltage level translator, converted ad4 files.... let alone done anything with the language, its just been a whole lot of new to swallow at once.

Generally the more senior members of the forum will advise a newbie to not try and swallow an advanced project in one gulp... it frustrates everyone.

Our goal is to help you learn, not to prove we can program. There are lots of students that frequent the forum and want their homework and class projects written by us and we take the same tack with them. We expect you to tackle your project, learn what there is to learn about the hardware and requirements, study manufacturer's reference designs and reference code, AND to put together a sketch that is a good-faith effort on your part. Then, if you ask specific questions, someone will typically jump in and help based upon their specific experiences and knowledge.

Learning should be fun; the frustration is caused by your expectations. May I suggest that you at least work through some of the online electronic tutorials with Arduinos? You can Google many, but a couple few that come to mind:
https://www.sparkfun.com/tutorials
http://www.ladyada.net/learn/arduino/

http://playground.arduino.cc/Main/ManualsAndCurriculum

Wish it were as easy as Red pill or Blue pill...

Best luck,

Ray