Tag Archives: Robotics

Balance your robot with a Raspberry Pi

You may have seen the amazing two-wheel scooter, the Segway Human Transport system. It has only two wheels, a platform for a person to stand and a handle to guide the vehicle. The scooter operates on batteries located under the platform and between the wheels. Dean Kamen is the inventor of this amazing transporter, which can carry a person around while balancing on its two wheels without toppling over.

After watching the amazing Segway scooter, Mark Williams tried his hand at balancing a two-wheeled robot using the tiny credit card single board computer, the Raspberry Pi or RBPi. You can watch his success in the video clip here – it is almost like watching a human baby learn to take its first tottering steps.

Mark’s PiBBOT, or Pi Balancing roBOT, carries its own power source and the electronics, but unlike the Segway, does not have room for a passenger. The TFT displays the angles from the accelerometer, the gyro, the complimentary filter and the power drawn by the motors. There are two buttons on the top – one for turning on/off the motors and the other for resetting the gyro.

The PiBBOT uses the concept of an inverted pendulum to work. This is similar to how children balance a vertical stick on a finger on their outstretched hand – they move in the direction the stick is about to fall, thus attempting to keep its center of gravity below it. The balancing robot keeps itself vertical by using a control algorithm called PID or Proportional Integral Derivative. It does this by trying to keep the wheels under its center of gravity. Therefore, if the robot leans forward, the wheels carry the robot forward, trying to correct the lean. As the bottom of the robot moves forward, inertia keeps its top in the same place, thus righting it.

PiBBOT has an accelerator and a gyroscope to measure the angle of its lean. One axis of the accelerometer measures the current angle, while one axis of the gyroscope measures the rate of rotation. A well-timed software loop running in the RBPi keeps track of both. The RBPi makes calculations based on the measurements to provide power to the motors via the PWM. The RBPi must move the motors in the right direction to keep the robot upright.

Accurate angle measurements need readings from both the accelerometer and the gyro, which are then combined. Individual readings do not provide the necessary accuracy. The gyro measures the rate of rotation and requires to be tracked over time for calculating the current angle. The tracking usually includes noise, which causes the gyro to drift. However, gyros are useful for measuring quick changes in movement.

Unlike a gyro, accelerometers do not need tracking and they can sense both static positions as well as sudden movements – with gravity defining the static position of the robot. However, accelerometers are notorious for their noise levels. Both gyro and accelerometers perform well over certain sensitivity levels.

Mark is using a measurement range of 250dps with a sensitivity of 0.0875 dps/LSB for his gyro. For his accelerometer, he is using 8g full-scale, corresponding to 4mg/LSB and a full scale of 10. Read the full details here.

Rapiro the Customizable Robot with Raspberry Pi

If you have a kid aged 15 or above with a Raspberry Pi and he is clueless about his next project, Rapiro, the customizable robot may be very suitable for him. Designed for the tiny credit card sized single board computer, the Raspberry Pi or RBPi, Rapiro is a humanoid robot kit. It is an affordable kit and is very easy to assemble, needing only two screwdrivers. With an Arduino compatible controller board, the kit comes with 12 servomotors and limitless possibilities.

Even if you are not a programmer, Rapiro is easy to assemble and set up. The assembly instructions are simple and given in a step-by-step method, so anyone can follow them. Rapiro’s controller board is pre-programmed, so that Rapiro will come alive as soon as you have finished assembling it. However, if you are a programmer, you could make Rapiro sweep your desk or have him dance to a tune. For this, you will need to use the Arduino IDE to reprogram Rapiro.

Rapiro is highly customizable. Limited only by your imagination and the sensors you have at hand, simply install the RBPi board and go on expanding the capabilities of Rapiro. For example, you can add image recognition, Bluetooth, Wi-Fi and anything else you can think of to make Rapiro livelier.

Rapiro has 12 servomotors to make it move. There is one servomotor in its neck, one in its waist, two each in its feet and three each in its two arms. There are six servos in its neck, waist and feet have a torque of 2.5kgf-cm each. The servos in its two arms have a torque of 1.5kgf-cm each. The operating speed for all the servos is 0.12sec/60° and the maximum angle they can move through is 180°.

