Biped Droid - A wireless controlled walking robot
Having made several robots that can walk, I thought I’d make the hardest one of all, a two legged droid. Moving several servo motors at once, whilst maintaining balance is quite tricky. You need a custom app to create the moves, and that’s what I’ve done in this project. If you’d like to know more, dig into the code to see how it’s done!
This project employs 11 servo motors, 5 in each leg, and one in its body to move the droids eyes. The microcontroller is an Arduino NANO EVERY, which has 50% more code space than a standard NANO and 3 times the RAM. I new I would need that extra space to store the servo movements. Between the eyes is a laser range finder, which give the droid an ability to react to object being placed in front of it. Leg movements and balance are quite complex, so I wrote a custom PC app which helped me to achieve this. The droid is controlled via a Wii nunchuk, over a 2.4 GHz wireless link. This in turn provides a bidirectional data channel for telemetry, enabling the movement app to work wirelessly. If you are planning to use the PCA9685 16 channel servo driver board in another project, you might like to try the app I wrote for controlling that too. Click the image to the right to watch a video of my droid in action -->
All of the droids components were produced in PLA on my 3-D printer, and modelled using the free design package from RS Components, DesignSpark Mechanical. For this design I also constructed an assembly of the complete robot, to ensure that all of the parts aligned. This included simple models of all bought components like the servo motors and driver board. Given the size limitations of my 3-D printer, the chassis consists of a number of parts screwed together using 2 mm countersunk screws. The top plate has compartments for the two batteries and apertures for socket strips to take the micro and Wi-Fi transceiver. A finned ring surrounds the body to protect it, if it topples over.
The lower legs consist of plates, to provide mounting frames for the servo motors, and joints for hip, knee and ankle movement. The use of screws makes it easy to maintain the droid, should you wish to disassemble it to replace a part or change its appearance in some way.
The droid is powered from two 18650 Lithium batteries, delivering 7.4v to the system. An On/OFF switch is mounted at the base of its body, feeding power to the top plate electronics and the PCA9685 servo driver board, mounted on the rear. Two push button switches sit either side of the micro, with the 2.4 GHz wireless transceiver mounted centre of the top plate. Shortly after power-up the droid code drives all servos to their vertical rest positions, allowing it to stand freely with low power.
Programmable RGB LEDs are placed in each eye, and 5 in a strip on its front. The colours provide feedback on the modes of operation, and the front LEDs are animated when the droid is in motion. The servo cables are kept tidy with special clips on the rear of each leg. The foot servos need extension leads in order to reach the PCA9685 driver board, as slack is needed when the joints move at large angles..
The circuit diagram for the droid is shown here on the left, with the NANO EVERY in the centre, connected to the RGB LEDs below, the VL53L0X laser range finder left, and 2.4GHz transceiver above. The I2C bus wiring on the left is taken to the PCA9685 servo driver board in the body, along with an MPU6050 motion sensor. As the servo motors are only rated up to 6v I have used diodes to drop the battery voltage fed to the driver board. A simple resistor network is used to enable the Arduino to measure the combined battery voltage, which should not be allowed to fall below 3 volts per battery; this is monitored in the code.
The wireless transceiver command pin is connected to the NANO so that the code can set up the device using AT+ command codes. By default it is set to 9600 baud, but needs to run at 115200 for move telemetry programming.
A critical step in building a project like this is in attaching the servo motors leavers and calibrating their respective angles, by recording and storing PWM values in code. To simplify this task I developed a 16 channel controller app which provides adjustable sliders for each servo. Values are then simply cut-n-pasted into your code. Then, as leg movements can be complex, having 5 servos in each, I developed a Move Trainer app which enables you to create a series of movement points through which all 10 servos can be driven. This links with the code in the project, which also allows for linear and non-linear movements, like acceleration and deceleration. Complex moves up to 100 leg positions can be created and simply cut-n-pasted into your code, and copied back into the app for further refinement. This process also works over the wireless interface, so the droid is not tethered by the USB lead. The third app works as a simple plotter of range v angle values obtained from the VL53L0X laser range finder. I hope you find them useful.
The following files can be downloaded to help you complete this project. Each has a hyper-link and an associated description. Depending on how your web browser is configured the links will either open the files directly into your browser or offer them as downloads.
Circuit Diagram - a drawing of what is seen in the view above. Use it as a guide to wiring up your project.
Wii Controller Diagrams - if you haven’t already made one on other projects this is the controller circuits and build.
Parts List - the things you will need to make the Biped Droid, with budget prices and suppliers.
Parts List - the things you will need to make the Wireless Controller, with budget prices and suppliers.
3-D Parts - images showing you what the 3-D parts look like and the associated hole sizes.
3-D Models - a zip file containing all of the STL files, which you can use with a slicer application.
Calibration - a pdf file explaining how to calibrate the 11 servos using the 16-channel controller to determine their PWM limit values.
Software Code - Arduino .ino files which run the project. Several folders, one for the droid, one for the WiFi Tx and one for 16-Ch Controller.
Apps Code - three Windows apps written in processing, compiled into 32-bit Java executable files.
Windows Apps - a pdf outlining the use of the three Windows apps which enables you to tune the droid and view data over Wi-Fi telemetry
This project relies on the use of three libraries, Wire.h, Adafruit_PWMServoDriver.h and Adafruit_NeoPixel.h which need to be in your IDE set-up. The Wire.h library provides the interface for Nunchuk I2C interface. Adafruit_PWMServoDriver.h is used to control servos connected to the PCA9685 driver board using I2C, and the AdaFruit_NeoPixel.h library provides functions for controlling the programmable RGB LEDs.
The following notes will help you understand how the files in this project work or can be used in principle. Each note has a bold heading for quick reference and they are listed in alphabetical order.
.ino File - the zip file contains several folders, which in turn contain the source code files. Therefore you will need to unzip it to use them.
3-D Models - the constructions of this design is based on the use of 3 mm and 4 mm nylon countersink screws, with the exception of the metal screws used to house the motors. This leads to a very clean shake-proof solution. You will need to use drills and taps to thread some of the holes.
Move Training - As this is the critical part of this project I designed a Windows based app, which makes the tuning of the PID variables very straight forward and something you can do in real time. Once you have arrived at a suitable set of values, for the size of ball you have chosen, you can then hard code them into the NANO code..
If you feel that I haven’t included enough information to allow you to tackle a project of this type then send me an email explaining what you need. Or if you just want to give me some general feedback on this site, or to suggest projects what I might include which would be interesting to you, I’d be pleased to hear from you.