Can I Hack… a toy robot?

Pi Wars takes place every year in Cambridge, and there one can see robots of all shapes and sizes do battle in the arenas and courses created by the Pi Wars team. Trust us, it's fantasic. Robots are cool, but you don’t have to start from scratch. There are so many on the market, so we popped a cheap robot into our shopping basket. Just how easy are they to hack, and can we use them in a project? Well, there’s only one way to find out. Let’s take one apart!

Made of a thin, slightly pliable plastic, the upper outer shell can be easily worked with conventional hand tools. The upper part of the robot chassis also features two smoked plastic lenses, used to decorate the robot and provide a diffusion for two blue LEDs inside the ‘head’. At the front of the head are two infrared sensors used to detect objects. The lower part of the chassis is a slightly firmer plastic, equally pliable, and can be worked with hand tools. On the bottom of the chassis we see an access port, which one would suspect would house a battery. Unusually, this port covers a small DC motor, which is one of two motors that provide movement for the robot.

The robot has a caterpillar/tank track used to drive it across most surfaces. Each motor provides power to a single track via one central wheel, while the other wheels merely move due to the teeth present in the track, catching the teeth in the cog-like wheels. The tracks themselves are a flexible rubber-like plastic that fits securely around the wheels.

So how can we take it apart? Well, firstly remove the security screws from the underside of the chassis. These screws are the same as those found on McDonald’s toys. Next, remove the same security screws from the wheels. Now, move to the upper part of the chassis and using a ‘spudger’, or flat screwdriver, pop out the smoked plastic from the sides of the robot head. On one side of this you’ll see revealed two cross-head screws; remove these and you are safely inside the robot.

Can I Hack Motors

Power

Charging the robot is easy, largely thanks to a built-in USB A male connector. This plugs in to any spare USB port and takes around an hour to charge the 70 mAh 3.7 V lithium polymer battery. The battery gives the robot around 20 minutes run-time. There is a charge control circuit built in to the main circuit for the robot.

Electronics

Our robot has multiple modes. Mode 1 enables the robot to detect the surroundings using the infrared sensor. Mode 2 uses sound and light sensors to detect a person or torch light and follow the sound/light. The third mode uses the included controller, along with an app on our phone, to control the robot. The controller sends signals via infrared pulses, so when a control is pressed on the mobile device, the appropriate signal is sent to the robot using the two IR LEDs in the controller.

Inside the robot is a custom circuit board, which has a central chip that has been unhelpfully covered in epoxy resin, so we cannot identify the chip used. But all hope is not lost, as all of the pins from the chip are broken out to test points around the board, so those with a steady hand and an oscilloscope can dig deep into the chip and learn its secrets. Two of the most obvious connections are those for the motor and these are at ML+ and ML– for the left motor; MR+ and MR– for the right. These connections go directly to the DC motors in the lower part of the chassis and, as the motor can be controlled in two directions (forward and backwards), we can conclude that there is a motor control chip with an H bridge, a chip that enables the polarity of the motors to be switched on command.

Can I Hack Circuit Board

Also present on the board are two connections for the attached speaker, used to generate pleasant beeps for our happy robot. But hidden on the underside of the board is something unexpected. Under the robot is what looks like an I2C connection – it has the usual VCC and GND, and SDA, but rather than SCL (clock), we have SCK, which we assume is a reference to clock. So what does this mean? Well, connect this up to an Arduino and start sniffing the I2C bus to see what information goes to and from the robot.

Conclusion

This is a fun little robot to hack. It has been built with modular components and a sensible circuit board that enables us to poke around and learn all about it. Sure, the chip may be hidden under epoxy, but we can still use the test points to understand the various functions of the robot. Using an Arduino or another device with I2C, we can see deep into the robot and learn how it’s controlled. There’s even the possibility of controlling the robot using this method.

If we removed the custom circuit board, then there is space for a small Arduino clone board; in this case 4tronix’s 4duino Mini Pro would be an excellent choice, as it has a built-in DRV8833 motor controller. Taking the guts of this robot, we can also repurpose the app and controller to control other devices; for example, a relay to control much higher voltages (obviously only if you know how!) or use the sensors to trigger alarms.

More features from HackSpace magazine

Subscribe