My initial submission to the "Hackster Terminate the competition" competition was to create a robot that seeked out humans but unlike those in the terminator universe it did not go around killing people, instead it used it's powers for good.
This omni-directional robot will find you, detect you, home in on you and compliment you!
One requirement that I specified to myself is that I would ensure that it could be made without having to build any of the electronics yourself. Every part inside of this robot can be purchased from eBay, plugged together using freely available tutorials and they should work. The case will then be 3D printable so you can either print it yourself or get it made on 3D Hubs. I think this project meets this goal and I will now guide you through the steps of building your own Hunter Flatterer Robot
How it all works!So let us start with a system diagram that shows all the parts of the robot and how they plug together. We will be referencing this throughout the build and checking it off as we go along.
Don't be too daunted by this diagram if you have never used motors before. It basically boils down to Four main parts:
- The left hand side is dealing with taking the battery and making sure the voltages are correct for the system.
- The clever bit is done on the ci20
- The Arduino is used to tell the motors what to do
The next four sections will mirror this list and guide you through setting up each part.
Dealing with ElectrickerySo you've got yourself a battery, what next?
The above diagram shows how to connect up all the components for power, if you follow the wiring in the schematic this is the real life representation.
Connecting the Arduino to the L298NI could explain this, but it's better to just follow the tutorial I did: http://www.instructables.com/id/Arduino-Modules-L298N-Dual-H-Bridge-Motor-Controll.
So now you've wired everything up, you have blue lights flashing everywhere and no blue smoke so you're good to go. Let's get on to making this bad boy work.
3D Printing yourself a caseWhen I designed this I decided I wanted two things to happen, it look cool & it shows off the Ci20 as well as possible. I mean this is the point of the competition right?
I designed this robot to be completely 3D printable and the designs are all available below. Basically at this point go and print yourself the top, bottom & wheels. If you don't have access to a 3D Printer you can check out www.3dhubs.com to get someone to print it for you! You can check out the designs below
Here's a pretty render I did of the design to make sure that the ci20 was going to fit and be in pride of place
Once you've got it all printed you can glue all the parts in as above (or use masking tape if you're not feeling two confident. You will need an M4 bolt to hold in the motors.
Making the CI20 do some magicThe CI20 is the boss, the brains of the operation. Without it the robot will flounder. So what does it do?
Well the ci20 is going to use OpenCV to detect your face and then send appropriate commands over serial to the Arduino to get the motors going in the right direction.
Step 1: Install OpenCV
Like I've said throughout this guide, I wasn't trying to reinvent the apple-cart. I'm trying to build something that you can do at home and extend on with relative ease. So to install OpenCV go and follow this tutorial:
It talks you through step-by-step of getting OpenCV up and running.
Step 2: Run the code
The Face Tracking code will need compiling and running, run this command on the file on the Ci20.
g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o binary main.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching
The binary file to be created: FaceTracking: main.cpp > Source file: FaceTracking.cpp
Easy right?
Ci20 & Arduino MagicAfter flashing the Arduino with the code in the attachments below. Plug the Arduino into the USB port on the CI20 and run your recently created FaceTracker. You will see a camera feed pop up (Oh yeah, plug in the webcam) and if you stick your face in the middle the wheels on the robot should start making it drive forward!
Job Done?Now due to time constraints I didn't quite get it to do anything else, so here's a challenge for anyone that has got this far. There are two things you can add to make this bot super awesome:
Add a set of speakers and some sound files so that when the face is large enough on the screen it plays a sound file to the person
- If the robot has not detected a face in 1-2 minutes make it spin around on the spot. You can do this by sending the command "R XX" to the Arduino. Replace XX with the amount of time that you want to turn around for.
Comments