CrazyEngineers
  • Making a clock play a song

    uttaresh

    uttaresh

    @uttaresh-JQpV67
    Updated: Oct 19, 2024
    Views: 1.1K
    Hey, I'm a Computer Engineering student, with some minimal experience in Electrical Engineering so far. My friend asked me how I could make a clock, preferably mechanical, play a song (just one particular song, actually) at a particular time. Now she doesn't want a simple alarm clock or iPod dock, she would like me to actually make it, circuits or not. Does anyone have any suggestions?

    Even if I get my hands on some sensors and stuff to detect the correct time, how do I translate that into playing the song? How do I play the song in the first place? How do you play a song in a circuit? Is it possible to harness the power of those electronic greeting cards that play songs? Thanks.

    Yes, I know this is an absurd request/task, but any help would be appreciated.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • sauravgoswami

    MemberMay 2, 2010

    Hello Uttaresh,well you can make one for that you need a crystal,digital counter ,audio processor,memory and speakers, the circuit is easily available on internet or EFY site,do check!!!
    Are you sure? This action cannot be undone.
    Cancel
  • aj_onduty

    MemberAug 26, 2010

    On both the hands of the clock, keep a tiny magnet each(preferably a rare earth magnet, you will get it in a hardware shop). And at every minute point, keep a reed switch each. connect all the reed switches to a microcontroller. They should be defined. I will tell you the idea in a better format after some time, currently I am busy. Try finding out the rest idea from the clue.bye for now.
    Are you sure? This action cannot be undone.
    Cancel
  • bill190

    MemberAug 26, 2010

    The following program will play 3 different RTTTL tunes on a Parallax Basic Stamp microcontroller. These are the tunes which play on cell phones, so plenty of different tunes out there. Search for RTTTL. The following program is at the maximum memory available for that microcontroller, so if you wanted a different tune, you should replace one of the existing tunes. Here is the basic stamp link...
    #-Link-Snipped-#

    Here is a link to the program...
    #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
  • bill190

    MemberAug 26, 2010

    Here are my notes on that program...

    This is on a BS2 homework board. I modified the Rtttl program "MicroMusicWithRtttl.bs2" so that it would play 3 different tunes. The attached modified program is called ButtonSelectsRtttlTune.bs2.

    There are 3 LED’s, a push button, and a speaker.

    You can select which tune you want to play with the push button.

    The 3 LED's...

    The first LED will start blinking...

    If you press the button while this light is blinking, the 1st tune will play (after the other LEDs finish their “user input” cycle).

    Then the 2nd LED will start blinking. If you press the button while this light is blinking, the 2nd tune will play.

    Then the 3rd LED will start blinking. If you press the button while this light is blinking, the 3rd tune will play.

    (After you have made your selection(s), the tune(s) will begin to play.)

    If you don't press any buttons, no tunes will play. If you press the button only when the 2nd LED is flashing, only the 2nd tune will play. Or only when first light flashing, only the first tune. Or press the button when the 1st and 2nd LEDs are flashing, then the 1st and 2nd tunes will play, one after the other is finished playing. Or press the button for all 3 lights, and all 3 tunes will play, one after the other.

    There are many debug messages to also tell you what is going on, although this will work without being connected to a pc.

    This program just about takes up all the memory. I had to move some things to subroutines so it would all fit. But there is a tiny bit of extra space now. If you comment out the debug messages, this would give you more room to add more tunes or longer tunes.

    Unfortunately, moving things to subroutines, makes the code more difficult to understand. Sorry about that. I added a bunch of comments though.

    I found that the [Done DATA ",q,"] line was not used (Done) in the original program. I added a comma q (,q) to the end of each Rtttl tune which implements this feature. (Breaks it out of the loop.) Then this makes it stop playing and is necessary for my modified program to then go on and play another tune.

    So for example, here is one of the 3 tunes from the attached program. Notice the last entryis a ,q added at the end...

    'Song 1 For He's A Jolly Good Fellow
    RTTTL_Pointer1 DATA "ForHe'sAJollyGoodFellow:d=4,o=7,b=320:c,2e,e,e,",
    "d,e,2f.,2e,e,2d,d,d,c,d,2e.,2c,d,2e,e,e,d,e,2f,",
    "g,2a,a,g,g,g,2f,d,2c,q"

    You can replace just that part and switch the songs. Note that I renamed "RTTTL_File" to RTTTL_Pointer1, RTTTL_Pointer2, and RTTTL_Pointer3 in my program for the 3 different tunes.

    Instructions for connecting the LED's, the pushbutton, and the speaker are all in the "What’s a Microcontroller?" book. Following is a link to that book online and the associated page numbers are listed.

    "What’s a Microcontroller?" book...
    #-Link-Snipped-#

    LED page 48, except use 3 LED's to I/O 0, 1, and 2.
    Pushbutton page 76, except connect to I/O 15.
    Speaker page 220, except connect to I/O 14.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register