Storing sketches in the cloud

There’s a fine line between solving problems that don’t exist and solving problems that no one recognizes until a solution is found. The former shows up with housewares peddled on late-night infomercials, while the latter is summed up by [Henry Ford], “If I asked people what they wanted, they would have said faster horses.” [Dave]’s method of storing microcontroller code in the cloud definitely falls into the ‘useful’ category.

[Dave] first realized the problem when he was digging around the IDEO Toy Lab and came across an orphan project, a Barbie credit card swiper. [Dave] had no idea if the firmware for this project was saved on the server, or even if the current version was available. One solution to this problem could be burning a copy of the source onto the Flash or EEPROM on the board.

There’s a problem with this idea, though: storing the source in an Arduino’s memory takes space. Thinking laterally, [Dave] realized that editing source happens on a computer, computers are connected to the Internet, so why not keep the source “in the cloud?”

[Dave]’s solution is to host the source on GitHub, and tie every piece of code to a board’s unique USB serial number. This gives every Arduno a unique ID, allows for version control, and libraries of multiple files.

This very clever addition to the Arduino IDE is up on GitHub, ready to be added to any Arduino installation. Why the Arduino IDE doesn’t already have this feature is beyond us, but that’s what you get when you want a faster horse.

Comments

  1. Dax says:

    But what happens when the USB serial numbers are not unique? When someone re-uses someone else’s ID because they don’t want to pay $$$ to get their own.

    • chango says:

      This is specifically for Arduino. Arduino USB-serial converters (ATMEGA8U or FTDI) have a unique serial number programmed at the factory. He mentions that boards without built-in USB won’t work with the immediate scheme. Perhaps a bootloader that presents the AVR fuses would help here.

      This is very clever, especially tying old prototypes to legacy revisions of code. I think this might be best for “hard” prototypes: custom PCBs, no breadboards, etc. Arduinos are prone to being raided for future projects.

  2. Daid says:

    To bad the Arduino GUI is totally useless for anything serious. As support for multiple files (aka projects) is totally half assed.

  3. Johnshaft says:

    Dropbox?

    • Dale says:

      Yeah, this has been my solution up to now as well, and it works fine, though this is a really cool alternative solution!

      The real fascinating part for me right now, though, is this USB identifier thing. Up until now, if I needed to distinguish between multiple units because, say, I wanted a network of arduinos checking in to a server, I needed to hard code different identifiers into each one, but this could automate that process! (I’m easily amused. 😉

  4. HAD says:

    Ford gave people faster horseless carriages though.

    • Dax says:

      The quote is a bit ambiguous because most people don’t understand the situation.

      When Ford made his car, there were no roads for cars yet. It’s easy to see how one would dismiss the idea, because an automotive carriage would just get stuck in the mud.

      Which they did.

  5. Dave says:

    I currently use Dropbox to house my sketches, but tracking code gets confusing with multiple simultaneous Arduino projects. I’ve resorted to imprinting a tattoo on each Arduino so as to not get mixed up (Sharpies work great) – but this looks like a nice alternative. Gotta check it out – thanks!

  6. Kevin Keith says:

    Are we talking about revision control? Because that’s been in use, for, I dunno. . .like 30+ years? There’s no need to use needless jargon. I use a mercurial repo for source code, LaTeX documents, and what have you. Obviously, my reasoning is to keep track of what I have. If that’s his, then it’s reasonable, but hardly anything new. Conversely, if he’s using GitHub (I refuse to use the word “cloud,” it’s meaningless and highly misleading) for space, then that’s slightly idiotic. It’s not like we’re talking hundreds of megabytes or anything. Also, “program,” “source code,” or just “code” all work fine, no need to use a word like “sketch” which is useless outside of Arduino-land.

    • Dave Oei says:

      I think you’re missing the point. While yes, part of the point of this post is about revision control, it’s mostly about the ease of integrating such control within the Arduino IDE. It’s a step in the right direction. Also, it’s hard to know if you’re being serious about picking on nomenclature – I think we all understand the salient messages of the post.

      • Kevin Keith says:

        What point am I not “getting?” The nomenclature is integral to my point: this is nothing new, regardless of what words you use. I use Emacs to edit source, and all I have to input one command to commit whatever I’m working on to my repository. IDEs have existed forever. Repos have existed forever. IDEs with revision control integration have existed forever as well. What exactly am I missing?

        • Dave Oei says:

          If I’m coming off as argumentative, I apologize in advance. What I’m hearing you say is, “this” is nothing new. On a technical level, you’re absolutely correct. Revision control exists in nearly unlimited forms across all programming languages, independent of OS, machine, etc… Revision control has been around since the dawn of computing. It’s not new. The author is not claiming it’s new.

          What is new (relatively, at least) is the Arduino. Along with it, is its relatively new IDE. This IDE is currently lacking in revision control. A smart dude came up with a solution that integrates revision control with this IDE, and to top it off, saves to Git.

          Why is this significant? Because the IDE is probably the first IDE for many Arduino purchasers. Many Arduino purchasers are probably first time programmers and have never even heard of or know what revision control is. This tool puts revision control in their laps, it makes it easy, all within the envelope of what “Ardiuno” is all about.

    • Paul says:

      I believe the point you’re missing is an easy and automatic way to find the source code for a particular board.

      Sure, source control systems exist. So do lots of other ways of storing data. But that’s not the point.

      The point is many years later you pick up a project made with an Arduino. It works great, but you want to modify it. Maybe you’re the author, but the project was done quickly many years ago. Maybe you don’t remember the filename or repository name? Maybe someone else made the project and they don’t remember the filename. Or their they’re since gone through 2 computer upgrades and didn’t save the files from that old machine. Or maybe the files were on a latop that was stolen or broken? Afterall, it was just a quick one-off project, so extensive backup of the source isn’t a big deal.

      The point is an easy way to find the original source code.

      Perhaps you have a perfect memory for what the old filename was, or repository name was (and you always go to the trouble to create a repo for such a single one-off project). If you are perfect like that, able to save all files forever, and remember every single quick one-off project you’ve ever done, then this doesn’t help you much.

      But many people don’t keep old files around. Even those who do might work on an old project written by someone who didn’t, or can’t remember the filename.

      That’s the point.

      • Kevin Keith says:

        It’s not about having perfect memory. I for one, do not name my source files (or any, for that matter) with non-descriptive names. No, I don’t create a repo for every single project I do. However, say, for example I wrote some code to blink an LED to use a classic example. In such a circumstance, all I have to do is either give it a useful name like blink-led.source and put it in a miscellaneous directory. Or, if I were so incline, I could simply have a dedicated project for all various and sundry things of that kind in mercurial. I guess, maybe it’s a matter of taste, but I do not see the point of IDEs at all. Yes, editors like vi, Emacs, or whatever you like have a learning curve, but at the end of the day a textfile is a textfile. I’m not of the mindset that believes using a purposedly gimpy and lobotomized dev environment is good for beginners. It only enforces bad habits.

      • Dave Oei says:

        It amazes me that you’re investing so much time and effort disparaging and belittling an environment that you don’t use or find value in. Have a nice day!

      • Leon says:

        I understand that the Arduino is designed to be easy to program and easy to build around, but it is impossible to defend it’s design from a practicality standpoint.

        When much of the current user-base grows up, they’ll realize they should have learned standard lib C/C++ and AVR assembly all along and they’ll end up using Git at work (or at least learn to name things properly).

        It’s hard to say whether or not Arduino aims to be a stepping-stone platform, or a crutch. With features like this popping up from the community, there’s at least some dissonance going on between product vision and real-world use.

        Just my two cents.

        • Dave Oei says:

          I don’t think anybody is advocating for the Arduino from a practicality standpoint, at least, not in this post. It’s not meant to be practical. It’s meant to be educational first and foremost. The fact that many have found practical applications for the product speaks volumes of its price point, openness, support, and ease of use. Plus, it’s odd to hear a lot of negativity on a post that particularly improves the interface in a direction toward what most programmers expect.

  7. Burnerjack says:

    A bit off topic, BUT… How secure and/or virus/malware free IS the cloud? If the Web infrastructure owner/operators can’t keep it clean, how does one rest assured their stuff is OK, as in not infected or info stolen? This is a fundimental question I hope one of you can answer.

  8. Ching Captain says:

    Markus, wonderful tutorial. Thanks for making it so clear.

Speak Your Mind

*

Related Hacks in arduino hacks

  • Garden sensors measure soil moisture and greenhouse temperature
  • More pins and more power with a DIY Sanguino
  • A much easier take on an Android garage door opener
  • UnoJoy makes your Arduino play well with Xbox 360 or PS3
  • RC car controller and receiver replacement