Remote Controlled Robot

Recently, my ThunderBorg Kickstarter reward from PiBorg arrived, and not much later, DFRobot offered to sponsor a Devastator Tank Mobile Platform platform. The perfect opportunity to build a mean-looking, remote controlled robot!

Let’s take a closer look at the build.

Robot Platform

The robot platform for this project was kindly sponsored by DFRobot. It is the Devastator Tank Mobile Platform with metal gear DC motors.

The platform comes as a kit. All parts are neatly organised in labeled bags, which makes following the assembly instructions incredibly easy. Assembly took me about one hour, without the electronics.

This slideshow requires JavaScript.

The aluminium frame is sturdy, however, there was a bit too much slack on the tracks. I removed one link per track, which resolved the tension problem. The links are held together using pins, which can be pushed out using a small pointy tool.

Here are some pros and cons of the kit, based on my personal experience:

+ easy to build / clear instructions
+ sturdy, yet lightweight
+ plenty of mounting points
+ great torque

no tools included
not very fast

Motor Controller

The motor controller for this build is the ThunderBorg, by PiBorg. I backed the project on Kickstarter, and recently, my reward showed up 🙂

The ThunderBorg is a Raspberry Pi compatible, dual output motor controller capable of handling up to 5A per output. It supports a power input voltage between 7V and 35V, has an onboard RGB LED, battery voltage monitor and a 5V regulator used to power the Pi via its GPIO header.

This slideshow requires JavaScript.

There are some mounting holes at the back of the frame, with spacing matching that of the ThunderBorg and Pi Zero. Using the nylon spacers provided with the ThunderBorg, both are easily mounted.

Because of the supported input voltage range of the ThunderBorg, I decided to use a 10.8V cordless drill battery. It’s small enough to fit inside the frame and delivers plenty of power.

As for the software, the installation of the ThunderBorg code is a breeze, requiring only a single command to be executed after having set up the Pi with the latest Raspbian:

Plenty of code examples are provided, allowing you to get started immediately.

Wireless Gamepad

All that is left to do is to ensure we can control the robot. To do this, I’ve chosen to use a cheap BlueTooth gamepad, the 8Bitdo Zero.

This slideshow requires JavaScript.

The PiBorg website has a great tutorial on getting a BT PlayStation 3 controller to work, which can be applied in this case as well.

Here’s my summary of the commands:

Once scanning is enabled, and the controller is on, it should be detected and its MAC address displayed. That MAC can then be used to pair the controller to the Pi.

The controller should now be able to automatically pair with the Pi, even when rebooted.

Finally, to test the controller is properly detected, the “jstest” command can be used. Pressing buttons should trigger changes in the output on screen, giving you the ID of the buttons or axes.

Code

With all components connected, installed and tested, it’s time to combine them with code.

The code is a slightly modified version of the tbJoystick PiBorg demo:

  • modified voltages specific to my motors and battery
  • remapped some controls to match my controller
  • added shutdown button, making it possible to perform clean shutdown of the robot
  • added turbo button, giving the robot a brief power boost

The resulting code capable of controlling the robot via the little gamepad:

Why stop there, though? The frame has so many mounting points, you could expand the code to add sensors, a camera, LEDs, etc …  It’s up to you!

The final step is to start the script at boot by adding a cron job:

All done! Time to have fun with the robot! 🙂

4 thoughts on “Remote Controlled Robot”

Leave a Reply

Your email address will not be published. Required fields are marked *