Introduction: DoggoBot Version 1
Ever since I started programming Arduinos, I wanted to build a robot using one. I also want a dog. However, living in NYC makes it tough to take care of a dog. So after hours of watching videos of robots and dogs, I decided to put my phone down and build myself a pet!
I present to you find readers, DoggoBot Version 1! I created a 4 legged walking bot which can be build with cardboard and hotglue. The electronics are simple and can be ordered from Amazon. However, I noticed the links from Amazon tend not to last very long so the links provided are from websites which routinely carry the items. If you want to get them from Amazon, simply enter the name of the item in the Amazon search bar. You can definitely get a lot of these items cheaper on Amazon then directly from the websites provided.
I think the overall cost should be about $150 dollars. This includes all the electronics, 3D printing and laser cutting fees. However, you could cut these parts by hand from some scrap cardboard and the 3D printed parts could be replaced by paper fasteners and tape. I just feel the 3D printed parts work a bit better.
For the code, I wanted to create a structure which could be easily manipulated. I wanted something to which I could add and replace functions without effecting the core functions. The code is set up to take in either serial input or Bluetooth input. Without getting into too much detail, both styles change the value of a variable named moveVal. Then the function of the bot is determined by the value of moveVal. However, you can add whatever input style you like, then have that input change the value of moveVal. No need to rewrite movement functions for your new input style! This may seem simple, but I'm easily impressed!
In version 1, the DoggoBot can walk, stand and sit. It can respond to input either over a serial or a Bluetooth connection. I also created an Android app to connect to the bot via Bluetooth. The app has a simple layout similar to a Sega Genesis controller. There is a directional pad, 6 buttons, start and select buttons. 12 overall. The controller sends char values to the bot which will be explained at the end.
With all of that being said, or rather written, I present to you DoggoBot Version 1!
Step 1: Gather All Your Parts
You will need to gather some materials for this project. Nearly all of them can be ordered from Adafruit, Sparkfun, or Amazon. The other key thing is access to a laser cutter and 3D printer. There are some alternatives if you don't have access to these tools. You could make the cardboard parts by cutting them out of spare cardboard with a sharp knife. If you don't have a 3D printer, these parts could be replaced by some paper fasteners.
Here is the list of parts. You can definitely find all of these on Amazon. I didn't want to include Amazon links because the product pages they go to do not seem to last very long. Simply search for the product name in the Amazon search bar and you will find a bunch of different sellers. Especially for the Arduino Nano. You can get it for nearly a 1/4th of the price on Amazon. Buy a few! They are great to play with!
4 x Tower Pro MG90S Metal Geared Micro Servo Adafruit
You could go for the plastic geared motors, which are cheaper.
However, they are not as durable and have not been tested with this project.
1 x Arduino NanoArduino
You could use any Arduino. The Nano just fits so nicely onto a breadboard
2 x 100uF Electrolytic Capacitor Adafruit
These are needed to smooth out the power supply for the servo motors and prevent back EMF going to the battery. I've seen diodes used instead but have never tried them.
1 x 5 Volt Regulator SparkFun
This brings the voltage from the battery to 5 volts for the servos. Your servos will last a lot longer and perform much better with a regulated power supply.
1 x HC-05 or HC-06 Bluetooth Module NewEgg
The HC-06 can only recieve input while the HC-05 is a transceiver, which means it can recieve and transmit data. Use the HC-05 if you want your DoggoBot to "talk" back to you.
1 x Half Size Breadboard Adafruit
You just need a breadboard large enough to fit the electronics. A larger one would work just as well.
1 x 7.4 1200 mah LiPo Battery NewEgg
You need a good supply for the servos. A 9 volt will not do! You could also use 4 AA or 4 AAA batteries with a battery pack holder. Just connect the wires of the holder in the same way as the LiPo. However, the LiPo will last much longer and is rechargable!
1 x LiPo Battery Charger NewEgg
Charges the battery. You will want one with a cut off circuit to prevent over charging the batteries. Over charging LiPo batteries is VERY DANGEROUS!
1 x SPDT Switch Adafruit
This lets you turn off the battery pack which will cut power to the legs. Not having the legs move can be helpful when debugging code.
DC Barrel Jack Adapter Sparkfun
9 Volt Batter Barrel Jack AdapterSparkfun
Male to Male Jumper Wires SparkFun
Much like M&Ms the color is not too important here. The inside is still the same material. However, I find it very helpful to color code things line power, ground and signal lines. The instructions use specific colors for things. This is the amount of each color you will need for this instructable.
1 x Blue
1 x Orange
4 x Yellow
9 x Black
9 x Red
Paper Fasteners Staples
Used to replace the 3D printed parts for the hinges. Use a bit of tape to hold down the opened side of the fasteners. Will work but I found it a little tricky to install.
Masking Tape Staples
Laser Cut File
The file is in ai and svg formats. See the attached zip file for all the necessary part files and code.
3D Printed Parts
The file is in stl format. See the attached zip file for all the necessary part files and code.
Hot Glue Gun
Glue Gun Sticks
The ones below are optional. I found I have to make some adjustments with my parts. However, the adjustments I made are now included in the laser cutter file.
Step 2: Assemble the Legs
Lets put the legs together first. You will need the leg parts, hot glue gun and 3D printed parts.
We are going to assemble the upper legs first. Follow these directions alongside the pictures. Try not to over think these too much. I tried to make this as simple as possible to put together. There really are only two steps where you can go wrong so some attention to detail required. Once you finish the leg A, you just need to repeat these steps for the 3 remaining legs.
1. Plug in your hot glue gun.
2. Grab the two upper leg parts labeled A and two small I beams.
3. Grab the upper leg part with the oval underneath the A and one small I beam.
4. Place a line of glue alongside the indent of the I beam.
5. Place the indent of the I beam onto the underside of the tab of the leg part A.
6. Repeat this for the second I beam.
7. Place a line of glue on each of the indents of the I beams.
8. Place the other upper leg part so its tabs are on top of the indents and the A is facing the backside of the other leg A part.When you glue the parts together, you will be able to see both As when looking at the leg.
9. Grab two lower leg parts and two large I beam parts.
10. Place a line of glue in the indent of one of the large I beam parts.
11. Place the indent of the large I beam part onto the tab of the lower leg part.
12.Repeat steps 10 and 11 for the second large I beam part.
13. Place a line of glue onto the indents of the two large I beam parts.
14. Place the second lower leg part so its tabs are in the indents of the two large I beams.
15. Repeat steps 1 through 15 for the remaining leg parts B, C and D.
Step 3: Assemble the Body
We are going to assemble the body and glue the servo motors in place.
1. Gather the parts for the body and 4 servo motors.
2. Grab the battery case wall part and fold along the score lines.
3. Place the tabs of the battery case wall into the slots of the body base part. If you have some trouble getting the tabs to go into place, gently press the tabs with you thumb and pointer finger to make the tabs into a wedge shape. This will help to fit the battery wall into place.
4. Place a line of glue along the base of the walls to secure the battery wall in place.
5. Grab the side wall with B and C labels and place a line of glue along its indent.
6. Place the indent of this side wall onto the tab of the base part. The B and C of the side wall should line up with the B and C of the base part.
7.Grab the side wall with A and D labels and place a line of glue along its indent.
8. Place the indent of this side wall onto the tab of the base part. The A and D of the side wall should line up with the A and D of the base part.
9. Grab the side wall with B and D labels and place a line of glue along its indent.
10. Place the indent of this side wall onto the tab of the base part. The B and D of the side wall should line up with the B and D of the base part.
11. Grab the side wall with A and C labels and place a line of glue along its indent.
12. Place the indent of this side wall onto the tab of the base part. The A and C of the side wall should line up with the B and D of the base part.
13. Grab one of the servo motors.
14. Thread the wires of the servo through the hole labeled A of the side wall.
15. This part is crucial so follow the pictures for a reference. Align the servo motor so that the side with its wires is facing up.
16. Place a small bead of glue onto the side wall, underneath each of the two tabs of the servo motor.
17. Press the servo motor into the side wall to secure it in place.
18. Repeat steps 14 through 17.
The orientation of the servo motors is important because the code assumes the servo motors are oriented with the wires facing up. If you happen to glue them in the opposite direction, you could adjust the code so this orientation will work.
Step 4: Assemble the Breadboard
Set aside the legs and the body. We are going to assemble the electronics on the breadboard.
Quick tip. If you are having some trouble getting the Nano into the breadboard, take a look at the pins. In the second photo, you can see the pins are at an angle. Often the Nanos come this way. Price you pay for cheap Arduinos.
A simple fix is to place the Nano's pins on a hard surface like a tabletop, then gently press the Nano into the tabletop. This will straighten all the pins at once. Do this for the other side.
Do press gently though! You do not want to break the pins from the board.
For these instructions, I refer to the labels on the breadboard. They are set up like a grid. The columns are labeled A to J and the numbers go from 1 to 30.
1. Gather the Nano, volt regulator, capacitors, HC-05, jumper wires, switch and breadboard.
2. Place the Nano onto the breadboard so the Nano's digital pin 12 is at position G1 on the breadboard.
3. Place the volt regulator so its pins are at positions H20, H21 and H22. This part is important so make note of the orientation of the volt regulator as one pin is input and the other pin is output. WILL NOT WORK IF YOU PLACE THIS IN THE WRONG DIRECTION! If you position the breadboard so the the USB port of the Nano is facing away from you, the labeled side of the volt regulator should be facing to the right. See the pictures for a reference. Sorry for yelling....
4. Place one capacitor so the negative side is in position F21 and the positive side is at F22. Make a small bend in the positive side's lead to help it fit.
5. Place the second capacitor so its negative side is at position I21 and its positive is at I20.
Make a small bend in the positive side's lead to help it fit.
6. Place the SPDT switch so its three pins are at position I30, I29 and I28.
7. Place the blue tooth module so its VCC pin is at position E26, GND is at E27, TXD is at E28 and RXD is at E29.
8. Gather the jumper wires sort them into piles of like colors to make things a bit easier.
RED JUMPERS (Power Lines)
9. Place one end of the first jumper at position H30. Leave the other end of this jumper free.
10. Place one end of the second jumper into position H29 and the other end into position F22.
11. Place one end of the third jumper into position J20 and the other end into the far end of the red line of the breadboard. This is to create a 5 volt power rail for the motors.
12. Place one end of the 4th, 5th, 6th, and 7th jumper wires into the power rail of the bread board so they are grouped together and near positions J12 - J9. This will ensure these jumpers are near the hole cut in the top of the body through which the servo wires will pass. Leave the other ends of these wires free. These will go to the VCC pin of the servo motors.
13. Place the 8th jumper at position B12. It should be in the same row as the 5Volt pin of the Arduino Nano. Place the other end of the jumper into the red rail of the breadboard. This is to create a 5volt power supply for sensors and devices such as our Bluetooth module.
14. Place one end of the 9th jumper at position A26 of the breadboard and the other end into the power rail of the breadboard.
BLACK JUMPERS (Ground Lines)
15. Place one end of the first jumper into position F22 of the breadboard and leave the other end free.
16. Place one end of the second jumper into position J21 and the other end into the blue line of the breadboard, next to the red jumper. This will create a ground rail for the motors.
17. Place one end of the 3rd, 4th, 5th and 6th jumpers into the blue line of the bread board alongside of the red jumpers. Leave the other ends free. These will go to the ground pins of the servo motors.
18. Place one end of the 7th jumper into the far end of the blue rail on the breadboard and the other end into the far end of the opposite blue rail of the breadboard. This will connect the two blue rails of the breadboard.
19. Place one end of the 8th jumper wire into position B14 of the breadboard. This should be in the same row as the GND pin of the Arduino Nano. Place the other end of the jumper into the blue rail of the breadboard. By doing this, you are connecting all the grounds to the ground pin of the Arduino. This is crucial for proper operation of the robot. All grounds must be connected.
20. Place one end of the 9th jumper wire into position A27 and the other end into the blue rail of the breadboard. This is to connect the GND pin of the Bluetooth module to ground rails of the bread board.
21. Place one end of each of the yellow jumper wires into positions I9, I8, I7, and I6 of the breadboard. Leave the other ends free. The free end of each jumper wire will connect to the signal pin of the servo motors. Positions I9, I8, I7 and I6 should be in the same row as the digital pins 4,5,6, and 7 of the Arduino Nano respectively. If they are not, just make sure one end of each yellow jumper is in the same row as digital pins 4, 5, 6 and 7 of the Nano.
22. Place one end of the blue jumper into position I11 and the other end into position A28. This is to connect digital pin 2 of the Nano to the TXD pin of the Bluetooth module.
23. Place one end of the orange jumper into position I10 and the other end into position A29. This is to connect digital pin 3 of the Nano to the RXD pin of the Bluetooth module.
Double check your connections with the wiring diagram and then move to the next step!
Step 5: Place the Body Parts Together
We are almost finished. Now we are going to connect the servos and batteries to our breadboard.
Gather the wired breadboard, the body with servos attached and the body top part. The body top part is labeled with A,B,C,D and Breadboard.
CONNECT THE MOTOR BATTERY
1. Place the battery pack into the battery holder of the body.
2. There should be two sets of wires coming from the battery. Thread the set of three wires with the white cap through the small hole of the body side wall. This is to connect the battery to a recharging station without having to remove the battery from the robot.
3. Thread the set of two wires with the red cap through the small hole in the body top part.
4. Make sure the switch on the bread board is set to OFF. I realize there is no ON or OFF label for the switch. However, if you wired everything according to the instructions, the OFF position is when the switch to pressed towards the Arduino.
5. Connect the free end of the black jumper wire into the GND pin of the battery.
6. Connect the free end of the red jumper wire into the Vout pin of the battery.
CONNECT THE SERVOS
7. We are going to connect the servos one by one to make sure they are wired correctly. This is one of the crucial steps. However, do not worry. If you wire the servos in the wrong order you can always detach and reattach the jumper wires to get things write.
8. Thread the wires for servo A through the hole of the body top part.
9. Connect the free end of the yellow jumper wire at position I9 into the signal pin of the servo A motor. The signal pin should be the orange wire of the servo. If its a different color, it should be on the opposite side of the ground wire of the servo. In any case, refer to the specs of your servo motor for the proper wiring.
10. Connect the free end of the red jumper nearest position J12 of the bread board into the VCC pin of servo A.
11. Connect the free end of the black jumper wire next to the red jumper you just connected to the GND pin of servo A.
12. Repeat steps 2 through 5 for servos B, C and D. For the yellow jumpers, you want to connect them so digital pins 4 goes to A, 5 goes to B, 6 goes to C and 7 goes to D. This is important since the code assumes this connection arrangement. For the red and black jumpers, the order does not matter just as long as the red jumpers connect to the VCC pins of the servos and the black jumpers connect to the GND pins of the servos.
13. When all the connections are made, place the body top part onto the body so its tabs line up to the body's indents.
14. Press gently down on the body top part to have it snap into place. The tabs of the body will fit into the indents of the body top. This should hold every together. You can always add some glue to secure the top in place but I like to leave it without glue in case I need to replace the battery or a motor.
Step 6: Upload and Test Code
Now we can upload our code. Download the code provided. You will need to install Arduino software. This is a simple process. Please refer to their website for instructions.
1. Connect the Arduino Nano to a free USB port on your computer.
2. Open the code in the Arduino IDE.
3. Select the board from your menu and select the port.
4. Upload the code.
5. Turn the switch to the ON position. The motors should move to 90 degrees.
Take a pause to look through the code. You will see in void setup(), after all the pins are setup, the first action is for the robot to call the stand() function. This moves the legs into position so the bot stands. In the code provided, this moves the legs to 90 degrees. For now, this is fine. This will allow us to attach the legs so each leg is centered at 90 degrees. We need this as a reference point and need a proper one to ensure the legs move correctly.
If you scroll down towards the bottom of the code, you will see the details for the stand() function. Its very simple. Its sets the position of each servo to 90 then writes each servo to 90. You will also notice some lines which are commented out. These are positions which I found to be a bit better for the robot. Use your discrection to find values which work best for your bot.
Once the code is uploaded and everything seems right, attach the breadboard to the body top part by placing a few beads of hot glue on the under side of the bread board then placing the breadboard in the region labeled Breadboard on the body top part.
Step 7: Attach the Legs
Homestretch! Now we will add the servo horns to the legs so we can attach them to our bot.
1. Grab the four legs and four servo horns.
2. Take note of the horns. Its hard to see but one side is longer than the other. If you count the holes, you will find one side has 7 and the other has 6. It does not matter which side you use but you must be consistent. If you glue the horn so that the side with 7 holes is at the top, do this for each leg. Otherwise, your bot will not sit level as one leg will be slightly higher than the other.
3. Starting with leg A, add a line of glue to the inside of the oval.
4. Gently press the horn into the glue so its inside of the oval. Try to align the hole of the horn with the hole centered at the oval.
5. Repeat step 4 for each leg.
6. Now just attach each leg to each servo. A to servo A, B to servo B, C to servo C and D to servo D. It will help to look at the labels on the body top part.
7. Secure the breadboard in place with a few dabs of glue.
8. For testing purposes, I find it very helpful to have something to rest the bot upon. A coffee can works great.
To secure the legs to the servos better, use the horn mounting screws which came with the servos. Get a small phillips head screwdriver and guide the screw through the holes of the legs into the hole of the servo horn. A magnetized screwdriver works best for this. Don't have one? Well grab a magnet and pass the tip of the screwdriver over the magnet like you are sharpening a knife. After about 10-20 passes, the tip will have a strong enough magnetic field to hold the screw in place as you guide it into place.
Step 8: Test the Code
Now its time to test the code. If you unplugged the Arduino when adding the legs, plug it back in and upload the code one more time.
By default, the robot is set up to take in serial input. Open your serial monitor and type 1 then press enter. The DoggoBot should start walking. Entering 2 into the serial window will have the bot sit. 0 will make it stand.
Next we can test the Bluetooth portion. I created an app to control the bot but unfortunately I was unable to upload it to the Google Play Store. You will have to install it manually but do not worry, its an easy process.
1. Plug your Android based phone into the computer.
2. Make sure you have it set up so files can be transferred between the computer and phone.
3. Open the DoggoBot Files folder and navigate to the MIT App Inventor files.
4. There is a file called BlueController.apk.
5. Copy this file onto your phone.
6. On your phone, navigate to where you placed the BlueController.apk file and click to install.
7. You may have to adjust your phone settings to allow installation of apps not from the Google Play Store.
8. Alternatively, you can create an account for MIT App Inventor. I highly recommend this as its a fun tool to play with.
9. Once you have your account set up, import the BlueController.aia file into your app inventor project.
10. Select the option to build the app with a QR code.
11. Use your phones QR code scanner to scan the code provided by the app.
12. It will direct you to a link to download the app.
13. Install. The photos here are screenshots of what the app looks like on your phone.
Here are the values the app's buttons send to the Arduino:
UP = 'u'
DOWN = 'd'
LEFT = 'l'
RIGHT = 'r'
A = 'a'
B = 'b'
C = 'c'
X = 'x'
Y = 'y'
Z = 'z'
START = 's'
SELECT = 't'
The voice command sends just a string.
You may have to adjust some of the settings in the Arduino code. If the bot does not sit well, adjust the pos variables in the sit() function to get it to sit properly. Play with these variables until you find one which works.
Do the same for the walkForward() function. You may have to adjust the values of the start and end positions to get the DoggoBot to walk properly. Play with these! The idea behind the bot is to have something which can be adjusted easily so give it a try and let me know how it works!
Step 9: Last Steps
The speech recognition portion of the app is good but not great. You may have to adjust some of the if statements in the Arduino code to account for words which the speech recognizer misunderstands. For example, I found "sit" often gets interrupted as "set". Simply adding this condition to the info statements in blueControl() can fix this.
Use the printAll() function in the Arduino code to see what the app is sending to help you adjust your code.
One last step I would do is to add a 9 volt battery in order to power the Arduino Nano instead of using the USB supply. There are a few ways to do this but basically you need to connect the positive end of the 9 volt to the Nano's Vin pin and the negative side of the battery to the Nano's GND pin.
Below is how I did it. I used a barrel jack and a barrel jack adapter so I could unplug the battery when not in use.
1. Connect a red jumper wire to the DC barrel jack adapter's positive terminal.
2. Connect a black jumper wire to the DC barrel jack adapter's negative terminal.
3. Connect the free end of the red jumper wire to the Nano's Vin pin on the breadboard.
4. Connect the free end of the black jumper wire to a ground line on the breadboard.
5. Use a bit of hot glue to secure the barrel jack adapter into place on the bot.
6. Connect the 9 volt barrel jack adapter to the 9 volt battery.
7. Make sure you have enough room to plug and unplug the barrel jack, then use a bit of hot glue to secure the 9 volt in place.
Step 10: Final Thoughts
This project was a lengthy one. It took me a few months to get it to the state it is now. I've learned a bunch. I will definitely make some revisions in the second version.
-Add a switch for the 9 volt battery
-Add a switch to select between serial and bluetooth input
-Try to use one battery to power everything
-Get the robot to turn!
I hope you enjoy this and please let me know any comments or suggestions. Thanks!
We have a be nice policy.
Please be positive and constructive.
I am so excited to get started on this!! Thanks for the really clear step by step approach to making this. Even a member of the great unwashed such as I can follow along.
I do have a question however, any idea how you can get a home eeg (I have the NeuroSky Mindwave Mobile) to send commends to the dog bot? I'd jump over the moon if I can just get it to move forwards using 'mind control' haha. I suck with programming though so I'm not sure if you can get a code something like UP = 'input x from bluetooth device' to work and how to link the two programs so that they 'talk' to each-other or if you can link the device directly as the sole controller for the dog bot.
Thank you for taking the time to read this!
Hello am in Kenya where can I get this material to try making this things too
You can get all the electronics from Amazon. You just may have to buy some in bulk, like the capacitors.
For the cardboard, I used corrugated cardboard. The laser cut files is for cardboard 3/16 inch or about 5 mm thick.
As long as the cardboard is nice and flat it should work. You could print laser cutter file on paper to use as a template to cut the parts from cardboard by hand.