Last chance to enter The Hackaday Prize.

Program an Arduino using your sound card

audioino_programming_arduino_with_sound

[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.

Comments

  1. Chris says:

    Load freebird.pde! Load freebird.pde!

  2. Adam says:

    Wow, maybe cassette-recorded programs might make a comeback!

  3. Balloonman says:

    I love it! Reminds me of saving programs to audio cassette tapes from that old Apple ][.

  4. Aaron says:

    Shit that’s awesome.

  5. Chris says:

    wow that is one interesting design.
    Programming with an MP3 player, love it.

  6. Sphere says:

    Neat technique but it’s sad what people call arduino’s nowaday. I don’t see how a bare AVR with some fancy bootloader should be called arduino or xduino for the matter.

  7. resisatator says:

    …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.

  8. nikescar says:

    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!

  9. Benjamin Sølberg says:

    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.

    • N0LKK says:

      @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.

  10. zogzog says:

    man, some peoples are crazy, that’s it, really sick crazy peoples that’s what they are.
    and I’m redundant, that’s the kind of person I am, redundant.

  11. 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!

  12. psmay says:

    PRESS PLAY ON TAPE

    (Also, this idea is consummately awesome.)

  13. macegr says:

    If you plugged in a microphone, Kevin Mitnick could program it by whistling :)

  14. golddigger50 says:

    I imagine the government will one day use a similar method to brainwash us. Way to be ahead of the curve!

  15. Dan says:

    I thought my zeptoprog was cool, but this is just killer beans.

  16. roboman2444 says:

    I wonder if it would work well enough with a microphone and small amplifier to program “wireless”.

  17. kyle says:

    Fucking genius.

  18. 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!

    • N0LKK says:

      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.

  19. The Cageybee says:

    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.

  20. andrew says:

    Wait. The link doesn’t seem to indicate that a special boot loader is necessary (other than just the standard arduinoISP boot loader). What’s up?

  21. N0LKK says:

    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.

    • 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 :)

  22. wilson skatalloosdt, the guy across the street says:

    yeah!

  23. xorpunk says:

    pretty awesome hack. does any type of hardware compression or cleaning ever interfere?

  24. bothersaidpooh says:

    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?

    • steaky says:

      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.

  25. Beat707 says:

    This is great indeed. I wonder if it would work with the ATmega8? ;-)

  26. Bill says:

    O man, if you thought the HAD comments were out of control, forget it. Do you see some of the comments on the original post in German?

  27. zrzzz says:

    CLASSY!

  28. Doc says:

    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.

  29. blodgar says:

    Unique thinking! I’m impressed, tho’ some are not…

  30. Alan Parekh says:

    Reminds me of my old C-64 with datasette.

  31. Doc says:

    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

  32. John Lock says:

    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.

  33. menotme says:

    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?

  34. ChrisMicro says:

    Thank you for all the nice comments.
    If someone didn’t find the bootloader link:
    http://www.hobby-roboter.de/forum/viewtopic.php?f=4&t=127

    Remark:
    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.

  35. ChrisMicro says:

    “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
    http://www.mikrocontroller.net/topic/224911
    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

  36. tamberg says:

    Sweet. Seems like this also enables any smartphone with to program an Arduino. At least in theory.

  37. cgimark says:

    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.

  38. NATO says:

    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???

    • ChrisMicro says:

      Because you can use the Arduino IDE and the Arduino Library to write programs.
      And the design was inspired from this:

    • cgimark says:

      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.

  39. Michael says:
  40. Dude says:

    I just dont get it, you have to load a bootloader, so that means you already have a programmer. so … why? is 4 wires really that hard to hook up?

    • dan says:

      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.

  41. WOW this is just SUPER :-)

  42. eventhorizon says:

    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

  43. eventhorizon says:

    BTW are there versions of this for other chips?..:D

  44. Ken says:

    There’s a lot of interest in gadgets that plug into the audio jack of the iPhone or Android.

    Perhaps program an Arduino from your smart phone?

  45. eventhorizon says:

    I would love to have this on an atmega8.

  46. chris says:

    I found a major issue: some soundcards have an inverted audio output. The initial bootloader will not work with this sound cards.
    I made a new version which solves this problem. You will find it here:
    http://www.hobby-roboter.de/forum/viewtopic.php?f=4&t=127

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 91,208 other followers