You can program it’s eyes to give its face a full and colorful expression. Its eyes are made of bright LEDs, which can be programmed for different colors as they are of the RGB type. Plastic parts of Rapiro suit both models of RBPi – A and B. With small modifications, Rapiro can accommodate RBPi model B+ as well.

Rapiro’s controller board is very similar to an Arduino board and you can program it using the Arduino IDE. Anyone familiar with C++ development environment can use the Arduino IDE to program the 8-bit AVR based micro-controller on board Rapiro. However, that does not mean only those with programming skills can work with Rapiro – beginners can also learn how to program.

Once you have installed RBPi inside Rapiro, you can make it do more functions. With RBPi, you can use your favorite programming language on Linux to program Rapiro. For example, you could program Rapiro to watch over your home while you are away and to keep in touch by sending you text messages over Wi-Fi. You could have Rapiro acting as a security robot for your house if you give it vision by installing a camera module.

Rapiro requires five AA Ni-MH batteries to function. You can replace this with an AC adapter also. For transferring data, you will also require a USB cable to connect Rapiro to your PC.

BrickPi to Turn Your Raspberry Pi Into a Robot

It is easy to turn your tiny Single Board Computer, the Raspberry Pi (RBPi), into a robot. All that you need is a BrickPi board and a case that will fit onto your credit card size computer and make it capable of accepting inputs from sensors, to running motors and other parts. With the BrickPi, you can drive up to four EV3 or NXT motors and five sensors. A 9V battery powers the board and drives the motors and sensors, including the RBPi. While the sturdy case that holds the RBPi, has holes that can snap in LEGO parts, the LEGO Mindstorms’ BrickPi board untethers your RBPi from the wall outlet.

For programming the BrickPi, you have a choice from among three languages – Python, C and Scratch. If you need information on using these languages, visit the github site. It includes examples and drivers as well, including several projects that setup the BrickPi and demonstrate its use. The projects involve demonstrations of controlling the robot with web services such as Twitter, SSH and other web pages. Apart from the program listing for running these projects, the site includes Bill of Materials for the LEGO parts that the robots will need to use.

While the BrickPi controls the sensors, the LEGO motors and the new EV3 motors, the RBPi, in turn, controls the BrickPi. You can power the BrickPi with an on-board 9-12V battery pack, which will also supply the RBPi, the sensors and the motors. The design of the BrickPi is entirely open-source, so anyone can see the design and other details of the firmware design.

Creating a robot with the RBPi and BrickPi is indeed challenging, but not too difficult, since there are plenty of examples and drivers available. Once you have mastered the basics, you can progress to the more advanced creations. Using the LEGO elements makes the job even simpler and you can simply watch your computer come alive.

The BrickPi, controlling the four servomotors, offers precise control over the robot, ensuring that the robot moves with precision. The built-in rotation sensors can measure steps with on-degree accuracy. Among the other sensors is an ultrasonic sensor, to allow the robot measure distances and avoid obstacles. Two additional vision sensors allow the robot to sense and detect movement.

The BrickPi even has two touch sensors, with which your robot can pick things up on command, since they can detect when they are releasing or pressing something. For example, the touch sensor, when pressed, can allow your robot to talk, walk, turn off your TV or close a door. In addition, the included color sensor can be used either as a color lamp, distinguish light settings, detect black and white or distinguish a range of bright and paste colors.

Overall, the clever design elements in the BrickPi score an excellent rating. Users will enjoy the way it brings a new level of interaction to their experience of using LEGO parts and will appreciate the easy way of creating their first robot. The simplicity of building any robot from the cool hardware encourages inventive play.

What is an H-Bridge?

Those who are into robotics know that robots, just as humans do, also need to suddenly change course when they run into an obstacle in their path. Changing course while walking may not be a big deal for humans, but for robots, and especially for those who design them, it is sometimes a serious challenge.

For example, consider a robot that is moving towards an obstacle, which it has to avoid and proceed on a parallel path. A robot with two wheels will need to stop moving as it reaches the obstacle, then pivot on one wheel by a certain angle and move forward until the obstruction no longer bars its way. Then it has to stop again, pivot back on the other wheel by the same angle it had turned earlier and move forward. If the robot is required to go back to its original track, it has to pivot once again. The entire exercise gets more complicated if the robot has more than two wheels; clearly, robotics is not for the faint-hearted.

