In an effort to bridge the communication gap between my Arduino and my computer, I decided to play around with Firmata v2. I wanted to at least start understanding how to receive serial data on a computer. This will eventually help with the goal of creating a LabVIEW Arduino driver.
So, I did some reading, searched the google, and searched the Arduino site/bb. Read pretty much “all” the documented information on sending serial information from the Arduino to a computer. I concluded that using Firmata was my best bet, mainly because it was slightly more documented, proclaimed to be the fastest (115200 bitrate) and because I didn’t want to start from the ground up.
The initial step was to play around with the Firmata examples; they are included with the Arduino software for our convenience. I looked at them, loaded some of them to my Arduino, only to f
ind out that… they didn’t really explain much. Additionally, one of the only tutorials on the subject I found, addressed linking Arduino con Firmata to Processing, I went over this tutorial, but it was very “cookbook” and didn’t explain much in terms of what was going on, especially if you wanted to abstract it, and do some developing with the system on your own.
I decided to write a piece of software which would read data from the serial port, and use Firmata’s code-set, which happens to be MIDI based, to decipher the incoming data.
The result is this crude ruby script. (I just picked up learning ruby, so please ignore the horrible syntax, and roundabout procedures)
Download: firmataAnalogMonitor.rb

I used nCurses to create a simple terminal display; it shows the appropriate 0 to 1023 analogRead from the Arduino, the next column showing the value in millivolts. In order for this to work, you need the nCurses library and the serial library for ruby. The script assumes the Arduino is running the simpleAnalogFirmata, a sketch example bundled with the Arduino software.
Note: If an analog pin is not grounded or being fed any current it floats quite a bit.