Flash an Arduino from an SD card

[Kevin] has been working on reverse engineering the protocol used by the Arduino IDE and porting it to the Arduino platform. Now that his BootDrive project is nearing completion, he’s ready to give every Arduino the ability to program another Arduino over an SD card.

BootDrive isn’t terribly different from using an Arduino as an ISP, only now AVRdude runs on the Arduino itself and no computer is required to put new firmware into the target Arduino.  [Kevin] attached a MicroSD breakout board to an Arduino-compatible clone. When the clone starts up, it searches the SD card for a file called ‘program.hex.’ This file is sent over to the target Arduino and the new firmware is installed.

While it may not be extremely practical if you’ve only got a few Arduinos that never leave your workbench, we’re thinking this would be an invaluable tool if you need to update the software on a board already ‘in the field,’ serving as a weather station or homemade game camera. [Kevin] put up a demo of his BootDrive project; you can check that out after the break.

Comments

  1. Daid says:

    FYI: The Arduino is using the stk500v1 protocol, except for the ArduinoMega2560 which uses the stk500v2 protocol. And every Arduino type uses a different baudrate. No reverse engineering needed, these protocols have descriptions available.

    • john says:

      I came here to say the same thing, though reverse engineering does sound cooler! :)

    • ScottInNH says:

      Yeah if you saw this on the Adafruit show and tell this weekend, Kevin goes out of his way to say it’s NOT reverse engineering… he’s just making a custom application out of a process that isn’t well understood by most users.

      I think this is pretty cool… you could sell kits and shields from a vending machine, and people could plug in their duino and get the right code downloaded… and everything just “works” in the field.

      For people who want something different than this, there ARE Arduino boards which can be remotely upgraded via Ethernet (so only one ‘duino is needed).

  2. Gragg says:

    This could be really cool if a bootloader was available that could load programs directly from the sd card on a single arduino. If you put some kind of interface on it like an lcd, you could have the user pick from a bunch of available programs and load it on demand. You could effectively increase the program memory indefinitely. Problem is it would be a huge bootloader and leave a bit less room for the actual program.

  3. This is great but I was really hoping for a new arduino boot loader that can read from SD. If someone could strip an SD library down to its very basics (no directories). I would love the ability to just take an SD out and pop it in. But maybe now that the uno is switching to the 16U2 it might be possible.

    • WestfW says:

      It’s been under discussion, somewhat. The minimal SD/FAT16 support seems to be about 1.4k of code, which is “somewhat promising” given that the initial Arduino bootloader was 2k total, and the current optiboot is 0.5k.

  4. Cliff Miller says:

    Doesn’t this sound dangerous – A microcomputer programming itself? How long before the target Arduino begins having comments on what is being programmed into it? How many have to be connected together to become self-aware?

  5. kyoutohru says:

    Sounds cool!

  6. timbo says:

    I love full-circle hacks like this, nice work :)

  7. NewCommentor1283 says:

    you know how many people have been waiting 15 years for this sort of simple add-on in the christmas-lights-sequencing messageboards and fourms???

    they all know PIC and AVR but NONE of them has any clue about how to change “the pattern” when out in the feild! well i mean they know how to add more patterens and make a button to change them but they do not know how to ADD a NEW pattern in the feild without bringing inside and hooking it up to a programmer.

    in this case; FIELD MAEANS FIELD !!!
    thats the key here!

    EVERY LAST FREAKING ONE OF THEM WILL WORSHIP YOU IF U JUST SIGN UP AND TELL EM ALL !!!

    EDIT: the ones that dont have a laptop permenently connected to a network of light-control-boxes…

    most only want simple self-contained system they dont have to waste GAS MONEY to DRIVE AROUND just to drop a freaking 2kb file!

    but with this they got 100000 2kb files at their disposal, screw that, they got 64kb files! AND they can show EACH file to the PAYING customer while ONSITE! imagine that!
    like a pro serviceman!

    • NewCommentor1283 says:

      PS: as it stands, the existing pro’s in this field all carry around a laptop and envy EVERY other serviceman, what, whith thier custom “software-update” boxes.

      picture this:
      “update me”
      “okay, i need my laptop cord”
      “okay”
      “wait, windows wants a restart”
      “ugh, i should have hired someone else”
      “…”

      NOW picture this:
      “update me”
      “okay, just a second”
      “how long will… OH WOW! cool effect!!!”
      “hehehe. yeh it does look much better with new code!…”
      “…or try this one,,,”
      “SWEET! i want this one instead!”
      “that’ll be $21.97″
      “OKAY!”

  8. ejonesss says:

    finally i may be able to get into the world of programmable logic controllers.

    in the past you had to use a special programmer and programmable chip and a pc.

    looking at this mac users can get into the world of programmable logic controllers because the data can be saved to an sd card (most macs can read and write to older pc formatted media) and the media can do the programming

    • ScottInNH says:

      Just note that this setup will only load software onto an Arduino platform, not a traditional PLC.

      With some knowledge and patience it MAY be possible to adapt this to flash/load other platforms. That task would be difficult if the target device needs real programming/flashing of the chip. Same task is easier if the target device accepts code over serial (which really isn’t flashing per se, just I/O).

  9. signal7 says:

    Really nice project. I’m wondering how long it will be before there’s an android app for remotely programming arduinos….

  10. PhD says:

    Gee, this work seems absolutely fantastic. I’ll give it a try with no delay, using a NANO as flasher and a Mega2560 as target…. !!!
    I’ll keep you posted. But thanks for this….

    • PhD says:

      Hmmm, as there is a protocol change for 2560, I used a 1280 as master and a 1280 as target… Card is read OK, but I only get bunch of errors and nothing else… So I suspect 1280 (MEGA) may also use a v2 protocol…?? Any hint???

    • PhD says:

      Stange enough, tests between two Arduino MEGAs with 1280 MCU do work with the “blink” code (about 4k). But the same configuration with larger hex (like ASCIIDump) fails without explanation…

  11. PhD says:

    Hi. No more activity on this… Anyone has been more successful than me on “larger-than-blink” hex file?

  12. CpE2012 says:

    Hey guys, is this a way to install arduino on an SD card? If not an you somebody link me to a way? Thanks

  13. jitesh gupta says:

    The bootdrive code can be applied only to bootloaders which uses stk500 protocol.
    Mega 2560 uses stk500v2 protocol.
    Is there any possible way to use this on mega2560….??

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 96,386 other followers