Robot Eyes & A Pivot…

We took quite a break for the holidays – and other things distracting the team (like a certain member spending a lot of extra time at work).  But, we are back to it now…

In our last post, we demonstrated how we could automate vehicular control by programmatically closing switches on the remote control using a simple IO board extending the GPIO interface of the RPi.   Next, we want to give R2P2 “bat sight” by using an ultrasonic sensor.

The sensor we chose was the HC-SR04, which is a very inexpensive sensor that can be found on Amazon.com:

Image

 

However, after reading about others’ experiences, we took heed that the RPi could not be counted on to produce accurate results operating the sensor, because the Linux OS could preemptively interfere with our attempts to measure pings and responses inside the required 60 ms sampling window.  In order to eliminate this concern, we decided to trade in our piFace board for a Wyolum Alamode, which is essentially an Arduino (clone) that stacks onto the RPi GPIO interface:

Image

 

While the piFace provided a circuit buffer between the GPIO and the sensors and controls, the AlaMode awards isolation via a wholly separate IO control interface that we will integrate with the RPi strictly via serial communications.  Here you can see how things are “stacking up”:

Image

 

Check back next time as we review the development of the Raspberry Pi <-> AlaMode (Arduino) integration!  [R2P2]

 

firstpost

Standard

Wiring Up the Remote to the Pi

In our last report we discovered how we will control the car by identifying switches on the remote control board that send the drive and turn commands to the receiver in the vehicle.

Our next step in this project was to achieve computer control of the RC vehicle by programmatically closing the switches on the remote control.  We decided to try the PiFace module, which you can buy on Amazon.com.

IMG_1271

This module stacks right onto the Pi and extends the RPi GPIO interface by exposing a set of input and output ports with handy screw terminals.

IMG_1274

Using this Python library called pifacedigitalio,  we were able to get it working pretty easily!  Our simple Python script opened and closed the switches successfully, allowing us to control the car.  We made it do a little dance: “foward-to-the-left”, “backward-to-the right”, repeat…  It was kindof Spiralgraphic! (sorry, didn’t get a video of this… maybe next time).
Here is the Python code running on the Pi:

#!/usr/bin/env
import os
import piface.pfio as pfio
from time import sleep

#port 0 - Forward Switch
#port 1 - Reverse Switch
#port 2 - Right Switch
#port 3 - Left Switch

pfio.init()

def all_off():
	pfio.digital_write(0,0) #turn off
	pfio.digital_write(1,0) #turn off
	pfio.digital_write(2,0) #turn off
	pfio.digital_write(3,0) #turn off

while(True):
	print "Forward-Left"
	pfio.digital_write(3,1) #left turn switch on
	pfio.digital_write(0,1) #forward drive switch on
	sleep(1)
	all_off()

	print "Reverse-Right"
	pfio.digital_write(2,1) #right turn switch on
	pfio.digital_write(1,1) #reverse drive switch on
	sleep(1)
	all_off()

IMG_1279

What next?  Well,  R2P2 kept crashing.  Why?  Because it can’t see where it’s going!  Next we will look at giving R2 some “eyes.”  [R2P2]

 

 

firstpost

Standard

The Vehicle

Today we got into examining our “host vehicle” – a toy RC truck we picked up at Walmart.

Here is a photo with the body removed:

Image

And here is a photo of the remote control with it’s cover pealed back:

Image

Here you can see quite clearly the switches we will be tapping into to form the interface from the computer.

Highlighted are forward/reverse and left/right switches:

Image

Stay tuned – next we will “componentize” the remote control and integrate it into the vehicle.     [R2P2]

 

 

 

firstpost

Standard

R2P2 Kickoff!

Today we met and kicked off a cool project that we are all very excited about.  We’re going to take a simple toy RC car and give it a brain so it can drive itself!  Yay!

Stay tuned to see how our project progresses…Image

Standard