Linking Arduino to the Raspberry Pi

I own, thanks to a competition, a Dreamer Nano v4. This is a micro clone of an Arduino Leonardo.

Having tried to get the Arduino IDE running on Windows 7 64-bit and failed with the serial monitor part, I decided to switch my development effort to the Raspberry Pi. Even on X Windows, I’m not a great fan of the Arduino IDE. I find it tends to crash horribly when you upload and then use the serial monitor. So, I’ve decided to get the Arduino working over USB via the command line.

Here’s the steps I took. Remember, this is my experience. Your mileage may vary if you are not using a Leonardo, or if you have different things installed.

Python should already be installed on your Pi.

For using an Arduino over the command line, I use something called ‘ino’. Visit http://inotool.org to find out more. Suffice to say, ino makes it a lot easier to compile your code and transfer it to your Arduino.

ino requires you to install something called picocom. So:

apt-get install picocom

You will also need to make sure you have a couple of Python libraries installed:

apt-get install python-pip
easy-install configobj
easy-install jinja2

If the last one doesn’t work (the website that hosts it was down when I tried). So, I found this webpage: http://pypi.python.org/pypi/Jinja2 and then got and installed it manually:

wget http://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz#md5=1c49a8825c993bfdcf55bb36897d28a2
cd Jinja2-2-6
make
python setup.py install

Now install ino itself:

easy_install ino

Now that lot’s done, I can create a new sketch. It has to be a new sketch as the ino commands fail if the folder is not empty.

So… create a folder then initialise it using ino.

mkdir tester
cd tester
ino init

I added my sketch to the src folder.

Now, in order for me to build the uploadable file, I need to set up a new file called ino.ini. This lets you configure the board you’re coding for and the port it’s on. Into ino.ini, I added:

board-model = leonardo
serial-port = /dev/ttyACM0

Then, to build I typed:

ino build

The first time this is run, a few other files get built too, so don’t worry about that. Hopefully, it will happen without error like it did with me.

Then you transfer it to the Arduino:

ino upload

Next you want to monitor the serial line:

ino serial

 

6 comments for “Linking Arduino to the Raspberry Pi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.