Linux Format

Kit out your robot

There’s a whole world of weird and wonderful widgetry that can be fitted to your robot to add functional­ity and bring the fun!

-

give your robot sight “If camera flexibilit­y is required then a variety of pan-tilt kits are available for pitching, rolling and yawing to the ideal angle”

Asimple Pi robot needs little more than a chassis, power source and wheels. But things are more fun when you kit the base constructi­on out with some additional peripheral­s. We can use well-known Pi peripheral­s, such as the camera and the touchscree­n, in new and innovative ways, or we can use other items – sensors, speakers, servos and more – to really ramp up the excitement levels. Grab yourself a controller Controllin­g a robot via a web interface is all well and good, but even on a fast network you’ll experience some degree of latency, which will make driving a little haphazard. A wired controller will work reliably, but obviously this won’t be much use if you can’t keep up with your robot. With a Bluetooth controller, you can enjoy much more precise control of your robot friend. PlayStatio­n 3 joypads are very popular when coupled with the sixpair utility. See www.piborg.org/blog/rpi

ps3-help for details. There are a number of other options though, and many of them will work out of the box with Raspbian. Class 1 Bluetooth tooth devices in theory have a range of up to 100m, but these are subject to interferen­ce and dropouts.

Also, if you don’t have a Pi 3 or a Bluetooth adaptor then this isn’t an option anyway, so it may be worth considerin­g using an alternativ­e means of transmissi­on and reception. The go-to option here is to use radio frequency (RF) in the 2.4GHz band. This requires a more powerful transmitte­r, such as what’s used in drones and other radiocontr­olled aircraft. Fit a Pi Camera Whatever you want your robot to do, you can’t go too far wrong by giving it the gift of sight. This can easily be done with the Pi Camera board, available from all good maker shops. Launched in 2013, the Pi Camera Module was one of the first official add-ons for the Pi and has found its way into all kinds of amazing projects. A new eight-megapixel edition came out in 2016, and a mini-edition for the Pi Zero followed suit.

These cameras connect via a ribbon cable to the bespoke CSI interface, leaving the GPIO pins free for other gubbins. A mount is available so that the camera can be easily and securely attached to wherever it needs to go, and if flexibilit­y is required then a variety of pan-tilt kits are available for pitching, rolling and yawing to the ideal angle. There are also telephoto, fish-eye and wide-angle lens kits available. We saw on the previous pages how libraries such as OpenCV can be used to detect objects using camera input. If you want to incorporat­e the Pi Camera into your camera projects, then this one-liner will help you: $ sudo apt install python-picamera Add motion using servos Servos are motors ( actuallyac­tuators–Ed) that often have a limited movement range, for example, to move the rudder of a radio-controlled boat, but some can, or can be adapted to, do continuous rotation. Servos are controlled by pulse-width modulation (PWM). These pulses need to be pretty accurate, otherwise the servos will get confused. For example, a servo may have three different positions: left, up and right, say. The position is determined by the length of each pulse, a 1ms long pulse may indicate the left position, a 1.5ms pulse may stand for up, and a 2ms pulse may move it to the right. So there’s not much room for error. One of the Pi’s GPIO

pins is connected to a hardware pulse generator, so that these pulses can be generated without being interrupte­d, or elongated by a busy OS. However, sometimes one pulse generator isn’t enough and it’s common to add a HAT or other expansion board (possibly even a whole new microcontr­oller such as an Arduino) to handle multiple PWM devices. See how the UltraBorg can achieve this over a web interface at www. piborg.org/blog/build/ultraborg-build/ultraborge­xamples-web-ui.

Improved battery power

The Pi itself can distribute power to small devices through its GPIO pins. But these are limited to 3.3V and can carry very little current. So powering high-torque motors, lights or weapons ( saywhatnow?–Ed) through these, with the Pi connected to a standard USB power bank, isn’t an option. We’ve seen that the DiddyBorg gets its juice from 10 AA batteries But the current portable power trend is definitely lithium ion polymer (LiPo) batteries. They provide longer life and higher power than their nickel metal hydride (NiMH) brethren, and also hold a charge for longer.

Batteries will suffer voltage drops as they approach the end of their lives, and some components (not least of which is the Pi itself) are pretty sensitive to these. So one of the important tasks that the ThunderBor­g, which connects the DiddyBorg’s battery pack to the Pi, performs is regulating the power supply. If too low a voltage is detected when the board is powered, then it will duly switch itself off. Tim Freeburn told us a bit more about this stylish creation: “We’re very proud of ThunderBor­g. The wide voltage range was a key part of the design from early on. ThunderBor­g has a wide range of protection mechanisms such as undervolta­ge lockout, short circuit protection, thermal protection and overcurren­t protection. Thanks to this, it’s pretty hard to destroy one, as long as you make sure you connect the power supply the right way around!”

Ultrasonic sensors

Besides using a camera to assess its environmen­t, our robot can also be like a bat and use ultrasonic chirps to map things out. An ultrasonic sensor, such as the HC-SR04 emits periodic, high-pitched pulses that can detect as they bounce off nearby objects. By measuring the time between emitting the pulse and detecting its reflection, and knowing that the speed of sound is about 340 metres per second, the sensors can judge distance reasonably well. Our DiddyBorg came with a kit for mounting these sensors at each corner. You could use such a sensor array to automate parallel parking.

 ??  ?? We found this handy little Bluetooth gamepad discarded in a dusty corner at Future Towers. It came in surprising­ly handy for this feature.
We found this handy little Bluetooth gamepad discarded in a dusty corner at Future Towers. It came in surprising­ly handy for this feature.
 ??  ??
 ??  ??
 ??  ?? A LiPO battery is used to power this tiny UPS hat, so your Pi never runs out of power.
A LiPO battery is used to power this tiny UPS hat, so your Pi never runs out of power.
 ??  ?? The ThunderBor­g has a very bright and optionally colourful LED to gives a clear visual indication of battery status.
The ThunderBor­g has a very bright and optionally colourful LED to gives a clear visual indication of battery status.
 ??  ?? The DiddyBorg can be kitted out with four Ultrasonic sensors to let it know if obstacles are approachin­g.
The DiddyBorg can be kitted out with four Ultrasonic sensors to let it know if obstacles are approachin­g.
 ??  ?? Terrify your workmates by kitting your DiddyBorg out with a MeArm robot claw.
Terrify your workmates by kitting your DiddyBorg out with a MeArm robot claw.

Newspapers in English

Newspapers from Australia