Most movements in robotics involve DC motors and moving a robot backwards requires the DC motor to run in reverse. This is accomplished by switching the connections of the motor to its power source so that it now connects in a way opposite to its normal manner. Doing this causes the current flow in the motor to reverse, making it rotate in the opposite direction. However, it is impractical to manually disconnect the wires of several motors and reconnect them in a moving robot. That job is best left to H-bridges.

An H-bridge is a circuit that looks very similar to a capital H. It has four switching elements at its corners, with the motor forming the cross bar. The only difference are the top and bottom bars – these are not part of the alphabet H. Traversing clockwise, the four switching elements are called – high-side left, high-side right, low-side right and low-side left. The top bar connects to the positive terminal of the power supply/battery and the lower bar connects to the ground or the negative terminal of the power supply/battery.

You run the motor by turning on a pair of switches. For example, if you turn on the switches high-side left and low-side right, the motor will turn, say, in a clockwise direction. If these switches are turned off and the other pair is switched on, they connect the motor to the supply in reverse and the motor rotates counterclockwise.

While the switches are turned on in pairs, those on the same side must never be turned on simultaneously. For example, if the two switches on the left or the two on the right were to be switched on together, they would create a direct short between the terminals of the power supply/battery, bypassing the motor altogether.

This phenomenon is called shoot through, and if your power supply or battery has no short-circuit protection, it may cause a premature failure of the source including irreparable damage to the switches. Typically, the rating of the switches must match the rating of the motor – powerful motors operate on high currents and the switches must be capable of handling those currents. In practice, the switches are power MOSFETs or IGBTs.

Meet Bob – the Security Guard Robot

Although security guards are deployed in many places that people visit regularly, it is highly unlikely that one will recall where he or she saw a specific security guard on a particular day. That is because we do not pay much attention to the guards on duty. However, it is different with Bob, and you cannot but look at him, remember him and recall him to your friends later.

That is because Bob is a goofy looking security guard and a robot. He or rather it is an autonomous robot, based on the MetraLabs robot “Scitos A5,” programmed by the University of Birmingham and Bob runs on Linux.

Actually, Bob is on a three-week trial run at the Gloucestershire headquarters of the UK-based security firm GS4 Technology. The School of Computer Science, at the University of Birmingham, designed the robot they named as Bob. GS4 is evaluating Bob’s performance as a trainee security officer. The University of Birmingham is hosting the project STRANDS with an aim of using robots in a more versatile way in the workplace and Bob is a part of the $12.2million project.

Bob is built on the lines of the Germany-based MetroLabs Scitos A5 robot. If you have seen the Softbank Pepper robot made by Aldeberan, Bob looks much like an armless, stripped down version – even the built-in tablet display is present. The difference between the two is in their programming. Pepper can read and respond to human emotions, while Bob is trained to notice changes in a given environment.

With built-in scanners and 3D cameras, Bob can build a map of its patrol area. Bob, being a mobile robot, can identify objects and autonomously maneuver around them. If it finds its batteries are running low on energy, Bob reports to its docking station for charging them. According to GS4, the security robot is programmed with activity recognition algorithms. Therefore, it is able to detect movement of people, observe and draw conclusions about the changes occurring in the environment over time. For example, Bob can identify when and where objects disappear or reappear, detect whether fire doors are closed or open and identify where people can go.

Bob is unarmed and carries no weapons. Therefore, it cannot apprehend a thief in the act. However, Bob can speak and contact human guards for assistance. Typically, human security officers have a very wide range of different tasks that they carry out. They may have to react to fast changing unpredictable events that require on-the-spot decisions. Although the robot security guard of the STRANDS project will not be able to replace a human, it can support the security team as an additional patrolling resource. It can carry out frequent routine checks, highlighting abnormal situations that require the security teams to respond.

The Scitos A5 from MetraLabs sells primarily as a mobile service robot. It is used for exhibition booth and point-of-sales applications. Typically, the Scitos robots run on Fedora Linux with SELinux extensions, whereas Bob runs on Ubuntu Linux. The interface consists of a 15-inch, 1024×768 touchscreen, dual loudspeakers, microphone and 32 LEDs to provide feedback signals.

