Sunday, February 05, 2012

A flock of Arduinos

Oddly enough I'm not very impressed with the Arduino. I come from an embedded systems background and overall there's nothing on the board that stands out as special. It's just a simple board using an AVR. Also its software environment is just C/C++ and the shields are just stackable boards. All of these things we've seen time and time again. Yet this simple idea works. It works very well for it's intended audience, the artist, the tinkerer, and the beginner hobbyist. Obviously it has scratched the appropriate itch for it's intended community. The code itself consists of a setup and loop. Not really different from your simple standard embedded design. Yet the libraries are there, as is the community. So while I may not be impressed with the Arduino, I am impressed with what folks have done with it. Really anything that encourages a positive result is a good thing. We really are much closer to the 'Internet of things'. If we can get the cost and make networking much easier then we'll really be there.

Now, while I'm not impressed with the Arduino I still like the convenience. So I've invested in the Arduino, I intend to use them with the gHCS home automation system I'm working on. I now have 3 Uno (r3) boards, 2 Chipkit Uno32 boards, a Chipkit Max32 and a PIC32-Pinguino. The last 3 boards are PIC32 (MIPS) based. I'm also hoping to build a Arduino like board using the PIC32 (a lot of bang for the buck). I've noticed lots of other Arduino like boards available like the 32 bit ARM based Maple. Lets see how well all this goes. Making things easy for those whose expertise is not in the embedded systems area is not a bad thing. It does allow them to concentrate on the areas where they are experts (and usually the point of the work they are doing). And from everything I've seen it's quite usable. The only bad thing is that it makes embedded system work seem like it's a commodity service and it's not. While anyone can build embedded systems not everyone can do it right. The areas that the Arduinos fill are areas where engineers usually didn't tackle. Making art work interactive is no where near as complex as monitoring and control of industrial systems where safety is an issue.

Saturday, February 04, 2012

Linux, Arduino 1.0 and /dev/ttyACM0

I decided to start working with the Arduino under Linux. I'm writing code to make an Arduino work as an HCS II Comm-Link (part of my gHCS project). I need to add a RS485 chip and some circuitry but I can test the code with RS232.

I grabbed and load the Arduino IDE but quickly found that the Arduino Linux package doesn't have the avr-gcc & avr-g++ compiler environment. Those I needed to add separately. I'm using Debian, so I used aptitude and installed the avr compiler environment. The Arduino IDE is a usable IDE but it's not Emacs (oh no! Emacs! ;-) ). The good news is that the Arduino folks allow you to use an external editor. So I start up Emacs, load Arduino-mode and edit the ino file (I'm running Arduino 1.0). To compile, I save my changes in Emacs then switch over to the Arduino IDE and verfiy. One problem I have run into is that the Arduino IDE doesn't like to be put into the background (it will hang). I'm not sure why this is. Also the Emacs Arduino-mode has a problem with quotes (^G will get it unstuck). I'll work on that later. Uploading the code to the Arduino had me stuck for a while. When I plugged in the Uno R3 the USB device installed as /dev/ttyACM0 but the rxtx Java library, that the Arduino IDE uses, didn't recognize /dev/ttyACM0. So I added the following 2 lines:

 # Sample gnu.io.rxtx.properties
gnu.io.rxtx.SerialPorts=/dev/ttyS0:/dev/ttyS1:/dev/ttyACM0

to the gnu.io.rxtx.properties file (${JAVA_HOME}/jre/lib/ext/gnu.io.rxtx.properties). Now I can code, verify and upload all day long. I hope this helps others who may have gotten stuck or suffered TMI when searching with "fill in your favorite search engine here".