Where I last left off, Major Tom and I had just encountered some Schmitt trigger hex inverter input pins floating in a most peculiar way.  I'm pretty sure that I've got that part sorted, and now I'm off to try out some bigger and better things.


Now, I have to admit that I enjoy loading programs into the Arduino IDE on the Pi and then compiling and uploading them to and running them on the Gertduino as much as any other microcontroller enthusiast, but after all that's not the main reason why I got the Gertduino or why I'm using the Pi in the first place.


My ultimate goal is to put the Pi to work as the heart of my all-sky camera. Related to that, I expect to use the Gertduino as a front-end co-processor to handle the messy business of choreographing sensor readings from many and varied analog and digital sources, which in turn requires that the Pi and the Gertduino talk to each other as BFFs.


There are lots of possible approaches to performing that communication. For example, SPI or I2C via the GPIO, anyone? But the most convenient way to accomplish the task would seem to be handling the conversation via the Pi's lowly-but-time-tested serial port.


The Gertduino seems to be well-suited to the task. Communicating via a serial port is not merely a cameo role for the board, hidden away in some lonely and half-forgotten appendix of the manual. Instead, there it is, right up front and personal in chapter 2 of the manual as it goes into the myriad ways that you can hook up the board to do serial communication.


Step right up, folks, get your serial communication here, with or without RS232 conversion. There's a bewildering array of jumper settings if you're not prepared for it:


Atmega-328 & Pi UART:

  • Pi to RS232 buffers
  • Atmega-328 to RS232 buffers
  • Pi to Atmega-328


Atmega-48 UART:

  • Atmega-48 to RS232 buffers
  • Atmega-48 to Atmega-328
  • Atmega-48 to Pi


For my application, connecting directly between the Pi and ATmega328P is the obvious way to go, with no RS232 involved, thank you very much. But that part just represents the bare minimum hardware configuration step. Nothing really interesting happens until you add some software to the mix.


So, what software should I be mixing it up with?


In the spirit of learning to walk before trying to run, I'm going to try a phased approach to getting the two boards talking. First, I'll make sure that the hardware is doing its job by using some simple sample software on the Gertduino to communicate with a terminal emulator on the Pi. Whoa, try saying "some simple sample software" three times, quickly. OK, got it. Next, try some elementary program-to-program communication with an Arduino sketch running on the Gertduino that talks with a friendly sample Python script running on the Pi. Then ratchet things up a notch or two by testing a generic board-to-board communication protocol that should be capable of doing the heavy lifting between my Gertduino-attached sensors and my all-sky camera application.


The sample Gertduino software package that I downloaded from http://www.element14.com/community/docs/DOC-64547/l/gertduino-software-download-tar-file contains two Arduino programs in the arduino_sketchbook directory, Serial_startup.ino and Motor_demo.ino, that each demonstrate simple ways of using the serial port (from the Arduino side of things, that is - there is no bespoke software for the Pi to handle that side of the conversation, rather those programs will speak to a simple terminal emulator program running on the Pi, such as Minicom). 


But harnessing the serial port of the Raspberry Pi is not all peaches and cream. The Pi has its own selfish and stubborn ideas of how it's going to use the port. It's necessary to squelch all of that potentially confounding traffic before you can dedicate the serial port to the Gertduino.


There are a number of sites that will tell you how to do that. I'm quickly becoming a friend of the unicorns at http://friendsoftheunicorn.net/content/raspberry-pi-gertduino-serial because they seem to have anticipated many of my needs before I even realized that I needed them. And, not unexpectedly, the Raspberry Pi Spy, one of my other primo go-to sites for all things Pi, has a well-thought-out post on freeing your Pi's serial port at http://www.raspberrypi-spy.co.uk/2013/12/free-your-raspberry-pi-serial-port/ . Also, don't miss http://elinux.org/RPi_Serial_Connection for some timely and useful info.


Those pages should get me at least part of the way to my eventual goal. Once I am able to share commands and data with the Gertduino over the serial port, I'm going to want to build some custom software to control and monitor my sensors, and I'm thinking that Firmata may play a role in that (http://firmata.org/wiki/Main_Page). But first, Roo Roo. Um, I mean, but first, get the two boards to the point where they can freely talk to each other via the port, and then the rest will follow as surely as May flowers after the April rain that's currently pummeling my roof.


So, bear with me as I learn to walk. With any luck, I'll be running my first 5K (with scissors) soon enough.