PicoBorg Helps To Build a DoodleBorg

Imagine a small tank driven by a Raspberry Pi or RBPi. This is the DoodleBorg, a two-horsepower goliath and is the most powerful robot controlled by the RBPi. Powered by starter motors originally from a motorcycle, the DoodleBorg uses six PicoBorg motor boards made by PiBorg.

The DoodleBorg uses a tiny, credit card sized single board computer, the RBPi, as its brain. It has six reverse motor controller boards or PicoBorgs controlling its six wheels. Each of the boards is capable of handling 10A on average. Therefore, with two batteries in series, the average power output is 6x10x24=1440Watts or roughly 2HP. Peak power outputs are higher, about 2.1KW or three horsepower. Usually, the RBPi is prominently visible in the robot it is powering. However, in this case, you will hardly recognize it in the massive size of the project. Commands to the DoodleBorg are sent via a PS3 controller.

The PicoBorg reverse motor controller cards were specifically chosen for this project. These are advanced dual motor control boards for use with an RBPi. PicoBorgs can control big or small motors, with forward or reverse speed control. Each board, with its own emergency power off, is sized to mount on your RBPi for PID control and feedback via the GPIO pins. If you need to control more motors, simply plug in more boards and control up to 200 motors.

The dual motor controllers can handle input voltages between 6 and 25VDC and control up to 5A per channel, that is, 10A when combined. The emergency power off switch works in both bidirectional and speed control modes. PicoBorg boards are capable of handling two DC motors or one stepper motor with 4- or 6-wire configuration. For communication, you can use the I2C or SCK/SDA pins on the GPIO together with 3V3/GND pins. Adding the PicKit2 brings additional functionality.

PicoBorg reverse motor controllers are protected against overheat, short circuits on all outputs and under-voltage lockout. Connections are very straightforward. Six screw-terminals on the board allow connecting two motors and a battery. There are two 6-pin terminals, one of which is for connecting to control signals from the GPIO of the RBPi. The other 6-pin terminal can be used for daisy chaining another PicoBorg board.

Another connector on the board allows you to easily add a normally closed switch to act as an emergency switch. In case of any fault, simple open the switch and the motor will be cut off. The software on the PIC micro-controller on board will recognize the emergency switch operation and prevent further operation of the motors until enabled by a software command.

Another feature of the PicoBorg is its ability to run DC motors with taco feedback. The software accepts taco input signals that indicate either the number of rotations or the distance traveled by the wheels. Acceptable feedback signals are – quadrature signal (A or B) from an encoder, taco signal from a computer fan motor, index mark feedback such as one per revolution pulse. The motor connection remains the same as that for a standard DC motor setup.

What are terrorist robots?

Increases in terrorist activities around the world are forcing the military to train their units in different ways for tackling the menace, especially for urban engagements. Marathon Robotics, an Australian company, in conjunction with the Australian Department of Defense, has revolutionized the way police and military personnel can train their personnel. They have adapted the two-wheeled gyro-stabilized Segway personal transporter and turned it into a Terrorist Robot.

Marathon fits their Terrorist Robots with a Segway transporter and target silhouettes. These form the remote controlled, wheeled robot targets for the military personnel to practice. Moving and responding like humans, these Segway robots can duck into doorways or disperse at the sound of gunfire. That provides the police and military sharpshooters a challenging and ultra-realistic training in engaging the moving enemy. Australian Special Forces units train using mock urban centers populated with the rolling robots from Marathon. Now, the US Marine Corps is looking forward to a similar live-fire training venue, fully equipped with Marathon’s Terrorist Robots.

Marathon has created the ultimate moving targets of the twenty-first century. They have done this by combining remote-controlled, armored Segway and computer gaming technology. With the lower half of the robots armor-plated, the expensive electronic innards remain safe from errant shots. The top has a replica of a human torso. During the training, clothing the torso section differently, enables distinguishing military targets from civilians or hostages from terrorists.

Marathon uses sophisticated software for controlling multiple Segway robots simultaneously. The software program allows a group of these robots to mimic a group of terrorists holding hostages or simply a squad on a patrol. Furthermore, the control part of the software allows the robots to demonstrate autonomous or intelligent behavior.

