Introduction: Balancing Robot / 3 Wheel Robot / STEM Robot
We have built a combined balancing and 3 wheel robot for edcuational use in schools and after school educational programmes. The robot is based on an Arduino Uno, a custom shield (all construction details provided), a Li Ion battery pack (all construction details provided) or a 6xAA battery pack, a MPU 6050, a BLE bluetooth module, an ultrasonic module (optional) and a servo to move an arm. There are also extensive education material available ready for use in class rooms.
The attached document is the instructions given to kids to build the robot in a series of steps which provide educational learning at each step. This is the document provided to schools and after school programmes.
There are 7 exercises which can be done before the full balaning / 3 wheel robot sketch is uploaded. Each of the exercises focus on a particular aspect of the robot, e.g. the accerometer/gyroscope sensor, interacting with a smart phone app using bluetooth, the ultasonic sensor, the servo etc. The exercises are integrated into the physical construction of the robot, so when enough of the robot has been constructed to do an exercise, the sketch for the exercise can be uploaded and done. This helps to focus the fun of building the robot with educational learning.
It was decided to use an Arduino Uno becasue is it extremely common and used in many educational setings. We have also used, other than the shield, standard of-the-shelf modules which are readily available. The chassis is 3D printed and the design available on TinkerCAD.
We have also found that this robot helps to inspire and provide confidence in kids to think about building their own creations and that it is not difficult to do so.
All the sketches are well commented and more advanced students can modify or write their own sketches. The robot can form a general platform for learning about the Arduino and electronics.
The robot also works with the "LOFI blocks" app ( https://lofiblocks.com/en/ ), so kids can write there own code in a graphical environment similar to SCRATCH.
Note the video above shows the mark 1 model, the robot now uses the RemoteXY bluetooth app (which is available for both Andriod and Apple devices), the MPU 6050 is now located on the robot shield (not in the slider at the bottom of the robot - although you can still locate it there if you wish) and has an optional ultrasonic sensor which can be plugged into the shield.
(1) pitch angle and PID control is based on software by Brokking: http://www.brokking.net/yabr_main.html
(2) RemoteXY app: http://remotexy.com/en/help/
(4) arms based on jjrobots: https://www.thingiverse.com/thing:2306541/files
(5) all sketches are stored on Arduino Create: https://create.arduino.cc/
(6) 3D designs are stored on TinkerCAD: https://www.tinkercad.com/#/
Disclaimer: This material is provided as is, with no warranty of the correctness or otherwise of this material. Use of the 3rd party iPhone and Android apps named in this document is at the users own risk. The robot can use a Lithium Ion battery pack, use of the battery and power pack is at the users own risk. The authors assume no liability for losses suffered by any person or organisation using this material or from building or use of the robot.
Step 1: Parts List
To make the robot from scratch, there are many steps and it will take quite a lot of time and care. You will need a 3D printer, and be good at soldering and construction of electonic circuits.
The parts required to make the robot are:
(1) 3D print the chasis and caster wheel extension
(2) Arduino Uno
(3) Build the robot shield
(4) MPU 6050, AT9 BLE Bluetooth module, optional ultrasonic module (all plug into the shield)
(5) SG90 servo
(6) TT motors and wheels
(7) Build the power pack (either 6xAA battery pack or Li Ion battery pack)
The attached file explains how to obtain and build all the parts except the Li Ion power pack and the robot shield, which are covered in the next steps.
Step 2: Robot Shield
The PCB design for the robot shield is done in Fritzing, attached is the Fritzing file if you wish to modify the design.
Also attached are the gerber files for the shield PCB, you can send these files to a PCB manufaturer for them to manufacture the shield.
For example, the following manufacturers can make 10 x PCB boards for around $5 + postage:
Also attached is the make document for the shield.
Step 3: Power Pack
You can build either a 6xAA-battery pack or a Li Ion battery pack for the robot. The instructions for both are attached.
The AA-battery pack is much easier to construct. However the batteries only last approx 20/30 minutes before needing to be replaced. Also the servo cannot be used with the AA-battery pack so there is no moving arm.
The Li Ion battery pack can be recharged and lasts approx 60 plus minutes between recharges (depending on the capacity of the battery used). However, the Li Ion battery pack is more difficult to build and uses a Li Ion battery, Li Ion batteries needs to be handled with care.
The Li Ion battery pack includes a protection circuit, which protects the battery from over and under charge and limits the max current to 4 Amps. It also uses a Li Ion charging module.
You could use any Li Ion battery pack which has an output of approx 7.2 volts, but you would need to make up a cable with the appropriate robot shield plug.
Let me know if you have a good alternative power pack. The reason why I have made up this Li Ion pack is that it uses a single Li Ion cell which means it is relatively small and can be charged from any micro USB charger or from any USB port including a computer. Li Ion power packs I have seen around 7.2 volts use 2 cells and require a special charger, which increases the cost and isn't as convenient to charge.
If you choose to build the Li Ion battery pack (or use any Li Ion battery pack) you should be aware of the safety issues with such batteries, e.g. https://batteryuniversity.com/learn/archive/lithiu...
Step 4: Robot Exercises and Sketchs
Once you have obtained all the parts, as you construct the robot you can do programming exercises along the way if you want to. These exercises along with explanations are available on Arduino Create – the links below take you to the Arduino Create exercises – you can then open and save the exercise in your Arduino Create login.
To upload sketches to the robot make sure your phone is not connected to the robot by Bluetooth - a Bluetooth connection prevents uploading occurring. Although generally not needed, the pin for the Bluetooth module is 123456.
Exercises 3, 5 and 7 use the "LOFI robot" smart phone app (or the "BLE joystick" app - although this app doesn't always work with Apple devices).
Exercies 8 (the full robot sketch) uses the “RemoteXY” smart phone app to control the robot.
The LOFI Blocks sketch uses the "LOFI Blocks" app. (note this app works best on Apple devices).
When you load an exercise into Arduino Create, in addition to the arduino sketch, there are a number of other tabs which provide information about the exercise.
Exercise 1: Arduino Basics –blink the LEDs on the robot control shield red and green. You can do this exercise after Step (3) in the construction.
Exercise 2: Gyro Sensor – getting familiar with gryos and accelerometers. You can do this exercise after Step (4) in the construction. You need to use the “Serial Monitor”, with baud rate set to 115200.
Exercise 3: Bluetooth Link – establish a Bluetooth link, use a smart phone app to turn on and off the LEDs on the robot control shield. You can do this exercise after Step (5) in the construction.
Exercise 4: Ultrasonic distance sensor (optional) – getting familiar with the ultrasonic sensor. You can do this exercise after Step (5) in the construction. You need to use the “Serial Monitor”, with baud rate set to 115200.
Exercise 5: Servo-mechanism – getting familiar with the servo mechanism and moving the arm, use a smart phone app to control the angle of the servo arm. You can do this exercise after Step (8) in the construction. You need to use the “Serial Monitor”, with baud rate set to 115200.
Exercise 6: Drive motors – getting familiar with motors, run the drive motors forward and backwards. Needs the battery pack to be switched on. You need to use the “Serial Monitor”, with baud rate set to 115200.
Exercise 7: Basic Car – build a simple three wheel car (robot with 3rd wheel attachment), we use a smart phone app to control the car. Also uses the ultrasonic sensor to follow your hand. You can do this at the same point in the construction as above. Needs the battery to be switched on and insert the 3rd wheel attachment.
Exercise 8: Full balancing robot – the code for the full balancing / three wheel robot. Use the smart phone app “RemoteXY” to control the robot.
LOFI Blocks Sketch – to use the "LOFI Blocks" app upload this sketch into the robot. You can then programme the robot using the "LOFI Blocks" app which uses programming blocks similar to SCRATCH.
Step 5: Balancing Robot Maths and Program Structure
The attached file gives an overview of the maths and software structure of the balancing part of the robot.
The maths behind the balancing robot is simpler and more interesting than you might think.
For the more advanced school students it is possible to link the balancing robot maths, to the mathematics and physics studies they are doing at high school.
In mathematics the robot can be used to show how trigometry, differentiation and integration are applied in the real world. The code shows how differentiation and integration are calculated numerically by computers, and we have found that students get a deeper understanding of these concepts.
In physcis the accelerometers and gyroscopes provide insight into the laws of motion, and a pratical understanding of things such as why accelerometer measurements are noisy and how to mitigate such real world limitations.
This understanding can lead onto further discussions for example, PID control and an intuative understanding of feedback control algorthms.
It is possible to incoroporate the building of this robot into the school curriculum, or in conjunction with an after school programme, from primary through to high school level students.
Step 6: Video Streaming Camera Accessory
We have created a raspberry PI based video camera which can be attached to the caster wheel extension to the robot. Is uses WiFi to transmitt the streaming video stream to a web browser.
It uses a separate power supply to the robot and is a standalone module.
The file provides the make details.
As an alternative, other standalone video streaming cameras such as the Quelima SQ13 could be attached to the caster wheel extension, e.g.: https://www.banggood.com/Quelima-SQ13-Mini-HD-1080...
Step 7: Using N20 Motors Instead of TT Motors
It is possible to use the N20 motor instead of the TT motor.
The robot runs smoother and goes much faster with the N20 motor.
The N20 motors I have used are 3V, 250rpm N20 motors, e.g.
The N20 motors are not as robust and don't last as long, perhaps 5-10 hours of use.
The N20 motor requires you to 3D print the N20 motor mounts, and there is a wheel insert in enable a TT motor wheel to fit the axial shaft of the N20 motor.
The N20 motor mounts can be found by searching for "balrobot" in the tinkerCAD gallery.