Introduction: Robot Controlled by Hand Movements

About: I make things, some of which work. Full Tutorials: https://www.youtube.com/c/CallMeSwal Email: owaism@mcmaster.ca

In this tutorial we are going to build a small arduinobot that we can control with hand movements. We interface with the robot using a webcam that is pointed at a white screen. We move our index finger, which is wrapped in black electrical tape, in front of the webcam. If the index finger moves left, right, up, or down, the robot turns left, right, backwards, or forwards.

Using these controls, we can drive the robot using our hand movements.

Step 1: Parts

Hardware

1 Arduino Uno or Similar

1 breadboard

1 four AA battery pack and batteries

2 Solarbotics GM9 Motors or Similar

https://solarbotics.com/product/gm9/

2 Solarbotics GM10 Wheels or Similar

https://solarbotics.com/product/gm10w/

2 VEX motor controllers or Similar

http://www.vexrobotics.com/276-2193.html

1 Webcam

1 Whiteboard or some sort of white screen

Scrap plexi/wood to make chassis

Software

Arduino IDE

http://arduino.cc/en/main/software

Python 2.7

https://www.python.org/download/releases/2.7/

Python Libraries

-PIL

http://www.pythonware.com/products/pil/

-OpenCV

http://docs.opencv.org/trunk/doc/py_tutorials/py_s...

Step 2: Building the Robot

You have a lot of room for creativity when designing your robot. Just mount the arduino, motors, breadboard, and battery pack to a piece of plexiglass or wood any way you like.

I mounted my motors, breadboard, battery pack, and arduino onto a U channel of plexiglass. I then added a small marble to the front of the robot to act like a castor wheel.

Step 3: Wiring the Robot

Here is the schematic for the robot

The arduino itself will be powered by a computer through a USB AB cable.

Step 4: Coding the Robot

Here is the python and arduino code for the robot. Load the arduino code onto your arduino and save the python file.

Allow me to explain how it works.

The python program takes a picture of your index finger in front of the white screen. The program uses OpenCV to take pictures. The python program then iterates through each pixel of the picture until it comes across a black pixel. The python program uses PIL to determine the color of each pixel. The python program then checks on what side of the picture the pixel is on. Depending on the pixel's position, the python program will send certain information to the arduino. For example, if the pixel is on the mid-left of the picture, the program will send 'full-left' to the arduino. The program sends the information to the arduino over the serial port. The arduino consistently reads for data on the serial port. If it read 'full-left' it would turn left until it read another command.

Step 5: Setting Up the Camera

Point the camera at the white screen as seen in the picture. The camera should be about 4 in away from the white screen.

The python program will run much faster if the camera takes a low quality image. Go into your webcam setting and change your picture settings to the lowest possible resolution. Mine was 640x480.

Step 6: Test the Robot

Put fresh batteries in the battery pack and connect the arduino to the computer through a USB AB cable. Run the python program and wrap your index finger in black electrical tape.

Move your finger infront of the webcam. The robot should respond accordingly.