Introduction: PIDDYBOT - DIY Arduino Balancing Robot
Runner Up in the
GIFs Challenge 2017
The PIDDYBOT is a small Open Source balancing robot with the aim of teaching PID controls using a "hands on" concept. Anyone can play with the PIDDYBOT and start to develop an understanding of what the P, I, and D terms within the PID loop do, even if that person has no concept of the math behind the control itself. It is a great teaching tool for the classroom. The program I have written for the PIDDYBOT uses the potentiometers to physically control the PID terms. This way you can turn them in real time and see the effect they have on the control parameters. The PIDDYBOT can also be programmed with more complex programs as well. There are encoders for the wheels to add more stability, and if you like you can add Bluetooth for remote monitoring.
Check out the video below for more info.
Step 1: What Is the PIDDYBOT? - Check Out the Video!
Step 2: Get the Parts and Tools!
- Bill of materials for PCB: BOM
- 3D Printable Body - Shapeways
- Wheels - Pololu.com
- Motors 30:1 - Pololu.com
- Screws M1.6 - Pololu.com
- Plastic Threading Screws M1.91 or something to hold similar to hold the board onto the body.
- PCBs - I get mine from PCB way. - PIDDYBOT BODY PCB - PIDDYBOT ENCODER PCB
Step 3: Main PCB First(Surface Mount Soldering)
I like to start out by soldering the main board. Same as always, I do the smallest stuff first, resistors and caps, and the ICs and package components last.
You know the drill.
Do not populate F1 or D6. They're not in the BOM anyway.
Step 4: Main PCB Soldering (Through Hole)
After the board has been reflowed in the oven, or maybe soldered by hand(I used to do it this way!) - time to solder on the through hole components, battery connector, switch, and pots.
Step 5: Program Custom Bootloader and Test
Now that the main board is together, lets throw a bootloader on it and see if it works. The PIDDYBOT needs a custom bootloader, which can be found here, or in the GitHub Repo.
The file is called Caterina-PIDDYBOT.hex - I use Atmel Studio 7 and an AVR ISP MKII to put it on. There are a ton of tutorials on installing a bootloader on an Arduino. You can actually just use another Arduino to do it also, don't need a fancy ISP programmer. Slightly more info in the video.
Step 6: Solder Custom Encoders(Optional)
In order to send power to the motors, I have designed a smaller board which you can order as well. It also allows the use of the magnetic encoders on the wheels. The program as of yet does not utilize them(maybe in the future) but you might as well install them now, because I'm sure you will be improving the program the second you build the PIDDYBOT.
If you don't want to install these you can just connect the motors to the motor outputs on the PIDDYBOT.
Step 7: Install Encoders on Motor(Optional)
If you are installing the encoders, I find the easiest way to install them is to make a hole in a cardboard box and put the shaft of the motor through it to hold them vertical. Luckily I had my PCBway box handy.
Step 8: Assemble PIDDYBOT
Install the motors in the bottom with the M1.6 3mm screws and secure the PCB to the body with some plastic threading screws(or anything really, even an elastic band) the more secure the better. The PIDDYBOT might come apart in some violent balancing efforts if its not overly secure.
Step 9: Program PIDDYBOT With Arduino IDE
Now you can program the PIDDYBOT using the program I have supplied. Its available here, and on the GitHub Page.
Its pretty rough, but it will get him balancing! The atmega32U4 can be finicky when programming, and seem like its not working. It sometimes takes a carefully timed reset when programming.
Step 10: Look What You Have Made!
Step 11: Play and Learn!
I mention this in the video but I will write it down here.
When you first get the PIDDYBOT working, steps to starting it.
- Turn all POTs counter-clockwise (to zero)
- Turn on PIDDYBOT
- Immediately hit RESET so bottom LEDs turn off(Weird bootloader thing)
To start balancing, place PIDDYBOT on surface, and try and find the 0 angle position(standing straight up) with your hands, keep him there as you turn the P term up, he will begin trying to balance, you have now set the zero position. If it seems off, set all the POTs back to zero and try again.
Step 12: Not Quite the Robot Army Apocalypse.
These robots won't quite be taking over the world any time soon.
Step 13: Support My Projects!
If you would like to support my projects, Consider becoming a patron, subbing to my YouTube and following on Instagram. I would love to be able to rely on the support of my viewers, so I can keep creating free open source projects like this one.
Get notified the moment a new project comes out!
You can also send me bitcoins, here - 19s7hAVkm54Ev7QZEsWAfoyECy1CwXSrhL
We have a be nice policy.
Please be positive and constructive.
is there a schematic file for the circuit board