Exhibition / Gallery
Topic: SlothPorter Build
(Read 2498 times)
Jan 18, 2014, 08:11 am
: Jan 19, 2014, 07:11 am by negativepitch
SlothPorter Self-Balancing Robot Build
I recently got into the world of Arduino after hearing various people praising its abilities. This is my first Arduino project . I chose a self-balancing robot because I wanted to learn about how to use the Arduino to control motors and receive gyroscope and accelerometer readings. After doing a little research into the Arduino projects people had created, I decided that a self-balancing robot was the right degree of difficulty and would be the most fun to create. It turned out to be more difficult and more fun than I had imagined!
I give you, the SlothPorter:
Here is a list of all the compenents I used to build the SlothPorter:
Clamping Hub (X2)
Hub Adapter (X2)
Capacitor for Motor Controler (X2)
Motor Bracket Screws (X12)
Blue Tooth Module
Any 9V Battery
I started this project by purchasing two motors, the necessary mounts, a motor controller, a battery, and 4 acrylic sheets. Since I didn't know how much room I would need for the other components, I didn't cut the 12x12 acrylic sheet that I'd be mounting everything on. I first installed the motors on one acrylic sheet.
Then I added the wheels and wired the Pololu motor controller to my Arduino and a 12V battery and downloaded the Pololu_Arduino library (
). I began to learn how to run the motors forward and backward and at different speeds.
After I had learned the basics of motor control, I purchased a 6 DOF (degree of freedom) IMU from Sparkfun and spent some serious time learning how to get the Arduino to read in the values and interpret them in such a way as to produce the estimated angle at which the SlothPorter was leaning. This site, http://bildr.org/2012/03/stable-orientation-digital-imu-6dof-arduino/, proved indispensable and incredibly educational regarding the setup of the IMU with Arduino. I used the FreeSixIMU library provided there to calculate the angle.
Now it was time to test motor control based on orientation. I combined the IMU and motors to try to develop code that would drive the motors at a speed proportional to the angle relative to zero.
I was left with a very rough version of a self balancing robot, and it was time to assemble the rest of the SlothPorter. I was very fortunate in that the school I attend has unlimited free access to 3D printers. So I printed my handlebar mount, handlebar-posts mount, IMU mount, motor controller mount, and the Arduino board mount. I was able to download the print files for the Arduino board, but the other parts I designed myself.
Motor Controller Mount:
Arduino Board Mount:
Printing Handle Bar Mount
The components were organized and mounted on the acrylic sheet. Then I cut the walls of acrylic out making them 3 inches tall all the way around. Then another 12x12 sheet was placed on top so that I had a short box. I tapped holes for some 6-32 hex screws and assembled. Then I added the handlebars and mounts and lastly the sloth.
Now I was ready for PID tuning. In fact, the majority of this build has been playing with the PID values and trying to get them right. I still don't have them where I know they should be but it's close for now. Once I had the SlothPorter balancing like I wanted, I added a Bluetooth module to the Arduino board and installed a simple Bluetooth controller app on my phone. Basically the Arduino listens for two values, one corresponding to forward, and one to reverse. When forward is pressed, the code adds 1 to the previous set angle (the angle it's trying to maintain, initializes at 0 degrees). This means that the SlothPorter is slow to react and difficult to control. Since it was too hard to slow down quickly because reverse would have to be hit quickly multiple times, I set the "Start" button value to reset the set angle to 0. This allows the sloth porter to be quickly slowed down. I'll attach my Arduino code which I know would give real programmers a headache. But this is not in it's finalized version as it can't yet turn and the PID values still need to be tuned. Here's a video demonstration:
If you have any questions or suggestions please let me know
downloaded 103 times
learning never stops.
Re: SlothPorter Build
Jan 19, 2014, 06:04 am
That was a very nice posts, especially for a first post.
I like your attention to asthetics. Smokey/Clear acrylic and the Stuffed Sloth are really engaging.
Thank you for sharing so many details.
Quiero una vida simple en Mexico...nada mas.
Re: SlothPorter Build
Jan 19, 2014, 06:44 am
ODwyerPW, thank you for your kind words. This was my first post but definitely not my first use of these forums. The majority of my learning took place here by reading through other peoples experiences and suggestions. This thread in particular was very helpful: http://forum.arduino.cc/index.php?topic=8871.0 If anyone needs help or has any questions about building a self balancing robot, I'd be happy to share any knowledge I gained from my build.
Warning Novice on board! 0 to 1 chance of errors!
Re: SlothPorter Build
Jan 20, 2014, 12:31 am
Excellent build and thanks for sharing so much information! I really like the idea of the stuffed animal riding the robot!
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com