The best way to learn about robotics is to build and program your own robot. This can involve buying many different parts from a range of suppliers, or you could take a simpler route with a DIY kit.
We’ve used the £75 Deluxe junkBot from RobotBits. A £65 Basic junkBot is also available, but this model requires you to do some soldering work on the motherboard and supply your own wheels and castor.
Here, we describe how to fit together the various components in the kit. Even those with no engineering experience will be able to follow our instructions, using only a set of screwdrivers and a drill. It should take little more than an hour or two to build your own junkBot robot.
Left to its own devices, your junkBot isn’t capable of much. Just like a PC, it needs to be programmed using software in order to do anything useful. Unlike PC software, though, which mostly writes information to the computer’s screen, the junkBot’s software drives the motors that are connected to its wheels and uses an infrared sensor to detect nearby obstructions.
To complete our introduction to robotics, we’ll show you how to download a sample program to your completed junkBot. This can be modified to alter the robot’s behaviour.
This is just the start, though: the sophistication of your junkBot’s behaviour is limited only by your imagination and how much time you’re prepared to take in honing your programming skills and developing the necessary software. Persevere, and you’ll be amazed at how much you can achieve with such a simple, low-cost kit.
Step 1. The junkBot kit doesn’t include a chassis. You don’t want something that’s so heavy it’ll overload the motors, nor so flimsy it’ll collapse during use. We suggest a plastic box that’s large enough to house the parts and long enough to be stable. We bought a 1.5-litre tub for £1.25 at our local supermarket.
Step 2. Attach a wheel to the axle of each servo motor (black boxes with black/white/red leads). The wheels should push in easily if they’re the right way round; secure them with the small black screws. Attach each motor to the bottom of the chassis using the double-sided sticky pads provided. Fix the castor to the back, too.
Step 3. Plug the Mini-IO Shield circuit board into the Arduino Uno circuit board and secure it using the plastic spacer and screw. The Arduino Uno board will form the brains of your robot. The Mini-IO Shield provides an interface between the Arduino Uno and the junkBot’s motors and sensor.
Step 4. Fix the Arduino Uno/Mini-IO Shield assembly to the inside of the chassis using the three metal stand-off pillars and the six screws provided. Position it near the front, leaving space for the battery holder behind. You’ll need to make three small holes in the base of the chassis. If you don’t have a drill, use the point of a pair of scissors (carefully).
Step 5. Attach the distance sensor to the front of the chassis (the wheel end). The two black shiny spheres (an infrared LED and an infrared detector) should point forwards. Since there’s no space for adhesive pads, you’ll need to use nuts and bolts. Make sure it’s not pointing downwards, packing it out if necessary. Plug in its lead.
Step 6. Insert six AA batteries into the battery holder. Connect the battery lead to the battery holder and use the two pairs of self-adhesive Velcro strip to attach the battery holder to the inside of the chassis. Position the battery holder near the back of the chassis to keep the weight balanced.
Step 7. The motors and distance sensor are mounted on the outside of the chassis, so you’ll have to make some holes for the wiring to make a neat job. Using a drill (or scissors), make holes close to where the lead exits each of the motors and another where the lead exits the distance sensor. Pass the leads through the holes.
Step 8. Plug the lead from the lefthand motor into channel 0 of the Mini-IO Shield, the lead from the righthand motor into channel 1, and the lead from the distance sensor into channel 2. In each case, ensure the white wire is the closest to the outer edge of the Arduino Uno board. Use cable ties to tidy up the wiring.
Step 9. Download the IDE for the Arduino board. Extract the files from the Zip archive, preserving the folder structure, then follow the instructions to install the driver. In Windows 7 you’ll find this under ‘Other Devices’; it’ll move to Ports when the driver has been installed. Make a note of its COM number.
Step 10. Start up the IDE by double-clicking the Arduino application. Download the sample code from tinyurl.com/67jwsLe, then open it in the IDE by selecting Open from the File menu. Select Board from the Tools menu and choose ‘Arduino Uno’. Now compile the program using ‘Verify/Compile’ from the Sketch menu.
Step 11. If it’s not still connected from Step 9, connect the junkBot’s Arduino Uno board to your PC using the USB cable. Select ‘Serial Port’ from the Tools menu and choose the COM port that you noted in Step 9. Select ‘Upload to Board’ from the File menu. When the ‘Done uploading’ message appears, disconnect the USB lead.
Step 12. Plug the lead from the battery pack into the Uno board and place the junkBot on the floor facing a wall. It should move forward until it reaches the wall, then turn around and proceed until it finds another wall. If it moves backwards, the two motors have been connected the two wrong way around.
Step 13. Now try modifying the sample code. Edit it using a text editor, such as EditPad Lite. Enter the code in the screenshot in place of the code starting with ‘while(!front_bump())’. The ends of some lines have scrolled off the screen, but anything after a // is a comment and won’t affect operation.
Step 14. Repeat Steps 10, 11 and 12 with this new code. The junkBot should behave as before, but when it reaches a wall it will now stop, back up and turn around. You can now start your own voyage of discovery by altering the software further or writing your own code from scratch.
Source: pcadvisor.co.uk