In this Instructable I will show you how to make a cute and kid friendly Obstacle Avoiding Robot I like to call Yogy.

Yogy gets his name from the Yoghurt tub body he is made from. I am a sucker for seeing the best in trash and this Yoghurt tub looked too good to be thrown away. I salvaged it and decided to give it a new life, a better life, a life as a robot!

You can follow through with me and make Yogy by following the written steps or pictures, which are pretty self explanatory.

Or if you don't feel like reading through and clicking with your mouse, you can check out the videos of the build with commentary!

Step 1: Parts List

Electrical Parts:
• Arduino Uno
• Prototyping Shield + Mini Breadboard
• 2 * Continous Rotation Servos + 2 * Wheel Servo Horns
• HC-SR04
• 8 Ohm Speaker
• Male and Female Breadboarding Jumper Cables
• 4 * AA Batteries + Pack
• 9V Battery
• Power Switch

Construction Parts:
• Yoghurt Tub
• Acrylic or a CD (or any other material you can make a base from)
• Small Square Bracket
• Small Screws
• Coke Bottle Lids

• Coping Saw
• Screwdriver
• Stanley Knife
• Hot Glue Gun + Glue Sticks
• Wire Cutters
• Wire Strippers
• Double Sided Foam Tape

Optional Extras:
• 2 * APC220 RF modules
• Soldering Iron + Solder
• Scrap Pieces of Cardboard
• Electrical Tape
<p>The links are broken and I can not get the code. Tried this link too, which is ALSO down. </p><p><a href="http://www.duino-robotics.com/yogy.html." rel="nofollow">http://www.duino-robotics.com/yogy.html.</a></p><p>Can anyone help we to get the code?</p>
<p>#include &lt;NewPing.h&gt;</p><p>#include &lt;Servo.h&gt; //Inclue Servo Library </p><p>Servo leftServo; //Create Left Servo object</p><p>Servo rightServo; //Create Right Servo object</p><p>#define TRIGGER_PIN 6 //Trigger pin of Ultrasonic sensor connected to pin 6</p><p>#define ECHO_PIN 7 //Echo pin of Ultrasonic sensor connected to pin 7</p><p>#define MAX_DISTANCE 100 //The maximum distance we want the sensor to look for is 1m</p><p>NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); //Create Ultrasonic sensor object</p><p>unsigned int time; //Variable to store how long it takes for the ultrasonic wave to come back</p><p>int distance; //Variable to store the distance calculated from the sensor</p><p>int triggerDistance = 30; //The distance we want the robot to look for a new path</p><p>int fDistance; //Variable to store the distance in front of the robot</p><p>int lDistance; //Variable to store the distance on the left side of the robot</p><p>int rDistance; //Variable to store the distance on the right side of the robot</p><p>void setup()</p><p>{</p><p> leftServo.attach(9); //Left servo connected to pin 9</p><p> leftServo.write(90); //Write the neutral position to that servo</p><p> rightServo.attach(8); //Right servo connected to pin 8</p><p> rightServo.write(90); //Write the neutral position to that servo</p><p>}</p><p>void loop()</p><p>{</p><p> scan(); //Get the distance retrieved</p><p> fDistance = distance; //Set that distance to the front distance</p><p> if (fDistance &lt; triggerDistance) { //If there is something closer than 30cm in front of us</p><p> moveBackward(); //Move Backward for a second</p><p> delay(1000);</p><p> moveRight(); //Turn Right for half a second</p><p> delay(500);</p><p> moveStop(); //Stop</p><p> scan(); //Take a reading</p><p> rDistance = distance; //Store that to the distance on the right side</p><p> moveLeft();</p><p> delay(1000); //Turn left for a second</p><p> moveStop(); //Stop</p><p> scan(); //Take a reading</p><p> lDistance = distance; //Store that to the distance on the left side</p><p> if (lDistance &lt; rDistance) { //If the distance on the left is smaller than that of the right</p><p> moveRight(); //Move right for a second</p><p> delay(1000);</p><p> moveForward(); //Then move forward</p><p> }</p><p> else {</p><p> moveForward(); //If the left side is larger than the right side move forward</p><p> }</p><p> }</p><p> else {</p><p> moveForward(); //If there is nothing infront of the robot move forward</p><p> }</p><p>}</p><p>void scan() {</p><p> time = sonar.ping(); //Send out a ping and store the time it took for it to come back in the time variable</p><p> distance = time / US_ROUNDTRIP_CM; //Convert that time into a distance</p><p> if (distance == 0) { //If no ping was recieved</p><p> distance = 100; //Set the distance to max</p><p> }</p><p> delay(10);</p><p>}</p><p>void moveBackward() {</p><p> rightServo.write(180);</p><p> leftServo.write(0);</p><p>}</p><p>void moveForward() {</p><p> rightServo.write(0);</p><p> leftServo.write(180);</p><p>}</p><p>void moveRight() {</p><p> rightServo.write(0);</p><p> leftServo.write(0);</p><p>}</p><p>void moveLeft() {</p><p> rightServo.write(180);</p><p> leftServo.write(180);</p><p>}</p><p>void moveStop() {</p><p> rightServo.write(90);</p><p> leftServo.write(95);</p><p>}</p><p>thats the basic code you need to install the newping library as well also im havin an isssue where yogi only moves backwards can anyone help </p>
<p>I'm in the process of building a Yogi for my son's birthday. The problem I'm running into is that it won't roll straight. Instead, it drifts right which causes issues with obstacle avoidance. I've tried pulling up the servos and re-aligning them but they are probably 15-degrees left angle now and it still drifts right! I believe that the servos are rotating faster one direction than the other and I'd like to adjust the speed of one to compensate, but I don't see if/where that can be done in this code. Any thoughts?</p>
<p>I resolved the issue with a better set of servos. Here is the final product. And my son loves it! :)</p>
<p>Is there a way that I could control its movements via a smartphone or tablet?</p>
<p>Sure! You need a Bluetooth Module and there's an app for Android named BlueTerm.<br>Let me show you some links:</p><p><a href="https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=es_419" rel="nofollow">https://play.google.com/store/apps/details?id=es.p...</a></p><p><a href="http://g02.a.alicdn.com/kf/HTB1FCeoIFXXXXa6XFXXq6xXFXXXF/2sets-LOT-font-b-HC05-b-font-HC-05-master-slave-6pin-JY-MCU-anti-reverse.jpg" rel="nofollow">http://g02.a.alicdn.com/kf/HTB1FCeoIFXXXXa6XFXXq6x...</a></p><p>I love Yogy, btw :3</p>
<p>the links are down... so i have the robot but no code..</p>
<p>Go to http://www.duino-robotics.com/yogy.html and the code download link is near the bottom</p>
<p>I had problems with the library so, i add it </p><p><a href="http://playground.arduino.cc/Code/NewPing#.Uzq_SVc6t2p" rel="nofollow">http://playground.arduino.cc/Code/NewPing#.Uzq_SVc...</a><br><br>and the connection diagram of the HC-SR04 is missing, I know is obvious but is missing.<br><br>Thanks for the proyect t!!!</p>
hi there, i'm having a blast building the yogy. when i try to compile the code, i get a series of error messages revolving around a &quot;redefinition of 'Servo leftServo'. ideas?
I get an error on &quot;NewPing sonar (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); / / Create Ultrasonic sensor object&quot; what exactly should I enter?...
Have you installed the newping library?
Same issue here. The Ping))) sensor combines trigger and echo pins into 1 &quot;Signal&quot; pin. Can't figure out how to adjust the code in a such a way to read both signals from the 1 pin. Ideas...?
I was wondering if i can turn this onto a dog toy...it's possible? <br>
Of course it's possible, anything is possible. First you would need to waterproof the body, so the dog could take it outside. It might be a good idea to add cushions or something similar around the outside to give the dog something to grab onto. You could even have a small servo inside the bot that lets out dog treats. Good luck!
another great creation of yours.
like it very much <br>
Thank you very much! Glad you liked it!
Hi, very nice project. <br>I've made many robots like yours by the past but due to a huge lack of time, i've stopped. <br>When i see a so cute robot like this one, it make me to think about finding some spare time to restart this activity.
very good instructables!
Thank you very much, glad you liked it!
Nice project! Did you do this with kids already, or is it a prototype?
Already done with the kids :) I have a 3yo sister so she was the first candidate to play with it. Its nice because the tub encapsulates and protects it all, so little hands can't pull out cables. If you add a SNES wireless controller, which I will make an Instructable for later, it makes it really easy for them to control too.

About This Instructable




Bio: Robot fanatic.YouTuber. Robotics teacher.
More by chickenparmi:Making an Arduino Powered Curtain Automation Arduino Powered Jack-O'-lantern Toilet Paper Roll Spooky Eyes 
Add instructable to: