As a side project to my full-time job other colleagues and I are each individually designing and building a robot with the purpose of playing football on a table tennis table. In the future we are planning to make a bigger event out of this idea similar to the RobotCup events.
As a competitive person I directly developed ambitious plans and decided to design, build and develop an autonomous robot from scratch.
You can follow my progress on this page.
Part 1: Planning
My self defined goal is to develop an autonomus robot from scratch with four independently steerable wheels. However, it would not be sensibel to directly reach for the desired goal as with these kind of projects a lot of problems are hidden in details. Therefore, I decided to work my way to the goal in several steps.
My first goal will be to develop a remote controlled robot using my FrSky Transmitter of my drones as a controller and using a compatible receiver on the robot. This will allow me to test the robot’s design and code without worrying about the robot’s sensors for now.
If this is successful sensors and a second microcontroller will be added which will sense the robot’s environment and act accordingly by sending control signals to the first microcontroller in the same way as the RF receiver sends signals. This will allow me to easily switch the robot from autonomous to non-autonomous mode and back.
All parts of the robot will be 3D printed with an Ender 5.
As a first step I researched a list of parts and came up with this list:
- Teensy 3.6 (Microcontroller)
- MP1584EN DC-DC Buck Converter
- LM2596 DC to DC Voltage Regulator (with LCD)
- 7.4V 2200mAh LiPo
- DRV8833 Dual Channel H-Bridge
- 6V Geared DC Motor (1:48)
- Parallax 360 Feedback Servo
- FrSky XM+ Receiver
These will be my main parts for building the RC controlled robot.
However, as my budget is limited I had to settle for only two instead of four of the Parallax 360 Feedback Servos as these are quite expensive. Nonetheless, these are the perfect fit for my purpose as they allow continous rotation and are giving feedback of the current position which allows me to steer the wheel in any direction without locking at a certain angle. Though, the documentation of these servos is very minimal and not many people have successfully used this type of servo with a microcontroller as they are part of Parallax’s own robotics platform. Hence, I will need to develop my own library for these servos which can be used with a Teensy board.
To compensate for the two missing servos I will need to adapt the design. Therefore, the first prototype will only have two individually steerable wheels which will allow me to test my own library for the servo motors.
Part 2: Design
The robot will be fully 3D printed using PLA for solid parts and TPU for elastic parts.
The most difficult part of the design is the construction of the steering mechanism.
To keep it simple I decided to use M8 screws as axles. These will be attached to the DC motor which drives the wheel and a pulley. Using the pulley the whole axle including the DC motor and the wheel will be rotated with a timing belt which is connected to one of the servo motors. To allow smooth steering the axle will sit on a 608 bearing which will be inserted in the axle holder while printing. In a similar way I will insert M8 nuts into the DC motor mount and the pulley to make them sit tightly on the M8 screw.
The timing belt will be printed in 95a TPU to allow flexibility but not too much stretch.
The outer shape of the robot will be a simple box with slightly inset mids to make driving with a ball in front of the robot easy. To minimise the weight the outer box will be printed with gradual infills and a minimal amount of wall layers. Though, I am adding additional layers around screwholes to make these areas more robust.
All parts have been designed in Rhino 3D, sliced in Cura and printed on an Ender 5.
Part 3: Code
The code for the microcontroller turned out to be a bit more challenging than originaly thought.
This was mainly for the reason that the Parallax 360 Feedback servos are typically used with Parallax’s own robotics platform and are not well adopted in the maker scene.
Therefore, I had to create my own library for this servo which supports multiple servo instances. While doing this I also included a PID loop which allows to precisely rotate to a certain setpoint (angle) and hold this angle by constantly calculating an error value and responsively apply correction until another input follows.
During the development I also experimented with the multithreading capabilities of the Teensy platform. However, I decided to not use it as the time-slice based multithreading did not allow me to call the PID Loop in an exactly timed intervall which is crucial for its working.
My current control code implements only the basic functionality of driving forwards, backwards and steering. For the future several different modes will be added like Tank mode, a steering limiter and two different spinning modes to make shooting a ball easier.
My whole code will soon be available on my GitHub. In addition, I will publish my Parallax 360 feedback servo library for teensy boards with an opensource license as soon as I find time to clean up the code and write a proper documentation.
The code has been developed using Visual Studio Code and PlatformIO.
Part 4: Prototype Build
After the design was finished, the parts printed and the code was written and tested with a breadboard and individual parts, I started to to put everything together.
The microcontroller and H-Bridges were soldered on a PCB board and I used xt30 plugs to attach all the components to make swapping components easy. Then I setted up all the voltage regulators and isolated all electronics. Finally I placed everything in the robotshell and fixed all parts accordingly. In doing so, I realized that I definitely have to work on my wire managment to make sure that no wire is getting in contact with moving parts.
Nonetheless, I was ready for my first test drive.
The first test drive made some problems obvious which I will fix in the next iteration.
Notes of first test drive:
- Make wireshields on the DC motor mounts so the wires will not get in contact with the wheels
- Create suspension wheels to allow the robot to adapt to small tolerance differences which otherwise would cause some wheels to be slightly higher than others.
While I am developing the prototype I am already planning for the autonomous robot.
The most important parts for the autonomous robot are the sensors which allow the robot to sense its environment and recognize a table tennis ball.
For recognition of objects the best sensor is a camera which feeds into an image processing algorithm.
The easiest solution would be to use a Nvidia Jetson mini which is easily capable of these tasks or a Raspberry Pi. However, the power consumption of single board computers is quite high and makes it hard to run them from a battery. Therefore, I looked out for microcontroller based systems. With MicroPython and Tensorflow light it is possible to run small scale AI models on microcontrollers which allows it to run a very impressive object detection and tracking system on a microcontroller.
The two biggest projects in this field are the Pixy camera module and the OpenMV system. Because the OpenMV system is fully opensource and also offers great documentation I decided to settle for this system.
I will update this if I have finished experimenting with the OpenMV system.