Command line control of arduino using ino

As we’re going to be programming the arduino via the raspberry pi over ssh, we need a command line tool to talk to the arduino. Luckilly several such ways exist, including make-files from several sources. I chose to use a tool called ino which seems to have packaged up the toolchain in a fairly decent way.

I’ve just used this to connect to the pi in Todmorden and remotely upload a fresh copy of the firmware and reset the arduino! now it’s started talking mqtt again, and all from across the internet!

Installation was relatively straightforward – good guide here: http://www.recantha.co.uk/blog/?p=1103.

sudo aptitude update && sudo aptitude upgrade -y
sudo aptitude install arduino picocom python-pip
sudo easy_install configobj jinja2 ino

Then create a new directory for a sketch, enter it and initialise ino:
mkdir AquaSensors
cd AquaSensors
ino init

Then the source files can be copied across into the src directory, external libraries into the lib directory (still inside a directory for each library tho!) – then compile with:
ino build

If we want to copy a hex file rather than compile it locally, then it should be renamed as .build/boardname/firmware.hex so in our case .build/mega2560/firmware.hex

Either way, to take the hex file and to upload it:
ino upload
from within the sketch directory.

To set sketch based or global defaults for ino, such as serial port & speed or board type, you can create an ini file.

This can be put either in the sketch folder as ino.ini, or as /etc/ino.ini or as ~/.inorc. The latter option gives a default for the user, the /etc/ino.ini one is global across the system (all can be overridden by command line options at invocation.)

Our file is global across all users so the following was saved to /etc/ino.ini:

board-model = mega2560

Leave a Comment

Your email address will not be published.

+ 36 = 44