Program An Arduino Using Your Sound Card


[Chris] wrote us to share a neat technique he has been using to program the Arduinos he uses in his projects. He likes to build bare bones Arduino clones rather than sacrifice full dev boards, and instead of programming them via traditional means, he is using his computer’s sound card.

He builds a simple dead bug Arduino (which he calls an Audioino) using a handful of resistors, a pair of caps, an LED, a reset switch, and most importantly – an audio jack. After burning a special audio bootloader to the chip, he can connect the Arduino directly into his computer’s speaker port for programming.

Once the microcontroller is connected to his computer, he runs the IDE-generated hex file through a Java app he created, which converts the data into a WAV file. With the Arduino put into programming mode, he simply plays the WAV file with an audio player, and the code is uploaded.

He says that this method of programming comes in handy in certain cases where he builds things for friends, because they can easily update the software on their own without a lot of fuss.

86 thoughts on “Program An Arduino Using Your Sound Card

      1. Back in the 80s, using a BBC Micro with a teletext adapter box it was not only possible to read teletext/ceefax, once a week they broadcast programs that you could download. Took an age because they were sent in many many small chunks.

        Sadly I got my own BBC Master Compact with a teletext adapter about a week after they stopped broadcasting programs.

        Programs broadcast over the tv waves man!

    1. Agree. I remember when someone did this but with a USB jack and we asked why it was an arduino… the general consensus cause it had the arduino bootloader… fair enough. This is an AVR microcontroller with a neat bootloader. Cool project though.

    2. What more is the Arduino besides the bootloader, IDE and the class library? Does it really matter, if the thing does not have pin headers in uncomfortable places and a USB programmer is not built in?

  1. …Brillant!

    This reduces the cost of an Arduino clone to under $10! $~4 for micro, plus a $1.50 audio jack, and approx $1 in resistors, caps, and other items.
    And that was at one off purchase prices…

    I might have to start using this for long term embedded projects that don’t need shields. Updating would be as simple as bringing over a MP3 player. So much easier and cheaper than using an actual arduino to update, or wirelessly with an xbee, or using a usb adapter.

  2. I wondered about doing this exact thing so I could program them using a cell phone. You would just drop all your sound files (programs) into DropBox on your PC and then use your Android phone to program while out in the field.

    This is exactly what I was looking for! Great job!

  3. This will save my day i guess. I am currently working on a small project where i am using the arduino ide but don’t want to include a full board in my system. the atmega is enough.. I will surely give it a go. And 10/10 points on creativity here fokes.

    1. @Benjamin I’m really certain this alone will not replace an Arduino. This only programs the microcontroller. While that is one step in eliminating the need to dedicate an entire Arduino to on project, you will still have to design,and build the supporting circuitry. Build anyway as it seems there are plenty of circuits published to the web.

  4. Cellbots and folks got this to work dynamically on a cell phone for serial data. I’m sure you could program using your cell phone and an audio file (in fact thats how i proved the dynamic stuff could be done).

    Just make sure you store it as a wave in some native bitrate (arbitrary sampling was not accepted by the phone’s DAC).

    Very nice hack!

      1. Simple. Make a program that looks for xxxxHz tones and then figures out which 2 are being used at the same time. This gives you 2 bits from each frequency.

        Hint: If you are planning on using a general FFT, you’re doing it wrong! An Apple II did this in software…
        If you have trouble, this is old school bare metal machine language hacking to get the most from the least at it’s finest. They gave us all those counters for a reason.

      2. I wanted to do the opposite – use a sound card to spy on an I2C bus(possibly slowed down). Or at the very least, to record the output of a bus spy’s buffer. I was thinking that I wouldn’t even need modulation at low enough of a speed. Just post processing by the ever-so-convenient GigaFLOP CPU that just happens to be connected to the soundcard.

        Hehe, nice use of a common output port that will likely be on ANY computer you’re likely to come across.

    1. hahahahaah you win an internet today XD

      But now I’m curious how this sounds, if it sounds at all.

      A freaking orgasmic set-up would be an old telephone modem (talking about with the handset and all that) programming through the network.

  5. This will probably play well with my audio-to-serial thingie that was on hackaday a while ago… Only thing is, how do they deal with levels? I thought you’d need an op amp or at least a transistor to do level shfiting. Maybe that’s just for phones since they aren’t designed to drive big speakers!

    1. People take note that the LINE OUT of the soundcard is being used, NOT the speaker output. That rules out some of the musing taking place, except using a microphone for “wireless” programming. You know of course the telephone is going to ring when you do that.

  6. Just wondering about what would happen if someone played an arbitrary sound file.
    Would the bootloader burn it and bork the chip or just reject it?

    Also, while ok if you’re just using for upload new firmware for friends etc, having to press the reset button at the correct time to trigger reprogramming would not be ideal/appropriate for a commercial product.

    Thinking about it though, if you used a stereo signal, one channel could be used for data and the other could send a short pulse which triggered the reset line to be pulled low.

    You’d need more components than would fit on a deadbug design, but if you were making a commercial product that would be an issue.

    Overall, very interesting work.

  7. Well if it works as well as Chris describes, it may lead more to duplicate projects that use this family of microcontroller. A thank you to Chris for taking the time to share this. Keeping in mind the differences between microcontrollers could this be used to program the on board flash of other microcontrollers?

    “program the Arduino”; so has Arduino become synonymous with the Amtel AVR microcontroller? Just one more thing we need to keep in context when we read articles. I suppose to start referring to the actual microcontroller would confuse the hell of those who came to the world of microcontrollers, and electronics via the Arduino, and really don’t understand how versatile microcontrollers can be beyond the dedicated development boards.

    1. Valid point. Since its not really an arduino its just a chip with some elegantly connected wires..

      Arduino is hard to disambiguate. Its a hardware platform as well as an ide and a set of libraries… So it could be some random Atmega running “Arduino”.

      I consider Arduino an ecosystem :)

  8. Thats impressive.

    I was thinking along those lines to see if a micro could be programmed using a Bluetooth headset so any old cheap touchscreen phone could be used to burn a chip.

    It got me thinking though, what about using this to program the Microchip PIC series as these often need an expensive programmer.
    What about 24Cxx and larger E2PROMs?

    1. people always bitch and moan about “expensive” microchip programmers, but the pickit2 and pickit3 (clones) are like £20 – or just use a parallel port programmer. in my experience, atmel programmers are of similar cost.
      In reality, the “debug” functionality justifies the price tag imo, and allows you to do stuff you just cant do without a huge load of code overhead on a usb bootloader.

  9. Great job, this is one of my favorite hacks on here in the last couple of years. Throw that .wav on an iPod and you can update it anywhere. If you could operate the Arduinos using audio that’d be even cooler.

  10. My first post ever was deleted earlier after years of checking this site everyday. WTF?? I thought this hack was awesome. The fact that you can throw an update on an iPod in .wav form is really slick. I’d like to see an “audio hack” category here

  11. I was really, really, really, really, really excited about this… Until I read that you still need to burn this audio boot-loader? It’s still cool, just not quite as practical as I had wished. Sad face.

  12. great and nice prototyping with resistor n such, I been wanting to implement some digital communication out an audio jack, What think yalls is the achievable baud?

    20khz / 8bits = 2.5MB/s

    could it be?

  13. Thank you for all the nice comments.
    If someone didn’t find the bootloader link:

    The IDE produces WAV-Files to program the Audioino. Converting this WAV-Files into MP3s will not work because MP3 is not a lossless compression. Therefore if you want to distribute your programs as sound file it has to be a WAV.

    Hardware issues:
    the capacitor in the audio line should be changed from 10nF to 100nF. This improves design stability.

  14. “great and nice prototyping with resistor n such, I been wanting to implement some digital communication out an audio jack, What think yalls is the achievable baud?”

    In this project
    the achieved about 20kBit/s. For digital transmission this is close to the maximum possible. If you use audio out with analog signals and a quite complicated algorithm, the theoretical maximum would be the data rate put into the sound channel: 44kHz*16bit

  15. I like to use IR for programming chips. You only need add an IR sensor like the ones used for remote control. Cost about $1 each. Write the program on the pc and output it as a series of pulses over serial. Also good for environments where you don’t want to physically connect the device.

      1. For programming you can use laptops that have IRDA ports, most do. I’ve done the sound card thing and while it works okay I finalized on the IR route because of the ground isolation it provides. I had issues with some laptops having power supplies that maintain a ground connection to the wall outlet and that is bad when working with devices powered off isolated supplies.

  16. Why are you people calling this an “Arduino clone”? It’s a freaking atmel processor. I have been playing with these since the 90’s… Now someone starts calling them “Arduinos” and its suddenly new to you all!? If I call my old buick a ferrari, will one of you pay lots of moneyz for it???

    1. I guess it depends on your definition of arudino clone. If yours is one that requires the shields to be used then I guess it isn’t a clone. My definition is anything that runs the code the arduino libraries and IDE output. One of the things holding the arduino back is the lack of people willing to use it without a shield . There is nothing wrong with arduino programming like he has shown here and yes to me that makes it still an arduino clone.

    1. If you don’t get it then you need to read the article again and again until you do…

      >He says that this method of programming comes in handy in certain cases where he builds things for friends, because they can easily update the software on their own without a lot of fuss.

      He’s got a programmer (that’s how he gets the bootloader onto the chips in the first place) but not everyone does.

      This means that when he makes something for his friends, or even sells something commercially, not all of his friends/customers need to have programmers also, they can just play a sound file on their computer.

  17. now all we need to do is to bit-bang the sound through USB and we can program AVR’s using USB with no USB-Serial adapters or PL-2303 chip needed! this is just fantastic!..:)

    — GTG find those USB speakers… :D

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.