Today we will be making a Arduino powered face tracking robot. The idea came from over on the Arduino create website, but they aren't using a robot. So, we will improve a little. You can see the post here. Now lets get started. First you will need the following items.
Step 1: Understanding What We Are Doing
Now that we have our components, we have to understand the outcome of the robot. The Robot will use an android phone to look for a persons face and turn left or right to find the face if lost. It will transmit its findings over bluetooth.
Step 2: 3D Printing
The parts are made to hold A nexus 6P with a case, and attach to a servo. The parts are made in SolidWorks and I've attached Both STL, and SolidWorks file. These were printed on medium quality, but your printer may very.
Step 3: Wiring the Robot
Very simple. Also clean wires make a clean robot.
Bluetooth RX = 2
Bluetooth TX = 3;
Rgb Red = 4
Rgb Green = 5
Rgb Blue = 6
Tilt Servo = 7
Pan Servo = 8
Help Servo = 3 (Will Explain later)
Right forward = 9
Right backward = 10
Left Forward = 11
Lef Backward = 12
Step 4: Installing the Android App
If you are familiar with android studio then this will be a fun step for you. This is where you can set the resolution and frames per second. I suggest that you play around with it and see what fits best for your device. Also don't forget to put in the name of your bluetooth device on line 102.
Step 5: Getting Bluetooth Data
First we have to get our reading. So download the code to your robot, pair up your bluetooth, and launch the android app and see what happens. In theory your phone should put a box around any face it sees and send that data back over bluetooth. If thats not that case, check your wires and bluetooth connection. Also make sure you put the name of your bluetooth module in the android app before building the .APK file.
Step 6: Putting the Data to Use
After we have gotten data, we can put it to good use. I've provided the code just incase you wanted too get your hands dirty.
Here are a couple of videos of some test runs:
Now To the big Question. What is 'HELPPIN_SERVO'?
Well, I had some trouble using the SoftwareSerial and Servo libraries together. For it to work I had to create a servo object and assign it to the TX pin. I don't know why this is happening, but thats the work around I came up with. There is still some work to be done software wise, but why would I take out all the fun? Anyways, thank you for reading and have a great day.