Build Your Own Desktop Pet Robot With Arduino

by TheYantracharya in Circuits > Robots

10994 Views, 154 Favorites, 0 Comments

Build Your Own Desktop Pet Robot With Arduino

Slide1.JPG
yaksha_robot_final_design_2023-Nov-04_10-01-24AM-000_CustomizedView3659100561_jpg.jpg
Mobile Upload 2023-11-13 22-34-16.jpg
WhatsApp Image 2023-11-13 at 22.44.54_a8868588.jpg
ezgif.com-video-to-gif.gif
WhatsApp Image 2023-11-13 at 22.44.55_d69a3fa6.jpg
20231111_000052.jpg

Hey, fellow robotics enthusiasts! Get ready to dive into the exciting world of building your very own robot companion, and we're naming it "YAKSHA."

YAKSHA's going to be our Cozmo-inspired robotic buddy, and it's going to have its own unique charm and personality.

In this guide, we'll explore the art of creating a desktop-sized robot with YAKSHA, who's all set to become your new best friend. To make it all happen, we're going to use the Arduino Nano as the brain behind YAKSHA, allowing us to shape its character, movements, and interactions in a way that's uniquely YAKSHA.

As we tackle this project, we'll not only build a robot but also gain a deeper understanding of robotics, and programming. This is your opportunity to expand your skills in electronics and coding while breathing life into your one-of-a-kind robotic companion, YAKSHA.

So, go grab your gear, set up your workspace, and let's embark on this thrilling adventure to create YAKSHA, with a character that's going to make it the star of the show. Ready to bring YAKSHA to life and make a new friend? Let's dive in!

Supplies

WhatsApp Image 2023-11-13 at 22.27.23_c75c3319.jpg

Supplies required

Electronics:

  • 2 x Arduino Nano
  • OLED Display
  • DRV8833 Motor Driver
  • 7.4V LiPo Battery
  • Connecting Wires
  • Breadboard
  • Perforated Prototyping Board
  • 4 x N20 Motors
  • N20 Motor Wheels
  • Servo Motor
  • HC-05 Bluetooth Module
  • Male Header Pins
  • Female Header Pins

Hardware:

  • 5mm Sunboard for Chassis
  • Thick Sheet for Canopy
  • Tiny Screws

Tools:

  • Soldering Iron
  • Solder Paste
  • Hot Glue Gun
  • Super Glue
  • Cutting Hobby Knife
  • Screwdriver
  • Wrench Set
  • Wire Stripper and Cutter
  • Computer with the Arduino IDE Installed

Assembling the Chassis

WhatsApp Image 2023-11-13 at 22.27.21_ce265953.jpg
Mobile Upload 2023-11-13 22-01-44.jpg
Mobile Upload 2023-11-13 21-58-11.jpg
yaksha_robot_final_design_2023-Nov-04_10-01-24AM-000_CustomizedView3659100561_jpg.jpg

To start building the chassis for your robot, you'll need a base plate made from a 5mm Sunboard with dimensions 90mm x 45mm (length x width). This base plate serves as the foundation for your robot's structure.


To assemble the chassis, follow these steps:

  1. Begin by placing the 90mm x 45mm Sunboard base plate on your workspace.
  2. Attach the single vertical member to the base plate. The drawing below illustrates the positioning and dimensions of this vertical member.
  3. Assemble the horizontal midplate onto the chassis structure.
  4. Assemble the sunboard pieces with the help of Super glue.
  5. After this step the basic chassis is completed.



Assemble the Prime Movers ( N20 Motors)

Mobile Upload 2023-11-13 22-00-59.jpg
WhatsApp Image 2023-11-13 at 22.27.21_ce265953.jpg
WhatsApp Image 2023-11-13 at 22.27.20_755ac86d.jpg
20231111_000055.jpg

