Figure photos, moe dump, and more.

The Pi Rover

Raspberry Pi as a completely wireless embedded development platform

It is finally complete: the RPi development computer!

You see any wire?

You see any wire?

Pictured is me powering the RPi from the breadboard. You can do it the other way around, too: connect a USB battery pack to the RPi, then power the Arduino from the RPi; just mind the current limit on the 5V rail of the Pi.

Turned out it was not that complicated. I used archlinuxarm (just because I’m already using Arch for my other computers), installed avr-gcc, avr-binutils, avr-libc, avrdude, Connect the Pi to the Arduino: RX to TX, TX to RX, 5V to 5V rail, GND, and a GPIO to RST (here I used GPIO 18). The camera is there because I’m too lazy to take it out. The RST pin makes it so that I don’t have to press the reset button everytime I program the board, which is another plus vs using a computer – nothing is as satisfying as typing “make load” and have the board be programmed automatically.

Now I can use any computer to program the Arduino, without having to install anything sans an SSH client, which should be installed by default on a Mac or Linux machine, and can be brought along on a USB stick with PuTTY for Windows machines. No need for any special permission on the computer either, and no more messy wires.

One more advantage is that the RPi has UART, as opposed to RS232 (or none), like on modern PCs. That makes communicating with something that doesn’t have a built-in FTDI chip, like an Arduino Pro Mini, or straight ATmega chips, much simpler.

What this means is that I can now build self-hosting robots like this, where the Pi controls and programs an Arduino, reads analog sensors’ input and issue commands to the Arduino via UART, and use the more powerful ARM chip to do things like processing images from the camera or hosting a webserver for me to control the robot from a browser.

The Pi Rover

The Pi Rover

I could compile and use the Arduino libraries, but since the ProMini 328P 8MHz lib has issues with UART (which I discovered after trying anyway…), I just straight up used ATMega programming. It’s really not that much harder, since Atmel provided rather detailed examples in their datasheets. Plus, the AVR Dragon worked fine out of the box.

Pictured: a dragon eating a pie.

Pictured: a dragon eating a pie.

Getting the full Arduino environment and libraries to work takes a bit more work, involving copying the header files over, the .a from /tmp/, and writing a Makefile to hook everything up.

sudo bash -c '[[ -e /sys/class/gpio/gpio$(ATRESET) ]] || echo $(ATRESET) > /sys/class/gpio/export'
sudo bash -c 'echo out > /sys/class/gpio/gpio$(ATRESET)/direction'
sudo bash -c 'echo 1 > /sys/class/gpio/gpio$(ATRESET)/value'
avrdude -p m328p -c arduino -P /dev/ttyAMA0 -b 57600 -F -U flash:w:$^
sudo bash -c 'echo in > /sys/class/gpio/gpio$(ATRESET)/direction'
sudo bash -c 'echo $(ATRESET) > /sys/class/gpio/unexport'

At this point, figuring out how to use other platforms should be straightforward: the Pi is just a normal computer that you can use, so for a normal ATmega, you can program it using the AVR Dragon connected to USB

computernerdraspberry piwireless

Dory • October 16, 2014

Previous Post

Next Post

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>