Connect with us

How to load sounds into a microcontroller

Discussion in 'Microcontrollers, Programming and IoT' started by God_JoKeR, Aug 19, 2015.

  1. God_JoKeR

    God_JoKeR

    3
    0
    Aug 19, 2015
    Hi, this is my first post in electronicspoint.com,

    I have a very simple electronic project to make and I need help. I am trying to make a circuit that plays a sound whenever I push the switch, I will install this circuit into a case with a wrist band, making it a wrist "machine"(like a watch).

    I have all the materials required for this, a board, a speaker, and a switch. The only thing left for me is to put the sound IC(or anything that plays sound) into the circuit.

    I did some googling and found that sound signals are sent by something called a microcontroller. I have absolutely no idea on how to load my desired sound file into this module, I am lack of experience and I need you pros to teach me how to do it.

    I wanted to play an audio file of just a few seconds and of low quality, I believe I don't have to spend big money on this project(not more than MYR 5).

    Long story short, I need someone to teach me how to load the sound file into a microcontroller(step by step, no programming knowledge here) and someone to introduce any cheap and easy microcontrollers. Any help would be appreciated, thanks!
     
  2. martin the warrior

    martin the warrior

    35
    3
    Aug 10, 2015
    this guy does a very good job of explaining the basics of programming a microcontroller. its based on the arduino which is very easy to program.



     
  3. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    A microcontroller might not be the best choice for you. You can buy sound record / playback modules that are small and cheap. Ever seen a talking greeting card?

    Bob
     
    God_JoKeR and Arouse1973 like this.
  4. ADRT

    ADRT

    192
    32
    Nov 25, 2014
    Here's a good tutorial. Be aware that using an arduino is going to limit your playback length considerably. Like BobK says they make chips specifically for this.
    The gentleman in this video is using a mega and a 1.5 second file takes up a lot of memory.

    Oh, and he may be a bit off his rocker so to speak. :D

     
    Last edited: Aug 19, 2015
  5. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    ADRT likes this.
  6. God_JoKeR

    God_JoKeR

    3
    0
    Aug 19, 2015
    Yes, I seen those before, in fact, they are the first thing I found after searching for a tutorial of making a sound circuit, but the reasons I didn't get them are because:
    1) Too expensive(bad country currency+student's budget)
    2) I am doing this project as a personal achievement.

    Thanks for replying anyway!
     
  7. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    A microcontroller is not going to be cheaper. You need a programmer, and you would need to learn a lot. And to have even a few seconds of playback, you would need a microcontroller at the high end for memory, or an external flash chip to store the sound. I would guess that you will have $50 into this is you try to make it yourself.

    Bob
     
  8. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    Sounds about right regardless of the path you take unless you can find and use some cheaper Arduino clones.
    That said, after you try this, you can use the hardware for other purposes. If you buy a recording module, that's all it will ever do ;)
     
  9. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    Remember, this thing has to go in a wrist watch, so I think most Arduinos are out.

    Bob
     
  10. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    I forgot about that...
    That would require a transition to smaller hardware which would mean buying a breadboard at the very least if the OP can get away with using a couple 8-DIP packages...
    Although, the learning process can still be done with an arduino. The trinket for example is quite small, and you can simply order a raw 'AVR' and program it the same way.
    Or you can start right out the gate with AVR or PIC, but must be willing to flip the cost for programmers and prototyping equipment.
     
  11. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    Best bet would be surface mount, of course. We also need an amplifier of some kind. probably a MOSFET half bridge used with PWM output from the micro.

    Bob
     
  12. God_JoKeR

    God_JoKeR

    3
    0
    Aug 19, 2015
    Really? I've been to toy shops before, I found random toys(like toy cats or toy dogs) that only costed RM10(US$2.5)! These toys not only make shiny lights, but also plays a huge amount of sound effects. I have also seen toy swords that play a random song when it is on(the song is about 2 minute long, wow!). When I disassemble these toys, I found that their main circuit board is not larger than 4cmx4cmx4cm. Surely there's no reason why I need to spend so much on a simple project like mine.
     
  13. Gryd3

    Gryd3

    4,098
    875
    Jun 25, 2014
    The op has plainly stated that a major component to this plan was the desire to learn 'how' to do it.
    It may not be the smallest most elegant or cheapest solution, but you cannot put a price tag on such things.
    Buying a pre-made board is out of the question, and the cost of a micro-controller can easily be offset by the ability to learn and build multiple circuits.

    Tackle this however you want, and if you have questions please let us know.

    A desire to learn has cost the human race countless amounts of money, but has also rewarded us with vast amounts of useful and pointless knowledge.

    Edit:
    God_joker, we should also mention that these toys you are talking about are usually built in very large quantities for one purpose and one purpose only. Of course these things are cheap, but for 'you' to do this as a one off project will require one of two things:
    - Buying an Arduino, or other microcontroller with a built-in programmer. (most expensive)
    - Buying a PIC, AVR, or other microcontroller, but 'also' a separate programmer. (microcontroller can be a few cents, but the programmer will cost you quite a bit in comparison unless you build your own.)
     
  14. davenn

    davenn Moderator

    13,247
    1,746
    Sep 5, 2009
    your response is a typical one we see on forums like this from those that have no idea of the
    complexities of what they think is a simple throw together of a few wires a chip or 2 and a battery

    as Gryd3 said these thing are made in their 100's of 1000's that ensures the cheapness
    they also have highly skilled designers for these units and they also have multi-million $$ IC and circuit fabrication plants

    do you have access to any of that for doing micro electronic construction ?

    The answer is likely to be NO, so therefore you are limited in the smallest size you can make a unit out of commonly available parts and the prices that are paid for those parts in one off quantities
     
    Last edited: Aug 23, 2015
  15. BobK

    BobK

    7,599
    1,641
    Jan 5, 2010
    Good_JokR,

    How much do you think it would cost you to build a car that rivals a Honda Civic in performance, reliability, aesthetics, etc.? Do you think it would cost you the same amount as it does for Honda to build one?
    Bob
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-