To assemble the N20 motors, follow these steps gather the following materials:

  • 4 x N20 Motors
  • Super glue
  1. Identify the location on your chassis where the motors will be attached. Typically, you'll have one motor for each wheel. Refer to your chassis design for the specific placement.
  2. Use super glue or a suitable adhesive to securely attach the N20 motors to the chassis. Make sure they are properly aligned and firmly adhered to prevent any wobbling or movement during operation. It might seem a bit odd to use super glue for motors, but I found it to work well for my setup. If you prefer, you can use suitable fasteners, but for the sake of simplicity, I'm using super glue here.
  3. After attaching the motors, slide the N20 motor wheels onto the motor shafts. These wheels will be responsible for providing traction and enabling your robot to move.
  4. Repeat this process for all four N20 motors, ensuring that each one is correctly attached to the chassis and has its wheel securely glued in place.
  5. Once all the motors and wheels are in place, your robot's prime movers are ready, and it's one step closer to mobility.



Assembling the ELECTRONICS

Screenshot 2023-11-13 231507.png
Untitled12_20231113232609.png

In this step, you'll assemble the electronic components that breathe life into your robot. You'll connect the Arduino Nano boards, motor driver, Oled Display, servo motor etc

please refer to the provided circuit diagram

  1. Connect Electronics: Follow the circuit diagram to connect all the electronic components. Ensure that the connections match the diagram accurately.
  2. Double-Check: Before proceeding, double-check all connections to ensure they align with the circuit diagram.
  3. Completing the Assembly: With the electronics properly connected according to the circuit diagram, your robot is now equipped with the necessary control systems to perform its tasks.



Why Two Arduino Nanos?

Why Two Arduino Nanos?

You might be wondering why we're using two Arduino Nano boards. Here's the deal: one Nano will take the wheel—literally—and drive the motors and control the servo arm for precise movement. Meanwhile, the other Nano will be in charge of managing the OLED display to create expressive 'eyes' that add character to our robot.

Using a single Arduino for both tasks is possible, but I tried it and encountered a few challenges that I couldn't quite pinpoint. So, for the sake of efficiency and functionality, we've opted for two Nanos, each with a dedicated role.

Now, about that ESP32 WROOM 32 development board—it's a promising all-in-one solution, and I'll definitely be exploring it in the future. But for now, let's get back to building with our two trusty Arduino Nano boards.

Arduino Programming

#include <Servo.h>
int outPin1 = 5; //motor1
int outPin2 = 6; //motor1

int outPin4 = 9; //motor2
int outPin3 = 10; //motor2
int pos = 0;
int enable = 2; //motor2
Servo myservo;
int analogValue = 0;
char bt;

