Flashing Arduino’s and AVR’s over the Network

PI + Pogo + LSCommander

Can flash over the network for Raspberry Pi’s, Pogoplugs, and normal Linux machines.

Ever since I read this post, I wanted to see if I could reliably flash Arduino’s over my network.  I’m pleased to announce that I can, and my plan is to share the juicy details so that you too can enjoy being able to reprogram your projects from the comfort of your main machine.

RFC2217 is a standard that lets you read and write to a serial port, over your local network.  It not only sends data, but it lets the remote client send RTS and DTS signals, which allow you to reset the remote AVR.  The general standard gives us some nice flexibility, letting the remote client control the serial port as if it was right there.

Why would you want to do that?  Well, I can do my main programming on my main machine at my comfortable desk, while having my AVR microprocessor in the hot garage next to the Raspberry Pi/Pogoplug, connected to the network.  Developing on a Pi or Pogo is slow, so if I can leverage my powerful system to do the development on, and delegate the Pi to just the flashing part, then it reduces one more barrier to having network capable, field re-programmable devices everywhere.

A big advantage for me is that now I can completely contain my development environment into a virtual machine, which can be backed up, moved to a different machine, or saved/resumed.  If there are enough requests, I can see if I can upload the machine somewhere for easy download.

The RFC2217 standard would allow for some pretty interesting things.  I could have an Linux Serial Commander connected to one computer, that controls the Raspberry Pi + monitor in the other room. With SSH tunneling, I think I could flash firmware over the internet (I will test this soon), so that all you would need is a Linux system on the wifi, to be able to reprogram any networked RFC2217 AVR within that network.  Another idea is if you need to reprogram your AVR based sprinklers, instead of bringing it inside, you just bring a Raspberry Pi + USB wifi adapter + batteries + serial cable to the unit.  Push a button, and the firmware is flashed from your remote computer.  Pretty awesome.

I’ve uploaded this updated LScreamer to bitbucket this time, a link to it should be in the side bar.  Feel free to ask any questions about getting started with LScreamer.


Newest Project: Linux Serial Commander

LSCommander on left, Raspberry Pi on right

LSCommander on left, Raspberry Pi on right

Recently I was playing around with the Raspberry Pi and thought of how useful it would be to pair an 16×2 character LCD + buttons with it so that I could control it on the go.  After a few hours of brainstorming, I came up with the Linux Serial Commander, which is an Arduino + LCD + buttons, paired with a Linux system running a python server that I wrote.

Here’s a short video of it in action (recorded using guvcview in Linux):

Linux Serial Commander operation from Dustin Robotics on Vimeo.

Continue reading

Using the Raspberry Pi as My Development Machine

300px-RaspberryPiAs many of my readers know, the Raspberry Pi is a $35 dollar ARM computer with 2 USB ports, and ethernet port, HDMI, and some GPIO pins.  My current plan is to use the Raspberry Pi as my main development machine, flashing all of my ATMEGA328 chips from it.  This will allow me to not only program anywhere, but should my computer crash, my development environment will be perfectly safe (provided that I keep it backed up).  This 700 MHz computer is pretty dinky, when I first ran the GUI several months ago, all I saw was how unreliable it was and that it would be impossible to get anything done on it.

Since then I purchased a high speed SD card from a quality manufacturer, and the performance is better.  I also learned that you can divide the memory between the GPU and the general purpose memory.  For my case, I decided to skip the monitor and keyboard, and SSH into it using KiTTY (an updated PuTTY client). I’m also using Xming to serve as a X11 Server on my windows system, so that I can do X11 forwarding of the Arduino IDE if needed.  I hope to use the command line version, arduino-mk, but currently it doesn’t work as well as the Arduino IDE does.

I also discovered that many of my existing programs no longer work on the latest Arduino IDE v 1.0.1, because the avr-gcc team changed some things around.  Luckily I have a backup of my old development environment, as well as a working VM with it on it, but my current plan is to update my existing code as needed, to work with the new versions, since they are the future.

Here’s a brief rundown of what I needed to setup on the Raspberry Pi to get it to work:

  1. Install the latest Rasbian onto your SD card following these instructions. I followed the Easy Way.
  2. I then connected the Raspberry Pi, SD, Ethernet, and power (from a reliable charger, I’m using a HP Touchpad USB charger).  You’ll need to find the IP of the raspberry pi by checking your router for newly connected devices.  Use KiTTY to SSH into it (using the IP and port 22).  Username / password is pi / raspberry.
  3. Go ahead and update things (sudo apt-get update, sudo apt-get upgrade).  I install vim, tmux, arduino and python-serial as well. I also copy a folder I made a while ago that has all of my vim, screen, and tmux settings.
  4. To get my usb-serial devices working, I need to update to the latest raspberry pi kernel.  To do this, we need to install rpi-update. With that installed, update the kernel.  As of this writing, the latest kernel is “Linux raspberrypi 3.6.11+ #414 PREEMPT”,
  5. Now you should be able to use LScreamer or Arduino to flash your projects!

What’s great about this setup, is that I can SSH into the raspberry pi from anywhere (provided I have opened up the right ports in my router).  Yesterday at my brother’s house I was connected to my Raspberry Pi on my workbench, trying to get an Arduino program to compile. As I work on my latest project, I may implement some improvements to this Raspberry Pi setup, possibly automatically controlling my Oscilloscope and my power supply.

I find taking little steps to big goals gives you small accomplishments that build up, giving you that much more motivation to finish.