You are currently browsing the tag archive for the ‘arduino’ tag.

Here’s another iteration of an Arduino controlled autonomous floor robot. This one uses a Tamiya gearbox and servo steering, with infra-red and touch sensors for obstacle detection.

The robot chassis is built from Fischer Technik and a rectangular section plastic downpipe fitting. The parts are held together with screws, plastic cable ties, gaffer tape, glue and rubber bands.

A Tamiya double gearbox powers the back wheels. The white spacer between the gearbox and the red plate of the robot is a PVC downpipe adapter. In this project, both motors are always driven in the same direction and speed.

A basic Futaba servo steers the Fischer Technik front wheels. The front axle is screwed to the servo horn and cable ties attach the servo to the chassis.

One of the challenges with this kind of robot is that whatever sensors you use they only work with 80% of household obstacles. For this robot we used two Sharp infra-red distance sensors pointing slightly left and right. The Sharp sensors have quite a narrow beam. Setting them pointing outwards works well for detecting approaching walls, but leaves a dead-spot in the centre that misses narrow objects like chair legs. The infra-read sensors also miss low (15-35mm) obstructions that the robot can’t drive over.

To deal with things that slip past the IR sensors, we added a touch sensor bar to the front, about 35mm above the floor. This is made of two strips of wood. Two microswitches were glued with epoxy to one strip and the second strip is positioned in front of the switches so that the switches are closed if the front bar hits anything along its length. The front bar was hinged with gaffer tape. This touch sensor gets quite a beating so it needs to be strong and well attached.

Wiring

The motorshield controls the two DC motors in the gearbox. Separate 9v NiMH battery packs provide power for the Arduino and the motors.

The touch sensors and IR sensor are wired to analog ports on the Arduino and polled to detect obstructions.

Software

The software that controls the robot has a simple set of rules:

  • if an object is detected within a few hundred millimeters on either side the robot steers away from that side until the obstruction is no longer detected.
  • if an object is detected close up on either side, or moderately close on both sensors, the robots backs up and turns. The turn takes it away from whichever side is closer to the obstruction.
  • After the robot backs up, it remembers the turn direction for 3 seconds. Without this rule the robot could back up in alternate directions, leaving it still pointing at the obstruction.

The Arduino source code for this project is at https://bitbucket.org/johnmccombs/bot4/downloads and you can download a zip file here.

Parts

  • Arduino Duemilanove
  • Adafruit motorshield
  • Tamiya double gearbox with wheels
  • Sharp GP2Y0A02YK0F IR distance sensor. The IR distance sensors sensors come in several versions, optimised to work over different distances. We used one designed for 200 – 1500mm range.  The GP2Y0A21YK0F which works over 100 – 800mm, and has a wider beamwidth, might be a better choice
  • 5mm square section wood strips for the touch detector
  • 2 x microswitches, recovered from an old mouse
  • plastic cables ties, epoxy glue, rubber bands, M3 machine screws and nuts.
  • 2 x 6-cell AA battery pack and NiMH batteries
  • Fischer Technik baseplate, axle and wheels

Results

This robot negotiates the floor fairly successfully. Going forwards the sensors detect pretty much everything. The main problem is that the robot is fairly tall. Some overhangs or sloping chair legs can strike the top of the robot without being detected by the IR sensors or hitting the touch sensor. Similarly objects  that fit under the touch sensor stop the robot.

There are no sensors on the back of the robot, so it’s unaware of hitting something while backing up. The robot can get stuck in a close space where the robot can’t back up, but the IR sensors show an obstruction. When the happens the robot will backup continuously without success. This situation could perhaps be improved with some software changes.

After blinking an LED with an Arduino, it seems like building a wheeled robot is a popular project. It turns out making a self-navigating robot, that can deal with arbitrary household obstructions, is an interesting problem. Here’s the movie of our first attempt.

We used continuous-rotation servo motors to provide motion and steering. These are easy to control and you can drive them directly using the Arduino 5 volt power. We used and an Adafruit motorshield to control the motors. This isn’t strictly necessary for a servo, but it is convenient.

Arduino and Motorshield

Parts

  • Arduino Duemilanove
  • Adafruit motorshield
  • 2 x continuous rotation servos
  • Sharp GP2Y0A02YK0F IR distance sensor. The IR distance sensors sensors come in several versions, optimised to work over different distances. We used one designed for 200 – 1500mm range.  The GP2Y0A21YK0F which works over 100 – 800mm might be a better choice
  • Mini breadboard
  • Breadboard wires
  • 6-cell AA battery pack and NiMH batteries
  • Fischer Technik baseplate, 2 x pulleys and axle

Rubberbands hold the motors together and attach them to the baseplate. If the rubberbands are tight, there is enough friction to prevent slipping. Rubberbands also attach the  battery pack, Arduino and breadboard to the top of the robot. Bluetack holds the IR distance sensor on the front.

The two Fischer Technik pulleys and axle form a trailing castor.

The IR distance sensor triggers a random turn when the robot comes within about 350mm of an object.  The Arduino powers the sensor from the 5v line. The sensor outputs a voltage that decreases with distance: 2.7v at 100mm down 0.5v. The Arduino analog pins measure the voltage to sense obstructions.

