Build Your Own Eye Robot – A Tutorial
By Steve Griffiths
Robots! It seems like they’re everywhere today. In this golden age of technology, you can buy parts to build your own inexpensively. Here’s how…
First, we need to get some parts for our robot’s body and brain…
Get Your Robot’s Bod
- Acquire an iRobot Create 2 Programmable Robot (http://store.irobot.com/default/create-programmable-programmable-robot-irobot-create-2/RC65099.html?cgid=us&gclid=CK-UvOSsx9ACFUVMDQodnNgNIw). Your robot’s “body”. ~$200 USD
- Obtain a Raspberry Pi 3 Complete Camera Kit. (https://www.amazon.com/Raspberry-Complete-Camera-Kit-Module/dp/B010MMPZCS/ref=sr_1_5?ie=UTF8&qid=1480197338&sr=8-5&keywords=camera+for+raspberry+pi+3) Your robot’s “brain” and “eyes”. ~$90 USD
- Procure a USB battery pack. (https://www.amazon.com/s/ref=nb_sb_ss_c_2_13?url=search-alias%3Delectronics&field-keywords=usb+battery+pack&sprefix=usb+battery+p%2Caps%2C139&crid=1WR5AN0MWNCU3&rh=n%3A172282%2Ck%3Ausb+battery+pack) Your robot brain’s power source. ~$10-40 USD
- Total cost for the first of your mechanical minions: ~$300-~$330 USD
Depending on how sharp you want to make your robot appear, you may need a few other things.
Additional Things You’ll Need
- A power drill.
- A 3-D printer and screwdriver (optional).
- Elon Musk’s blessing. (Heh!)
If you plan on using your robot as soon as it’s built, you’re going to want to start by charging the batteries.
- Plug in the Create 2 charging station and dock the robot on it.
- Plug in the USB battery pack.
- Let both sit overnight so you’ll be charged-up and ready to put everything together the next day.
The Raspberry Pi is a general-purpose computer, so we’ll need to set it up so that it can send commands specific to our robot.
Preparing your Robot’s Brain
- Insert the SD card into the slot on the Raspberry Pi.
- Connect a HDMI cable to the Raspberry Pi to a monitor or TV.
- Connect a keyboard and mouse to the Raspberry Pi’s USB ports.
- Connect an Ethernet cable from your switch to the Raspberry Pi’s NIC.
- Connect the webcam to the Raspberry Pi using the ribbon cable.
- Enclose the Pi in the case.
- Finally, connect the power supply to the Raspberry Pi and plug it into a power outlet.
- Your Raspberry Pi will boot.
After your Raspberry Pi has booted...
- Login (user: pi, pw: raspberry) and connect it to your wi-fi router by clicking on the radio waves icon. Record the IP address. Note: I recommend that you use a DHCP reservation on your router so that you’ll know what IP address your Raspberry Pi acquires when it comes online.
- Through the GUI, click on Start, Preferences, Raspberry Pi Configuration and enable Camera and SSH.
- Run the following commands to update the camera software:
sudo apt-get update
sudo apt-get dist-upgrade
4. Install Jessie Lite, which posts video from the webcam to a local webserver on the Raspberry Pi, with the following commands:
sudo apt-get install git
Finally, we download a script and shut down.
- Download Create2_TetheredDrive.py (http://www.irobot.com/~/media/MainSite/Files/About/STEM/Create/Create2_TetheredDrive.py) to $HOME.
- Shut down the Raspberry Pi.
Now with our computer ready to go, let’s insert our “brain” into our robot body. Note that these steps are only guidance; feel free to be creative and place things wherever it makes sense to you. For example, you could drill holes in the green panel and zip-tie the Raspberry Pi and battery pack to the top of the robot for the purposes of more easily accessing the Pi and battery as well as giving you the ability to install vacuum hardware inside the dust bin.
Assemble your Avenger!
- On the robot, pop the green panel off to gain access to the data port. Drill a hole in the circle with the + sign in the middle. Reseat the panel and plug in the round end of the data cable into the hole and the other end to one of the Raspberry Pi’s USB ports.
- Open the dust bin compartment and remove the fan and the release button.
- Connect the battery pack to the Raspberry Pi and place both into the opening behind the dust bin.
- Snake the webcam through the hole where the release button was, pointing towards the front of the robot. Secure the webcam with tape.
Our robot is complete! Now we need to set up a laptop (or desktop with wi-fi access) as a command and control console that we will use to control our robot.
Preparing your Command and Control (C&C) Console
- Download PuTTY (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) and save it to your desktop.
- Download and install XMing (https://sourceforge.net/projects/xming/) on your laptop.
- Start PuTTY and configure it to use X11 forwarding.
- Using PuTTY, SSH (port 22) to the IP address of the Raspberry Pi.
- Once connected, run .\Create2_TetheredDrive.py that you downloaded when you prepared the Raspberry Pi.
- From the “Create” menu, click “Connect”, then type in your COM port, /dev/ttyUSB0.
- Press “P” to put the robot into Passive mode and then “S” to go into Safe mode.
- Fire up your web browser and go to http://<Pi_IP_address>/html. This will display the webcam feed.
Congratulations! We’re now ready to move! From your XMing window interface, use your arrow keys to control the robot’s movement and press the spacebar to sound the horn. Enjoy!
- iRobot Create 2 Projects: http://www.irobot.com/About-iRobot/STEM/Create-2/Projects.aspx
- Python Tethered Driving: http://www.irobotweb.com/-/media/MainSite/PDFs/About/STEM/Create/Python_Tethered_Driving.pdf