For example, the sound of a gunshot makes the robots disperse automatically, just as humans would. The robots can further be trained to seek cover behind objects or in hallways. More importantly, the robots can behave very similar to humans – stopping quickly, turning a full circle, retreating slowly or accelerating to a human pace of running. Just as people do, the Segbots also lean forward slightly as they move forward. To avoid running into obstacles or people on the move, Marathon equips their robots with laser range finders. Watch the Terrorist Robots in action below.

For the military or the police personnel, a battlefield is not the right place for on-the-job training. The Marathon smart targets thus provide a realistic method to address this fundamental gap in training. This is the first time shooters can fire live ammunition in a firefight at realistically moving targets. That provides the soldiers the optimum way of training to fight – using live ammunition against unpredictably moving targets.

Programming the robots is simple. The computer shows a map of the entire terrain and the placement of the robots. The possible routes that the robots can take are superimposed on the map. From here onwards, the Terrorist Robots are on their own, moving around autonomously, avoiding obstacles in their path and other robots, until a sudden gunshot changes their behavior.

How do rotary encoders work?

When tracking the turning of shafts, it is usually necessary to generate digital position and motion information. The most popular way of doing this is by using rotary encoders. They may be incremental or absolute, optical or magnetic, but they are used extensively in industrial and commercial designs in myriad applications. You will find rotary encoders being used on motors paired with automated machinery and drivers for nearly everything from robotics, position control and conveyor speed monitoring on automated industrial machines, elevators and consumer electronics.

Incremental encoders, mostly used for industrial applications, output the shaft’s relative position compared to a reference. In contrast, absolute encoders provide a different binary output for each position that defines a shaft’s position absolutely. Where incremental encoders define resolution as counts per turn, absolute single turn encoders define it as positions per turn, and express it as a multi-bit word. There are multi-turn encoders that track over multiple 360-degree turns and they specify resolution as positions per input-shaft turn along with the number of internal gear ratio turns.

Rotary optical encoders are the most widespread designs used. They typically consist of an LED light source, light detector, a code disk and a signal processor. Although the precision of the mechanical pattern on the code disk defines the measurement precision, there are other factors as well. For example, a quadrature encoder has several opaque regions that produce four distinct reference points. Two of these points correspond to the leading and trailing edges of the region itself. Another two additional points correspond to the leading and trailing edges of a second detector. Apart from providing higher resolution – four times of the code disc – it also indicates direction of turn depending on which detector responds first.

Incremental encoders are named after their outputs, which consist of two square waves, each corresponding to one increment of rotation. A convex lens focuses the light rays from the LED into a parallel beam. This passes through grid diaphragm, whose sole purpose is to produce a second beam of light 90-degrees out of phase to the original. Light from both channel A & B pass through a rotating disc onto the photodiode or photovoltaic array. The rotating disc creates a light & dark pattern as the clear and opaque segments interrupt the beam.

The absolute encoder has a nearly similar structure, except for multiple detectors and multiple unique tracks on the rotating disc. This produces a Gray Code output, which is a binary numeral system where the successive values differ by one bit. One advantage is this information is available even if the encoder has been temporarily shut down.

Although several methods are used to boost the resolution of direct-read encoders, the electric interpolation method is the most widely used. A voltage divider circuit subdivides the raw analog signal into the number of interpolation steps desired. The interpolation is actually a function integrated into the encoder logic and is transparent to the designer. This method allows for boosting the direct-read encoder resolution by about twenty times.

Cubli the Baron Munchausen of Robots

When you find a cube lying innocently on the table, you wouldn’t exactly expect it to jump up and start balancing itself on its edge or on its corner, will you? Probably not, if it wasn’t Cubli, the one designed at ETH Zurich. Well, it does not actually lift itself up by its own locks as Baron Munchausen was fond of doing, but Cubli the robo-cube can bring a smile on your face when you see its capers – watch its antics below.

Cubli, the 15x15x15 cm cube, has several spinning wheels and motors inside it. The contraption lets Cubli lie on one of its sides peacefully, then jump up to stand on an edge and proceed to tilt for balancing itself on one of its corners. By combining its jumping and balancing tricks, Cubli can even walk!

