An other Electronic Music Box

Discussion in 'The Projects Forum' started by z0oinks, Sep 12, 2012.

  1. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    Is anyone still there?

    I am trying to make an electronic music box for my girlfriend with one of her favorite songs on it. I have absolutely no experience in making electronic components, but I have fixed a couple of things before. If someone could tell me whether I should be using the PCB board or the ChipCorder IC or both, and then shed some light on exactly what I'm supposed to be doing with these, I would really appreciate it.
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    I found your post on the end of an existing thread:
    Electronic Music Box
    We call that hijacking over here, wich is not allowed.

    Now you have a thread of your own.

    Bertus
     
  3. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    The best way is with a µC (microcontroller). They do require some programming, and there is a learning curve. Once you get past that it can be cheap (some hardware required to program the chips).

    There are other ways though, what kind of music are you wanting, simple notes?

    Some examples of the songs you would like to make and how many notes would be nice.
     
  4. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    I have it saved now as an .aup on my computer. It is fifteen seconds long and is 4 KB in size. Would you want me to upload it somewhere and post a link to it?
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    The .aup is an audacity project file and will not hold all the audio data.
    You MUST export the file to have a complete audio-file either in .wav (uncompressed,large) or .mp3 (compressed,smaller).
    See this page for more info:
    http://filext.com/file-extension/AUP

    Bertus
     
  6. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Could you elaborate on the scope of your project? Based on your description, you want to play a pre-recorded 15-second song? Why not keep it simple and buy a greeting card that has a recording and playback function in it? You could then hack the switch or replace it with one that plays the song when the box is opened (assuming this is how you want it to work).

    Alternately, you can buy the recording module itself: http://store.bigdawgspromo.com/index.php?cPath=493&osCsid=c1f5c474ecf59c42ffa6c8bc436560dc
     
  7. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    To bertus: I know I had to convert it to another format, I just didn't know which yet and was just gonna wait. I will convert it to an .mp3

    To elec_mech: I thought about that, actually, I just didn't know if hacking the switch would be realistic. As I said, I have no experience with this type of stuff. I know that this would surely be the cheaper way, but would it be easy? I want this to be a sort of a challenege
     
  8. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    It would be easy. In the simplest case, there are two wires going to the switch. Cut them off, strip them and put them onto another switch. Perhaps a normally closed (N.C.) momentary push button and mount the switch so that it is pressed down when the box is closed. When the box is opened, the switch makes contact and starts the music.

    While I applaud your your desire for a challenge, in my limited experience with these, having a sound played can either be super simple using a pre-made device or very challenging trying to either make your own or programming a microcontroller to work with an IC that performs the same function, especially if you're new to electronics and programming.

    Now, you could still add some complexity and learning by adding other features to the music box, such as lights, spinning motors or fans, or use multiple recording modules and either have them go off in different orders every time the box is opened or, perhaps better yet, have a different one play every time the box is opened. In this way, something different is played everytime the box is opened depending on how many modules you use. This would be a great entry-level electronics project because you'd design a circuit to control each module (and perhaps lights and motors).

    You could also design a circuit that repeated the music X times. So the box is opened and the module is triggered, say, three times as if the user opened the box, listened to the full 15 seconds, closed the box and repeated this two more times, except of course they only opened it once and left it open. Just some ideas.
     
  9. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    I do like the idea of the lights in the box along with the music. Based on what you're saying, I think I will just get a card and take out the sound part and do that. Would adding lights take a lot of battery power? I would probably only be adding six or so lights. Also, what types of lights and batteries would be best?
     
    Last edited: Sep 14, 2012
  10. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    LEDs would be ideal as they consume the least power and you can get them in a variety of sizes and colors.

    They can, but it really depends on how many lights, how they are hooked up relative to the battery voltage, and how long they are on.

    LED voltage depends on its color and sometimes on its light output. Generally, there are two types, diffused and clear. Clear are usually superbright and ideal for seeing them from long distances or in daylight. Since a music box is viewed up close and we don't want to blind the observer, diffused is the way to go. Diffused LEDs are opaque and often their lens are colored.

    Back to color - for diffused LEDs, red, orange, yellow, and green usually require 1.9-2.4VDC each. Blue usually need 3.2-3.9VDC. All LEDs, at least the kind we're looking at, require 10-30mA of current with 20mA being the most common.

    Let's look at some examples. Say you stick with six red LEDs rated at 2.2VDC and 20mA each. Basic batteries come in 1.5VDC cells, so you'll need 2 batteries at a minimum hooked in series to get 3VDC of power.

    You could hook up all six LEDs in parallel. Doing this will require 20mA x 6 LEDs = 120mA total. If you run the LEDs for one hour, you will consume 120mA from your battery. Batteries are rated in mAh meaning total number of mA per hour. A good alkaline AA battery can provide roughly 2500mAh. If you were to hook up 6 LEDs in parallel and leave them on, forgetting about power to the music portion for a minute, the batteries would last about 2500/120 = 20.8 or a little under 21 hours, probably less as the batteries' voltage drops off as the batteries get closer to depletion.

    Now, if the LEDs only come on with the music for 15 seconds at a time or you decide to leave them on longer, say another minute or two after the music stops, the batteries will still only provide less than 21 hours of power. However, it might be days or weeks or months before they die since the music box won't be constantly opened.

    Back to the details - LEDs require a current-limiting resistor hooked in series between themselves and the power supply, otherwise the LEDs will consume too much power and burn up almost instantly. To find the required resistor voltage, use Ohm's Law: E = IR, where E is voltage, I is current in amperes, and R is resistance in ohms (Ω).

    Thus, E = 3VDC (our two AA batteries in series) - 2.2VDC (voltage rating of LED), I = 0.02A (20mA per LED). Rearranging, R = E/I = (3-2.2)/0.02 = 40Ω. So you need a 40Ω resistor in series with each LED. Since 40Ω isn't a common resistor value, you could go with a 39Ω or 51Ω instead.

    You could also op to use 4 batteries and provide 6VDC to your circuit. If you rearrange your LEDs so that two LEDs are in series, you can use one resistor per LED pair and end up with three sets of LEDs (3 pairs). Now instead of needing 120mA, you'll only need 60mA because each pair is only consuming 20mA. The caveat is each pair now requires a higher voltage: 2.2VDC x 2 = 4.4VDC. Using our equation from before: (6-4.4)/0.02 = 81Ω. Again, 81Ω is not a common resistor value, but 82Ω is.

    So you can see there is a trade off depending on how many batteries you use and how you wire your LEDs. If you were just wiring the LEDs and using the switch to turn them on and off, two batteries and six LEDs in parallel would be fine. If you end up using ICs and logic to time things, control what comes on when and for how long, you'll want to go with the four batteries and LED pairs because ICs will require either 5VDC or 6VDC at a minimum to operate. More on that later depending on what you want to do.
     
  11. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    I'm not gonna try to seem smart, that confused me a bit. I get that it takes more power to be able to time things than to just have it controlled by the switch automatically, but all the things about Ohm's Law and ohms don't make much sense to me. I really do appreciate you doing all that math for me ; )
    I think I would be going with six LEDs in parallel because it sounds a bit easier and I don't need things to be timed and whatnot. However, I would like the music to be looped and the lights to stay on until the box is closed. Would this be possible using this configuration? Would the looping be limited by the type of recording card I buy or could I change it to work that way?
     
  12. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    When you say looping, do you mean you want the original 15-second song replayed x times or indefinitely until the box is closed?

    The former would be easier. Let's say you want the 15-second song repeated four times. In that case, you'd look for a 60-second recording card or module and play the song four times back-to-back on the computer while making the recording.

    To have a recording module playback in an indefinite loop gets a little trickier and would require circuitry. A 555 IC in astable mode comes to mind, but this would likely require 3-4 batteries. You might get away with a few discrete components such as transistors, resistors, and capacitors.

    Let us know how many times you want the song repeated after the box is opened. Leaving the LEDs on until the box is closed again is super easy using a normally closed switch as I mentioned earlier.

    Hope I didn't overwhelm you with the previous post - I was trying to cover a lot. I can throw a circuit and parts list together once you think about how you'd like everything to work and let us know what you want to happen. You can of course start simple, get it working, and add more features later.

    At the moment, it sounds like you want the following:
    1) User opens box lid.
    2) LEDs turn on.
    3) Pre-recorded song plays x times or indefinitely.
    4) When lid is closed, LEDs turn off and music stops playing (if it hasn't already).

    If this is correct, just let me know how step 3 should work.
     
  13. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    I suppose having it repeated a couple times would give it the effect of having replaying infinitely if I had it play six or seven times, right? That would be either 90 or 105 seconds of playback, which I think would be more than enough time to open the box and do whatever you need to and close it. I assume this is out of range of any card I could buy at a store.

    Yes, that description of it is correct, and step three would be to have it play a certain amount of times
     
  14. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Huh, I found this: http://store.bigdawgspromo.com/prod...12955&osCsid=97a832b91af433fc1bc4d05ebeae2f6a.



    If I understand the description, you can do a lot with this:
    1. Load a single file, say your 15-second song, and the song will play once everytime the button is pressed.
    2. Load multiple files. Each file will play once, in sequence, everytime the button is pressed.
    3. Merge multiple songs into a single large MP3 and it will play the entire length. The only catch here is I don't think the song will stop if the lid is closed prior to the end of the song. If it's 60 seconds long and the lid is closed at 35 seconds, it probably won't shut off until it is finished. There might be a way around this if the unit has a reset button. Didn't see a user manual immediately. We could hack this by interrupting the power going to the unit itself in the worst case.
    You'd replace the push button switch with your own to work with the box and lid.

    Note the total length of playback depends on the quality you'd like to hear out of it.

    Let me know your thoughts.
     
  15. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    That looks like it would work, except I would really like it to turn off when the box is closed. This would give it a more professional and sophisticated feel, and would really show that I spent a lot of time on this. So, if there was a reset button, we would just add a little piece on the box so it would press the button when the lid closes, correct? If it doesn't have a reset button, how would we go about interrupting the power?

    Also, how hard would it be to replace the push switch with a normally closed switch? From the video, it almost looks like you can just remove the switch and replace it, but that may just be me. Would I need a soldering iron to do this?
     
    Last edited: Sep 16, 2012
  16. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Yes, but note if you use a reset button or interrupt power, this will have to be enabled BEFORE the play button is pressed otherwise the unit might not "see" the play button press. To overcome this, I'd suggest putting the reset/power interrupt button along the edge of the box farthest from the hinge. Then put the play button switch as reasonably close to the hinge as possible. In this way, the reset is off (or power is on) just before the play button is activated as the lid is opened. That should be a good challange. :D

    Well, the unit uses three button batteries. I'd suggest removing these and replacing them with either 3 AAA or 3 AA batteries so a) you don't have to search for and buy button batteries which can be expensive depending on where you buy them and b) you can power your lights and use one set of batteries for the whole box instead of two types.

    To do this, you'll need a volt meter and a soldering iron (and solder). With the button batteries installed in the unit, you'll check the voltage across the battery contacts until you find 4.5VDC. Once you find 4.5VDC across two contacts, you'll mark them + and - to denote which is positive and negative. You'll then remove the button batteries and solder a wire to one of the contacts, say the one marked +. You'll solder the other end of this wire to one end of a normally closed (N.C.) momentary switch. You'll solder the positive lead from 3 AAA (or AA) battery holder to the other end of the switch. The negative lead of the battery holder will get soldered to the battery contact on the unit you labeled -. As long as the switch is not pushed, power will go to the unit. Once the switch is pressed (lid closed) power will be disconnected and the unit will shut off.

    Yes, you'll use a soldering iron to remove the leads from the switch and solder to a new N.C. momentary switch.

    The trick, I think, will be finding switches small enough for your project, but that will depend on how big the box is.
     
  17. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    Alright, that makes sense to me.
    So far I need a battery holder and batteries, a soldering iron and solder, some LEDs, that USB Push component, an N.C. switch, and a volt meter. For a soldering iron, is there any one in particular I should be getting? At Radioshack, they have a "10 Piece Basic Soldering Set" for $10, an "11-Piece Soldering Tool Set" for $23, and a "Weller® WLC100 40-Watt Soldering Station" for $53. I probably won't be doing much other than this project (and maybe changing some LEDs in controllers now that I think of it), I think I would jump for the eleven piece set.

    As for the size of the box, I'm not sure yet. I still have to find one I like that isn't too expensive.
     
    Last edited: Sep 16, 2012
  18. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    I didn't see a 10-piece, but I did see a 5-piece: http://www.radioshack.com/product/index.jsp?productId=2062758.

    The 11-piece includes some basic hand tools you probably already have and the ones included with it aren't the best quality. I'd save the money and go with the 5-piece. The 30-watt iron will be fine. The Weller is overkill if this project is all you plan to use it for.

    RadioShack also carries a three AAA battery holder: http://www.radioshack.com/product/index.jsp?productId=2102735. Couldn't tell if it has lead wires or not, but having some wire would be good anyway. If you have an unused telephone or Ethernet cable, you can cut off the outer jacket and get a bunch of wires.

    Remember you'll want two switches - one for reset/power-off and one for the playback button. You'll probably need to order these from an electronics parts distributor and you can wait to order the battery holder and anything else that might come up until then too.

    I'm heading out on a long flight and won't be online for a day or two, but I'll respond to any questions you have when I can.

    Good luck!
     
  19. z0oinks

    Thread Starter Member

    Sep 12, 2012
    129
    0
    Whoops, I meant five piece

    On the page for the battery holder it says it has color-coded wire leads, but I do have a bunch of extra ethernet cords and phone cables if I need extra. About how many hours of usage would the three AAA batteries supply for the box?

    Do you mean to say I could add a reset/power of switch to the component if it doesn't already have one, or just that I'll need a switch if it does have one? I thought that if it didn't have one my only option would to disrupt the power like you described before. Let me know when you get back.

    EDIT: The guy at bigDAWGS says that if you push button is pressed again after the sound is playing, it will stop the music. Would that mean that if the N.C. switch is closed again it will stop or would it mean that the box would have to be reopened and closed to have it shut off by itself?
     
    Last edited: Sep 16, 2012
  20. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Whew, long trip. Okay . . .

    Figuring we stick with six LEDs in parallel, a good AAA battery will get you roughly seven hours continuous. That means seven hours operating, not seven hours from when you install the batteries.

    Correct - let's assume the unit does not have a reset switch. You'll need two switches total - one to disconnect power to the sound module when the lid is closed and one to "press" the start switch and turn on the LEDs. It would be ideal to do the latter with a DPST switch. That will have separate contacts for the sound module and the LEDs. I can help you find something appropriate after you determine what size box to go with.

    Just read your edit -
    I think the latter - I assume that if a user presses and holds the button down, the sound will play. I also assume that if the button is released while the sound is playing, the sound will continue to play. These are a lot of assumptions though.

    Unfortunately I've got limited access to the WWW, so I can't get onto BigDawg's site, but I suggest you go to the link I sent and look for an identical product with a slider switch. I saw it, so I know it is there. That should operate like a greeting card - pull open and the sound plays, pull closed while sound is playing and it will turn off. I'd of course check with them to be sure that is the case. That should do what you want. We can still add a different switch, the key is making sure it works like you want it to.
     
Loading...