Introduction
I have always been fascinated by robots and wanted to build my own. Recently, I decided to create a small Arduino-based robot with LED eyes that would follow my hand movements. In this article, I will walk you through the steps I took to make this fun DIY Arduino robot.
What You Will Need
To build the hand-following robot, you will need:
- Arduino Uno - The brain of the robot controlling all the components
- Breadboard - For connecting the components
- Jumper wires - For wiring up the electronics
- Continuous rotation servo motors x2 - For powering the robot's wheels
- Caster wheel x1 - Allows smooth rolling movement
- Ultrasonic distance sensor - Detects hand movement and triggers the robot
- LEDs x2 - For the robot's eyes
- Resistors (220 ohm) x2 - For the LEDs
- Battery pack x1 - Power source for Arduino and motors
I used a small plastic food container as the body to hold all the components together. You can use cardboard, 3D printed parts or anything similar.
Assembling the Base
To start, I used thick double-sided tape to attach the two motors at the back of the container base. I placed the caster wheel at the front to complete the rolling chassis.
It is important to align the motors so that the robot can move straight. I also added some weight in the front section to balance the robot and prevent it from tipping backwards.
Adding the Electronics
Next, I prepared the electronics on the breadboard.
The ultrasonic sensor and Arduino Uno were stacked and mounted at the top of the robot body using hot glue. Jumper wires connected the electronics as per the required circuit diagram.
I soldered longer wires to extend the connections from the breadboard to the motors and LEDs.
Programming the Arduino
The code loaded onto the Arduino brain controls the robot's functionality.
First, I included the required libraries - Servo
for controlling the motors and NewPing
for the ultrasonic sensor.
In the setup()
section, I initialized the trig and echo pins of the distance sensor and attached the servo objects to their control pins.
cpp
servoLeft.attach(10);
servoRight.attach(9);
In the main loop()
, the value from the ultrasonic sensor is read to check for any object in front within 15 cm.
cpp
distance = sonar.ping_cm();
if (distance <= 15){
//object detected
}
If an object is detected, the LEDs blink randomly and the motors are driven forward or backwards with different speeds to follow the object.
```cpp
//Blink LEDs randomly
digitalWrite(led1,random(0,2));
digitalWrite(led2,random(0,2));
//Move motors
servoLeft.write(leftSpeed);
servoRight.write(rightSpeed);
```
This allowed the robot to follow my hand as I moved it around in front!
Completing the Build
To finish up, I mounted the blinking LED eyes and attached the battery pack to power the robot. Some decorations like googly eyes and craft materials can be added for personality.
And that's it! My tiny hand-following robot with LED eyes was complete.
Troubleshooting Tips
Here are some common issues and solutions if your robot is not working properly:
- Not moving straight - Check motor alignment and add weight to front
- Not detecting hand - Adjust ultrasonic sensor position and code threshold
- LEDs not blinking - Check LED connections and Arduino code
- Not moving - Ensure battery is charged and motors are wired properly
With some tweaking and adjustments, you should be able to get your robot up and running. The key is testing each component individually before assembling everything together.
Final Thoughts
Building this Arduino robot was a fun electronics project for me. I learned a lot about integrating various components with an Arduino board. The end result was a cute bot that responded to my hand movements with its blinking eyes!
Let me know if you try this project and have any feedback or questions. I would be happy to discuss the details with you. I hope you enjoyed reading about my experience creating this tiny hand-following robot. Let me know if you build your own version. Happy making!