Tele-Presence (sort of) robot for the office. Work from home and yet attend the boring meetings. Scare vendors into telling the truth about their products. Chase tiny children when they come to the office for the Hallowe'en or Christmas parties.
Step 1: Gather Tools and Materials
(1) [$3 - $70] RC truck with beefy motor; I used one of these: GT Cross Land Racer (NOTE: you can also find many RC trucks cheap at garbage sales, the Goodwill, and the ARC)
(1 ea) [$39] Raspberry Pi with ($9) 8G Class 10 memory card, ($0)Raspian Image, ($10) Edimax WiFi dongle, ($11) Sony Playstation Eye Camera
(1) [$1.25] 7293D motor controller chip ($1.25) (NOTE: get two because, well you know)
(1) [$8] Set of 22g wires (M/M, F/F, M/F)
(1) [$10 for 5] Lil' tiny breadboard
(1) [$9] Breadboard jumper kit (these are GREAT)
(1) [$0.26] 4AA Battery holder and 4AA batteries (for the L293D chip)
(1) [$25] 5v USB rechargeable battery (for the Raspberry Pi)
(1) [$19 optional] 9V rechargeable battery (for motors, if your truck didn't come with one)
(2) [$0.45 ea] On/Off switch (one for L293D battery power, and one for motor battery power)
(1) Popcorn Tin (or high Tupperware bowl/w lid)
(3) Strips Velcro
(x) Lil' tiny screws
(1) Lipstick, chalk, paint
(1) Roll duct tape
(1) Drill, 1/16" drill bit
(1) Lil' tiny Phillips-head screw driver
(1) X-acto knife
(1) Wire cutter
Step 2: (A note about RC vehicles)
Step 3: Strip RC Vehicle
This will vary on your model, but there should be 4 or 5 lil' tiny screws that hold a plastic froo-froo truck-looking plastic blob on top of the base chassis.
Take this off and you'll wind up with something like this.
Step 4: Locate forward/back and left/right motors
95% of the RC trucks/cars I've dismantled have a beefy motor in the rear of the truck and a smaller motor in the front.
The beefy motor moves the car forward and back; while the front motor moves the front wheels left and right.
The beefy motor usually has a two wires (M+ [red or white] and M- [black]) and the front motor usually has two wires (M+ [orange] and M- [black]) and may have a bunch of skeery-looking wires of different colors. You just need the M+ and M- wires.
Step 5: Remove receiver board
Clip out the electronic board from the guts of the truck. If your car was salvaged from a garbage sale and doesn't have a transmitter, then this should not be too traumatic.
If this IS to traumatic though, or you want to continue to be able to run the car with the RC remote, you can leave the board intact and, in the next step, splice/solder your access wires into/onto the board. This would allow you to still be able to run the robot from the remote control for the car (IF your car came with one). Most of my chassis have come from garbage sales and don't have a remote and the receiver board is broken anyway.
Step 6: Lengthen motor wires
Here we just lengthen the motor wires so that they can be routed to the motor controller chip.
Add a 22g jumper wire to each of the four motor wires. In these photos, I just stripped the ends of the motor wires on the truck, stripped the end of a M/M jumper wire, twisted them together, and squashed 'em with duct tape.
So if you had chosen in the previous step to NOT remove the receiver board in the truck, you can attempt to splice on some jumper wires to the motor or to the motor outputs on the board, the latter requiring soldering.
Step 7: Extract and wire up motor battery
The truck will usually come with either a single big battery, or a series of AA batteries. Or possibly none if it came from a garbage sale.
In any case, you'll want to extricate the battery pack or battery holder and wire it up in series with a switch.
Why? You will find that this will make it easier to start up the robot and access the motor battery when recharging is needed. Most of the trucks come with the motor battery under the chassis, which is a hassle to get to once the robot is finished.
By moving the battery (as we'll do in a bit) and giving it a switch, you'll save some hassle when playing with the robot.
Step 8: Wire up chip battery and holder
The motor chip will require 5-6 volts, so prepare a battery just for it. Again, wire in a switch so that you can turn it on and off easily.
I originally had tried to power the chip from the 5v pin on the Raspi, but that didn't provide enough power and eventually I cooked my Pi.
Step 9: Find a component holder/box
Component Holder = box
Find a box of some sort that will fit well on top of the truck chassis.
Step 10: Box: mark screw holes on truck
Remove the box, then look on the top of the truck for existing holes that you can use to affix the box to the truck. You might have to make your own, but in this example there were three existing good holes.
Use lipstick, chalk, or paint to mark the holes . . .
Step 11: Box: push box down on hole registration marks
Put the box back down (be sure it's empty), and press down so as to transfer the lipstick/chalk/paint onto the back of the box as registration marks.
Step 12: Box: flip over and drill holes through registration marks
This doesn't always work as easily as it should, but eh. Try try again as needed.
Step 13: Box: add some access holes
Cut a few holes in the back and/or sides of the box to allow you to access the insides easier.
Why? After running the robot, you'll want to sometimes remove parts, replace batteries, etc. An access hole or two will allow you to do this.
Step 14: Box: screw box to truck chassis
Screw the box to the truck using the holes you just created.
Step 15: Box: thread motor wires through access hole
Take the four elongated motor wires and route them through the access hole into the box.
Step 16: L7239D Chip Info
The L7239D is a motor control chip. It has 16 pins. You basically give power to the chip itself, then hook up the output pins to the motors, then hook up the input pins to the F/B/L/R motor controls which will come from the Raspberry Pi's "GPIO" pins.
Step 17: L7293D close up
The pins on the L7293D in the photo are reserved for this project as:
You'll want to jumper the pins together using nifty breadboard jumpers as in the picture to make it a little easier. Sort of.
Step 18: Wire motor outputs
Place the breadboard containing the motor chip into the box.
Connect the four motor output wires to the motor output pins of the chip.
Step 19: Wire motor battery
Place the motor battery into the box and hook it to the breadboard. Note that the motor battery's + end goes to the lower-right pin of the chip, and the - end (ground) is connected to one of the ground locations on the breadboard.
Ok, well not really that important, but when wiring in the motor battery, make sure you have easy access to the battery's switch.
Step 20: Wire in the chip battery
Place the chip battery set into the box and hook it up to the VCC pin and another ground location.
Again, be sure to make the battery switch will be easily accessible.
Step 21: Wire in Raspi GND to breadboard GND
Put the Raspberry Pi module in the box.
Connect a F/M from a GND on the Raspberry Pi to an available GND hole on the breadboard.
In this photo, the Raspberry Pi GND that is located on the far row and third pin in was used.
Step 22: Wire Raspi motor fwd control GPIO pin to breadboard
Connect a F/M from the GPIO control 1 pin on the Raspberry Pi to the motor fwd control pin on the breadboard.
GPIO control pin 1 is actually three pins down from the GND pin we are using.
Step 23: Wire Raspi motor back control GPIO pin to breadboard
Connect a F/M from the GPIO control 4 pin on the Raspberry Pi to the motor fwd control pin on the breadboard.
GPIO control pin 4 is actually two pins down from the GPIO control pin 1 that we are using for the forward control.
Step 24: Wire Raspi motor Left/Right control GPIO pins to breadboard
Repeat the process for the Left/Right motor control: connect GPIO control pin 5 and GPIO control pin 6 to the breadboard's Left and Right Motor input control pins, respectively.
Step 25: Add Raspi Rechargeable Battery
Connect the Raspberry Pi's rechargeable battery to the Pi.
Be sure to place the battery near one of the access holes so that you can turn the Pi on and off easily.
Remember you now have three different batteries to contend with:
Step 26: Connect camera and WiFi dongle to Raspi through access hole
Here I found it easier to place the Raspberry Pi toward the back of the truck and cut out another access hole for the camera and WiFi dongle. These both connect to the USB ports of the Pi.
Step 27: Make battery switches accessible
You can leave the switches inside the box and access them through one of the holes, or, preferably, screw them onto one of the sides of the box for easier access. Here I cut a few lil' tiny holes for the switches.
Step 28: Close lid, add velcro strips
Add a couple of velcro strips to the top of the box
Step 29: Add popcorn tin or other prop
I added a popcorn tin to give the final robot a few extra inches of height. Skip this step if you want a shorter robot. The velcro is just to help keep the tin on the roof of the box.
Step 30: Attach mascot body
I used Egor, our office mascot for the final robot. In this photo, I used a cola bear, just as an example.
Use duct tape or velcro to attach the mascot to the popcorn tin or top of the box.
Step 31: Create shoulder frame
Bend a hangar or stiff wire to give some shoulder shape.
Step 32: Add shoulder
Tape the shoulder frame to the back of the tin. This will help keep the robot's lab coat or rain coat up.
Step 33: Add some arms
Use a pool noodle duct-taped around the shoulder/hangar and down the sides to create arms.
Use some stiff wire to bend the arm a little, then wrap the same said wire around the shoulder to the other side. This will allow you to give the arms a little bend and help keep them from splaying outward. You can see this in the second photo close up of Egor's right arm.
Step 34: Add camera
Tape the camera to the front of the robot, just like in Criminal Minds. Note: this photo doesn't show the pool noodle arms.
A quick note about cameras. There are basically two types of cameras usable on the Raspi: A USB web-type camera, and the RaspiCam camera (shown in second photo). The USB cameras can be tricky. Some work. Some don't. The PlayStation camera (third photo) does work out of the three USB cameras that I tried. You can also opt for a camera built specifically for the Raspi. I also tried one of them (i.e. the RaspiCam). Here are the considerations:
Step 35: Add clothes
Now for the fun part, fashion show, here's the bear
Step 36: Squirrel robot
But, by keeping the components modular, it's easy to swap out the 'bot body.
Step 37: Mr. Fuzzy
This is our other office mascot.
Step 38: Dog robot.
Step 39: Egor
Here's Egor's final outfit. Got him some shoes and a tie at the Goodwill.
Step 40: Running Egor with just Remote Control
That's most of the hardware. If you wanted to, you could quit now and just run Egor around the office with just the transmitter, like Bryan did here (provided you had spliced the motor wires in the first few steps and left the receiver board intact).
But for a tele-presence (sort of) capability, read on !
Step 41: Add walkie talkie
Not a true tele-presence, but eh, allows Egor to ask for chocolate and to tell people to get out of the way.
Step 42: Raspi software
That's the hardware. To run Egor from the Internet or Intranet or private net, you can use the Raspberry Pi.
The Raspberry Pi computer needs to be set up with:
Step 43: Raspi WiFi Access
There are many ways to set up WiFi/remote control for Egor. Bottom line is that for Egor I had to set him up as an Access Point. (As shown sort of in second photo.) Your situation may be different, though.
Here is a great tutorial on setting up the Raspi as a WiFi Access Point.
And here is a tutorial for setting up the Raspi with standard WiFi on the Pi
Here are some things to consider when considering how to control your robot via WiFi:
Other things to consider:
Step 44: Camera execution and Http access
There are numerous libraries that can capture USB video. I recommend mjpeg-streamer for many reasons. Here is an example documenting the installation of mjpeg-streamer. When mjpg-streamer is installed and running, you simply point a browser to the Raspi's IP with the (default) port of 8080, as shown in the photo.
Mjpeg-Streamer Installation for USB camera
And here is an example using mjpeg-streamer for the raspi-cam:
Mjpeg-Streamer Installation for RaspiCam
Based on info from the first link (Mjpeg-Streamer for USB camera), here are the commands I ran to get the Playstation USB camera running: [disclaimer: yes of course it works the first time! after about a hundred attempts]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - -
sudo apt-get update
sudo apt-get upgrade
lsusb [should show list of USB devices,including your camera]
sudo apt-get install subversion
sudo apt-get install libv4l-dev
sudo apt-get install libjpeg8-dev sudo apt-get install imagemagick
pwd [(should show /home/pi]
svn co https://svn.code.sf.net/p/mjpg-streamer/code/
[the above should place a directory called "code/mjpg-streamer" under your /home/pi directory, if you want to use my motor controller in the next step, be sure that your directory has the same set up]
pwd [should show /home/pi/code]
pwd [should show /home/pi/code/mjpg-streamer]
make USE_LIBV4L2=true clean all
make DESTDIR=/usr install
[for the Playstation camera, I had to tell mjpg-streamer to use YUV format, not the default mjpeg format; to do this, follow these sub-steps]:
./start.sh [mjpg-streamer should start and you may see error messages about not being able to control a non-existent tripod, these errors can be ignored]
On my Raspi, when starting mjpg-streamer via the ./start.h command, the output appears as follows:
Then, I pointed my browser from another computer on the same network to the Raspberry Pi with port 8080.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
In an attempt to minimize the bandwidth used for Egor's camera, I also wrote a UDP snapshot transfer mechanism which I ended up not needing due to putting Egor on his own private network.
Step 45: Motor Controller Software
This just sucks. There's a buzillion ways to do this, but long long long story short, here's my code (Java class files) to run a simple Java applet user interface and server to control the motors. Trust me, you do not want to know the whole story why this is an applet. Just use the code if you like.
Other Instructables showing GPIO control over network:
Simple and Intuitive Web Interface for GPIO
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
To use my server and client control applet, place the following files in the following directories on the Raspi [again, this assumes that you installed mjpg-streamer at /home/pi/code/mjpg-streamer]
To start the motor server:
To run the motor user interface:
NOTE: the client part is a Java applet so your browser will have to be set to allow Java applets or download the cmdtx.jar file to your browser computer and run it right from Java on that computer.