Today we will have a look at a robot kit created by SunFounder. The Sloth is a bi-pedal robot based on the Arduino Nano. It utilises an ultrasonic module for obstacle detection and four servos for movement.
I found the kit to be an easy and fun build that took approximately an hour to complete. SunFounder have uploaded a YouTube video that serves as detailed introductions and assembly tutorial for the robot. It covers the entire assembly process, including the process to test the ultrasonic module as well as all the servos (before assembly), which is a good thing as one of the servos included with my kit turned out to be broken, but luckily I had a replacement servo on hand.
One thing to note is that the robot utilises two 18650 batteries, which after some research turned out to be commonly used in high-end flashlights and e-cigarettes, and are relatively pricey.
The robot can also be powered through the mini USB port on the Arduino (which I did while I waited for the batteries I had ordered to be delivered).
The code for the robot can be downloaded from here on the SunFounder website. Just note that the default code did not work for me as the ultrasound module did not detect obstacles. I rectified this by replacing the following code:
void loop() { int <span class="mceItemHidden" data-mce-bogus="1"><span class="hiddenSpellError" pre="int " data-mce-bogus="1">tooclose</span></span> = 0; // Define the test times, the initial value is 0 for(int a=0; a<5; a++) //for is a cyclical function and its cyclic times are determined by the second condition in the bracket. Here a<5, a’s initial value is 0. When a<5, run the program in the bracket. After running, a becomes a++ and it means adding 1 to a’s value. { delay(50); // Delay 50ms int din = sonar.ping_in(); // Call the ultrasonic transducer to read the distance that ultrasonic detected. if (din < 7 && din > 0) tooclose++; // The smoothing. The times add 1 when the detect distance less than 7cm and greater than 0cm. }
With this:
void loop() { int <span class="mceItemHidden" data-mce-bogus="1"><span class="hiddenSpellError" pre="int " data-mce-bogus="1">tooclose</span></span> = 0; // Define the test times, the initial value is 0 for(int a=0; a<5; a++) //for is a cyclical function and its cyclic times are determined by the second condition in the bracket. Here a<5, a’s initial value is 0. When a<5, run the program in the bracket. After running, a becomes a++ and it means adding 1 to a’s value. { delay(50); // Delay 50ms int din = sonar.ping(); // Call the ultrasonic transducer to read the distance that ultrasonic detected. if (din < 750 && din > 0) tooclose++; }
I really enjoyed assembling and playing with this little robot and would definitely recommend it to anyone interested in getting started in basic robotics.
Please, can you share with me the initial code for this robot? I lost it in a crashed server and now i can’t find it also on the site. Thanks a lot!
LikeLiked by 1 person
Hi Florina Anghel, It looks like they changed their website structure. New link is : https://learn.sunfounder.com/category/diy-4-dof-robot-kit-sloth/ .
LikeLike