A closer inspection reveals three reaction wheels within the cube, one on each axis. These are able to spin at high speeds, as they have a motor each to drive them. The combined reaction of the three spinning wheels makes Cubli attain its uniquely stable postures. In fact, the positions are so stable that you can even nudge Cubli a little and it will resist falling over. Cubli can control its fall, allowing it to “walk” on a surface.

To control the speed of each of its wheels, Cubli has three motor-controllers, governed by an on-board processor and a bevy of inertial sensors. The motor-controllers rev up their individual motors based on the commands from the processor. Sensors monitor the tilt and angular velocity of Cubli at different points and feed this data to the processor to compute how fast each of its reaction wheels needs to spin to get Cubli to maintain its position.

By suddenly stopping the spinning of one of its reaction wheels, Cubli can jump up to one of its edges from its resting position and similarly, proceed to balance itself on its corner. Satellites use the same technique to keep themselves stable in orbit and Segway keeps you from falling off its scooter. However, the algorithms that Cubli uses are entirely different.

It feels funny watching Cubli walking. From its resting position, it rears itself up on its edge, hangs there for a moment and then gradually lowers itself on to the next side, repeating this sequence for its controlled walk. When Cubli is balancing on its edge or its corner, it will maintain its balance even if you tilt the surface on which it is resting.

All this is made possible because the spinning wheels act as gyroscopes. The momentum of the spinning wheels keeps the cube balanced. When one of the wheels slows down, it loses its momentum, and the center of gravity of the cube starts to pull it down. Speeding up the wheel improves the momentum and counterbalances its center of gravity, allowing Cubli to regain its position.

Another research group is considering using this amazing technology for building robots and using them for exploring other planets.

REX – a brain for robots

Not to be confused with Tyrannosaurus the king of beasts, REX is a complete development platform for sophisticated robotic applications. While most robotic designers use the Arduino platform as a base for their robots, Mike Lewis and Kartik Tiwari were not impressed with the available hardware. Their design, REX, is specifically targeted towards robots. REX poses no wiring hassles, has built-in battery inputs and has a robot programming environment that it boots up directly into.

The duo felt people who designed robots needed a new and more advanced platform. When using a single microcontroller for handling multiple sensors, motors and other electronics, problems start arising. The situation worsens as you plan on adding increasingly sophisticated tasks such as speech recognition and computer vision. The Arduino is, by default, not a multitasking platform and is intended for running a single task at a time. However, robotics essentially requires multiple tasks to be running at any given time.

Therefore, REX came up with a 32-bit ARM Cortex-A8 processor core running at 1GHz, an 800 MHz DSP core and 512 MB of RAM. The board runs on the Alphalem Operating System and boasts of a host of features such as built-in drivers for sensors and other similar devices, a task manager to allow launching multiple processes and support for several programming languages such as C, C++ and Python. The Arduino-style programming environment facilitates developing your own robot applications.

REX is a low-cost robot development platform that targets advanced robotics. Although simple robotics can be handled by the Arduino project and is fairly straightforward, REX is geared towards handling the extra functionality required where you need voice recognition and computer vision. Being simple and low-cost, the REX platform helps make more advanced robotics projects more accessible to the average hobby roboticist.

At the core of REX is the ADE or Alphalem Development Environment, consisting of scripts or programs written in C++, which form an Application Programming Interface for communicating with devices connected to REX using the I2C expansion ports. Apart from the built-in drivers that the Alphalem team selected for REX for driving sensors and actuators, the ADE also has a process management system for running multiple programs in parallel for efficient robot control. This, the team claims is the most useful features that REX offers to robotic designers.

Physically, REX is about the size of a standard pack of playing cards, small and compact. This palm-sized, single board computer is priced at $99 for its basic model, which includes the DSP, camera, microphone inputs and preloaded OS. You can use REX to control small simple robots easily.

However, this is not to mean that REX cannot handle complicated stuff. In fact, REX is extremely powerful and is able to handle a huge range of sensors such as speech recognition and machine vision. This allows it to be used for some very complicated robotic activities.

Incidentally, the name for the project was earlier AlphaOne, to commemorate Apple’s first PC. However, Mike, as the product engineer, proposed that the name should be changed to REX since he had a Jurassic Park mug on his desk.