void setup()
{
Serial.begin(9600);
myservo.attach(12);

pinMode(outPin1, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
pinMode(outPin4, OUTPUT);

pinMode(enable, OUTPUT);
}
void loop()
{

if (Serial.available() > 0)
{

bt = Serial.read();
digitalWrite(enable, 1);
if (bt == '0')
{
analogValue = 0;
}
if (bt == '1')
{
analogValue = 25;
}
if (bt == '2')
{
analogValue = 50;
}
if (bt == '3')
{
analogValue = 75;
}
if (bt == '4')
{
analogValue = 100;
}
if (bt == '5')
{
analogValue = 125;
}
if (bt == '6')
{
analogValue = 150;
}
if (bt == '7')
{
analogValue = 175;
}
if (bt == '8')
{
analogValue = 200;
}
if (bt == '9')
{
analogValue = 225;
}
if (bt == 'q')
{
analogValue = 255;
}
if (bt == 'F') //move forwards
{
analogWrite(outPin1, analogValue);
analogWrite(outPin2, 0);
analogWrite(outPin3, analogValue);
analogWrite(outPin4, 0);
}
if (bt == 'B') //move backwards
{
analogWrite(outPin1, 0);
analogWrite(outPin2, analogValue);
analogWrite(outPin3, 0);
analogWrite(outPin4, analogValue);
}
if (bt == 'S') //stop!!
{
analogWrite(outPin1, 0);
analogWrite(outPin2, 0);
analogWrite(outPin3, 0);
analogWrite(outPin4, 0);
}
if (bt == 'R') //right
{
analogWrite(outPin1, analogValue);
analogWrite(outPin2, 0);
analogWrite(outPin3, 0);
analogWrite(outPin4, analogValue);
}
if (bt == 'L') //left
{
analogWrite(outPin1, 0);
analogWrite(outPin2, analogValue);
analogWrite(outPin3, analogValue);
analogWrite(outPin4, 0);
}
if (bt == 'I') //forward right
{
analogWrite(outPin1, analogValue);
analogWrite(outPin2, 0);
analogWrite(outPin3, 0);
analogWrite(outPin4, analogValue);
}
if (bt == 'G') //forward left
{
analogWrite(outPin1, 0);
analogWrite(outPin2, analogValue);
analogWrite(outPin3, analogValue);
analogWrite(outPin4, 0);
}
if (bt == 'I') //right
{
analogWrite(outPin1, analogValue);
analogWrite(outPin2, 0);
analogWrite(outPin3, 0);
analogWrite(outPin4, 0);
}
if (bt == 'G') //left
{
analogWrite(outPin1, 0);
analogWrite(outPin2, 0);
analogWrite(outPin3, analogValue);
analogWrite(outPin4, 0);
}
if (bt == 'H') //right
{
analogWrite(outPin1, 0);
analogWrite(outPin2, analogValue);
analogWrite(outPin3, 0);
analogWrite(outPin4, 0);
}
if (bt == 'J') //left
{
analogWrite(outPin1, 0);
analogWrite(outPin2, 0);
analogWrite(outPin3, 0);
analogWrite(outPin4, analogValue);
}
if (bt == 'W')
{
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
}
if (bt == 'w')
{
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
}

}
}

Code for Eyes

WhatsApp Image 2023-11-13 at 22.44.54_94e1656c.jpg
ezgif.com-video-to-gif.gif

Get code for eyes from the link and upload in the Arduino nano for eyes.

Controlling Your Robot

Controlling Your Robot with the Bluetooth RC Car App

In this step, we'll explore how to control your robot using the "Bluetooth RC Car" app by ANDI.co, which will bring your robot to life and allow you to command it effortlessly.

Materials Needed:

  • Mobile device (smartphone or tablet)
  • HC-05 Bluetooth module
  • Pre-installed Arduino code on your robot (from Step 5)

Instructions:

  1. Prepare Your Mobile Device:
  • Ensure your mobile device has Bluetooth capabilities.
  • Go to your device's settings and enable Bluetooth.
  1. Install the "Bluetooth RC Car" App:
  • Visit your device's app store and search for the "Bluetooth RC Car" app by ANDI.co.
  • Download and install the app on your mobile device.
  1. Connect to the HC-05 Module:
  • Turn on your robot and ensure the HC-05 module is powered.
  • On your mobile device, open the Bluetooth settings and scan for available devices.
  • You should see your HC-05 module listed. Pair with it by tapping on it and entering the default PIN (often 1234 or 0000).
  1. Open the "Bluetooth RC Car" App:
  • Launch the "Bluetooth RC Car" app on your mobile device.
  1. Control Your Robot:
  • The app provides a user-friendly interface with controls for movement. This often includes directional buttons, a joystick, or tilt-based controls.
  • Use the app's controls to make your robot move in different directions, stop, and perform various tasks.


Future Possibilities and Scope

20231111_000045.jpg
Mobile Upload 2023-11-13 22-34-16.jpg


In this final step, let's explore future possibilities for enhancing your robot's capabilities:

  • Sensor Integration:
  • Enhance your robot's awareness by adding sensors such as ultrasonic distance sensors, line-following sensors, or cameras. This opens the door for interactive responses to its environment.
  • Advanced Control with ESP32:
  • Elevate your robot's control capabilities by integrating the ESP32 development board. This enables advanced wireless control over Wi-Fi, providing a broader range of functionalities and the potential for remote operations.
  • With these steps, you'll propel your robot into new realms of functionality, making it a versatile and intelligent companion. The integration of the ESP32 for advanced control over Wi-Fi will open up exciting possibilities for remote operations and expanded functionalities.


Working Video

Meet YAKSHA, my DIY robot companion! 🤖✨ Watch the intro now! #YAKSHARobot #DIYRobot #TechIntro
Slide1.JPG