Recently, I have made this 3D contactless mouse, which I use to control (or to try to control) my computer cursor. You can see the functionalities in the video below :
All the computation is made on the arduino leonardo, which emulates a mouse. In fact, it's a very simple vision system that uses only five ultrasonic range sensors to make converge the robot towards the object and to lock its orientation on it by the primitive detection of the edges I've developped.
In this Instructable, I will show you how to build your own version of this amazing device!
Step 1: List of Materials
Step 2: Glue the parts
I'm using hot glue since it's sufficiently robust for the need, it works great with PLA and moreover, it can easily be completely removed if you've glued something wrong.
Ultrasonic range finders :
Put a little bit of glue on the crystal, then glue the support. Solidify the barrels. Glue a servo horn on the side.
Central section :
Glue the 4 servos in their appropriate casings. They should be glued to the frame in their middle. Tape or glue their wires in the backside. Glue the central ultrasonic range finder in the center.
Pass the servo wires in the hole of the support, then glue the servo to it. You can put a clamp to secure the robot to a table. Also, you can glue the arduino to it via a 3D printed support.
Mounting bracket :
Glue the two sides together with the little base. Attach the servo horn to the base servo, then glue the bottom of the mounting bracket to it. There is a hole to solidify this junction, don't hesitate to fill it with hot glue. Glue a servo to the square hole to the top of the bracket, gear towards the interior and in the upper section. Glue the 2 nuts in the top of the other bracket, insert the screw, glue the roller to the tip of it. Glue the little rod on the central frame. To mount the central frame, unscrew to make a little space, then insert the rod in the roller and screw until everything is secure. This part of the robot is a little bit fragile, you may have to repair it often. Finally, glue three 25 cents below the nuts (this is a counterweight of the servo).
Step 3: Connect the Servos and the Sensors and Build the Circuit
Connecting all the wires can get a bit messy (I talk by experience...). Use a good amount of methodology. Note that I use a one-data-pin configuration for the ultrasonic sensors. In the model I use, the Trigger and Echo are on separate pins, so I've put a little jumper.
Here are the listing of the pinout for the connection to the arduino :
2 : base servo (theta)
3 : Non-connected for interference reason
4 : up & left servo
5 : down & left servo
6 : down & right servo
7 : up & right servo
8 : up & left sensor
9 : down & left sensor
10 : down & right sensor
11 : up & right sensor
12 : middle sensor
A0 : tilt servo (phi)
A1 : Sound input
Connect the Vcc of the sensor to the 5V regulated by the arduino.
Important : Connect the Vcc of the servos to an external 5V supply (otherwise, your Arduino will suffer...)
Connect all the grounds together.
I've joined a picture of my breadboard along with schemas. It's a bit compact, you can see that the unused space on the shematic breadboard is in reality full of supply wires for all the servos and the sensors. As there is no supply rails on a mini breadboard, it's more difficult to understand the circuit and to troubleshoot. This is not a complex circuit, take your time and everything will go straightforward. The voltage divider before the LM386 can be replaced by a trimpot for a more accurate control on the sensibility of the microphone.
Step 4: Upload the code
This is the code (echolocator3d.ino). I've commented it so it should be readable, but don't hesitate to communicate with me if something is unclear.
I've also made a short code for testing the servos. Run it and play with angle values to find flat initial positions (all the sensor must align in the central plane). Then put these values in the real program, in the "servo start angle" section.
The serial monitor is also useful for debugging.
Step 5: Familiarize with Controls
At this step, everything should work fine. The robot is most of the time capable to follow your hand. Here is the user guide for the interface with the mouse :