Arduino program source code is on github – download here or visit the repository.

How did it turn out? The robot navigates well in areas with solid walls.  However the IR sensor has quite a narrow beam, so the robot will hit small obstructions on the floor or overhangs. Also the sensor does not reliably detect glass, reflective object or black objects. The robot requires human help from time to time.

Arduino is a low-cost single-board computer with a bunch of I/O ports that you can use to control devices and sense the environment. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. In other words you don’t have to be an embedded computing engineer. The programming tools are free and open-source.

My interest in the platform is as a tool to introduce my 5 year-old to electronics. Although wiring and programming Arduino projects is well beyond a 5 year-old’s skill, there’s plenty to get excited about and participate in.

What can you do with an Arduino? Take a look at the Make Magazine Arduino archive for inspiration.

Learning. The brain of the Arduino is an Atmel microcontroller. The program that runs on the processor can read analog and digital inputs to read sensors and switches and turn the pins on and off to control motors, communicate with other devices, switch LED’s etc. Programming the board is pretty easy to pick up if you have some prior programming experience.

Getting Started with Arduino by Massimo Banz. Arduino website Manuals and Curriculum. And there’s plenty of good resources available.

Shields are an important part of the Arduino platform. These boards stack on top of the Arduino itself and extend its function. There are a shields for motor control, networking, GPS etc. The Motor Shield shown below can control a pair of servos and each terminal block at the ends of the board can control one stepper motor or two DC motors.

Motor Shield

The Proto Shield is an essential item. Combined with a small breadboard it’s a great way to build small projects. For more permanent circuits, your components can be soldered directly to the board.

Proto Shield

Accelerometer

Sensors. There’s an almost limitless array of sensors available. Temperature, humidity, pressure, acceleration, direction, proximity, light, colour, gases etc. These can be hooked to an Arduino with little effort and many of the sensors can be purchased on a breakout board that includes most of the required electronics. The photo at the right shows an accelerometer chip mounted on a breakout board that includes all the necessary external components.  All you need to do is connect power and connect the X, Y and Z axis outputs to the analog pins of the Arduino and you’re done.

Suppliers.  Adafruit have Arduino boards, shields and lots of components.  Their tutorials are very detailed and the online forums have knowledgeable helpful people. The Adafruit people are very helpful. Sparkfun have a much bigger selection of electronic components. A good place to look for more ambitious projects. Make Magazine’s Maker Shed online store has a lot of good stuff too. In New Zealand you can buy from MindKits and Robotronic.

Learned. Here are some things I’ve learned, in no particular order.

The things that you connect to an Arduino, shields, sensors, motors, LCD’s, LED’s etc generally have PDF datasheets that you can download from the Internet.  It’s well worth downloading and filing them – you’ll definitely need them.

Get a supply of protoshields and breadboards of different sizes. Say, 3 protoshields, with 35×45 mm, or 55×85 mm, breadboards.  Also get 2 or 3 55×170 mm breadboards for larger circuits. You can attach the Arduino to the breadboard with rubber-bands or get Adafruit mounting plates.

Get lots of jumpers, both the flexible and solid core kind. The flexible ones are the easiest to use, but the solid wire kind make for tidier wiring across breadboard.

Get extra female headers (5, 6 and 8 pin) – both short and long wire types. Proto Shields have extra rows of holes for power – it’s really convenient to be able to use these. Also many shields don’t come with female headers that allow you to stack other boards on top, so having extra headers to substitute is very helpful. Also if you have a shield that doesn’t have enough clearance from the board below, e.g. an Ethernet Shield, you can push some spare headers on the bottom to get extra spacing.

Wing-shields have screw terminal connections for the Arduino pins. This is much more secure than the push-in jumpers used on the Arduino ports and on breadboards – great for projects like robots.

LCD displays. You can get 2-row 16-character displays, see picture above. For graphics, the 128×64 pixel KS0108 displays are popular and well supported.  The KS0108 displays have a parallel interface, which means they use a lot of pins – something to keep in mind if you’re using another shield that uses a lot of ports. Another 128×64 option is an ST7565. It has a serial interface that means it only needs 5 pins, but uses more RAM.

For robots and projects where you want to sense movement or nearby objects, Sharp infra-red sensors work well. They project a narrow beam of infra-red light and return the distance measured and a voltage proportional to the distance to the target. To use them with the Arduino, you just measure the voltage on one of the analog input pins. There are two versions of these sensors. One measures up to 800mm and the other up to 1.6m.

Servos are easy to use. The Adafruit motorshield makes these easy to connect and use.  Continuous rotation servos work well for driving wheeled robots.

Lots of LED’s. Also a generous supply of 100, 330, 1k and 10k ohm resistors.

You’re going to need a good soldering iron.  I have a Hakko FX-888 with a 1.4mm chisel tip, but there are cheaper irons that will do the job. The FX-888 can do lead-free solder.

Lego and Fischer Technik, balsa, rubber bands and gaffer tape are great building blocks for projects. The Arduino boards, motors, and sensors don’t readily attach to Lego or Fischer Technik, so remixing incompatible components provides interesting challenges.

You need a multimeter.

Flickr Photos

Enter your email address to subscribe to this blog and receive notifications of new posts by email.