post

RasPiO® Duino and GertDuino

The combination of Arduino, such as the Uno with the ATmel ATmega 328P, and the Raspberry Pi is a natural one. The RPi is an allround computer with I/O facilities and a general purpose, though not real-time, operating system. The Arduino is a programmable microcomputer with also lots of I/O including lots of digital I/O, analog inputs and PWM outputs, made for running a dedicated program with precise real-time performance. Where bitbanging I/O on the RPi is not such a good idea, on the Arduino on the contrary it is common.  Exchange data via the serial ports to let both  platforms enhance each other and work together.

I have two boards that add an Arduino experience to the Raspberry Pi: the RasPiO® Duino and the GertDuino. Both function well. The RasPiO® Duino is a simpler, better supported, better designed and cheaper solution, though you have to solder it yourself. The GertDuino is ready to run, more powerful, since it has two ATmega IC’s (a replaceable 328 in DIP and a 48) but a bit rough on details.

I prefer the RasPiO® Duino. £14 including postage worldwide..  Much better supported and designed, runs on all RPi models and on jessie. The GertDuino, €30,  is a nice, build, and powerful board, Arduino compatible, two ATmega’s, with RTC and IRda, but takes away more of the RPi GPIO like I2C, and is a bit rough to work with and with much less support, the Reset issue, the board space wasted for a non-functional and not present powersupply, and seems to have problems on RPi model 2 and on jessie.

IMG_4536

RasPiO® Duino

The RasPiO® Duino is an Arduino compatible microcontroller board, designed to plug on top of a Raspberry Pi. The RasPiO® Duino is powered by a ATmega328 microcontroller, and can be programmed with the regular Arduino software running on the Raspberry Pi.  The RasPiO® Duino can communicate with the Raspberry Pi via the serial port. Programming is done over GPIO pins. The ATmega 328 is powered  at 3.3V on 12 MHz, a bit slower than the Arduino UNO at 16 MHz at 5V. So Arduino addons are not always compatible, since most are 5V!

Once programmed, it can be removed from the Pi and used on its own. Or it can also be used interactively with the Pi. The Pi’s GPIO ports are also broken out on the board as well. There’s a 72 point prototyping area, with GND, 3.3V and 5V rails, where you can add your own components.

I got two of those  RasPiO® Duino’s via the Kickstarter Alex Eames of RasPi.tv has run. The product is now also available at RasPi.tv.
The RasPiO® Duino is not an Arduino clone. Shields are not compatible, and no bootloader is required. The Arduino IDE runs on the desktop of the RPi, with the aid of Gordon Henderson’s Programmer  over Raspberry Pi GPIO) and device Gertboard with ATMega 328 (GPIO). Alex has written an excellent Starters guide and published videos about the hardware and software installation and first experiments.

Hardware installation of the RasPiO® Duino

The RasPiO® Duino comes as a kit. Not a difficult one to build, all trough-hole components, just follow the video Alex has made, take your time and check and check and success is guaranteed. The video method takes about an hour. 
IMG_4556
IMG_4557

Software installation for the RasPiO® Duino

Based on the excellent work of Gordon Henderson, see his project website. 

If you are like me and use a SSH session with PuTTY you like the commands compact together on a webpage so that you can copy and paste, rightclick in the PuTTY window. To aid me and you I repeat verbatim the commands here as I have done on a Raspberry Pi Model 2 B.

Install Raspbian (wheezy!)

sudo apt-get update 
sudo apt-get upgrade 
sudo apt-get install Arduino 

Install a modified avrdude (to program via RPi gpios, the SPI port of the RPi is used for this)

cd /tmp
wget http://project-downloads.drogon.net/gertboard/avrdude_5.10-4_armhf.deb
sudo dpkg -i avrdude_5.10-4_armhf.deb
sudo chmod 4755 /usr/bin/avrdude

And now we need to download and run a setup script.

cd /tmp 
wget http://project-downloads.drogon.net/gertboard/setup.sh
chmod +x setup.sh 
sudo ./setup.sh

Note that this setup.sh script copies some files (and leaves backups) and also make the serial interface of the RPi , standard owned by the system,  available. Communication between Arduino and host (here the RPi) is usually done via the serial port, so install the jumpers on the RasPiO® Duino RX TX locations. Run e.g. Minicom on the RPi and use serial.print commands in your Arduino program.

Reboot

sudo reboot

After reboot you need to set the fuses on the 328:

avrsetup

Choose 1 for ATmega328 and hopefully it will tell you all is fine. Note that for  a fresh 328 you will have to repeat the avrsetup!

You can start now the Arduino IDE in the desktop. Ofcourse the Blink example is the first one to try! Runs fine!

IMG_4542 board

GertDuino

The Gertduino is a Raspberry-Pi add-on and features an Atmega328 microcontroller, runs of 5V, has the 16MHz oscillator and has connectors which are Arduino-Uno compatible. It also contains the reset switch, 2 user push buttons, and 6 LEDs. The Gerduino board also has a RS232 level converter which will convert the signals from an UART to the RS232 standard voltages.
gertduino_functionsNote the red part is mising parts, as the design was faulted and could potentially damage the Raspberry Pi.

IMG_4549
The Gertduino board also features an Atmega48 MCU, which is intended to be used as Real Time Clock (RTC) and/or as IRDA front end. However it is also freely programmable by the user and thus can be used for any other application, giving the user the power of not one but TWO Atmega devices to play with. The I2C interface of the Atmega-48 is connected permanently to the Raspberry-Pi I2C interface. The BCM2835 does not have a native IRDA interface. The protocol can be implemented using a standard GPIO pin but that puts a very heavy burden on the CPU. To support IRDA the Atmega-48 has a TSSOP4038 IRD device connected to pin D3. This device supports the most common IRDA protocol: 38KHz IR signal.

All connections between the board and the Raspberry-Pi are protected against 5V signals. The Atmega328 and the Atemega-48 have exactly the same pins with the same functionality. The devices only differ in the size of their various memories.

The board is ready to run, just plug it on the Raspberry Pi. But strangely the jumpers you really need are missing from the package! You need really 4 of those to do any programming! Now I have a junkbox supply full with those little jumpers, but it illustrates the roughness in the design of the Gertboard.

IMG_4546 IMG_4553

Software installation

I read some remarks about compatibility problems between the Gertboard and the Raspberry Pi Model 2 B, so I used a B+. Just follow the instructions on Gordon Henderson’s Drogon site. A bit more manual work (and showing the internals of the setup.sh script of the RasPiO® Duino!).

I cheated and just used the software installed for the  RasPiO® Duino. So I did not perform the ./avrsetup command. AndBlink compiled and downloaded and  ran fine except for a small issue, the ATmega328 runs out of the box on the internal 8 MHz clock. In the User manual 8. 1 I found the command to have it run on the external 16 MHz and Blink just happely blinks at the expected speed now. I wil have to perform the GertDuino installation to get access to the ATmega48 ofcourse!

Programming with the Arduino IDE on the Raspberry is a bit slow. Even more on the B+. Do not forget to remove the Reset jumper, or else downloading works fine but the ATmega 328 is kept in reset state.

IMG_4554