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

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.

As suggested at Boing Boing here, we made a simple motor.

 

A simple motor

 

We used an AA battery, two large safety pins, sticky tape, 30 cm wire, nail polish, and a magnet. Plus some post-it notes and lego to get the magnet to the right height.

You tape the safety pins to either end of the battery so that the loop of each safety pin is at the top. Then you make a wire coil to fit between the safety pins. The ends of the coil have any insulation stripped off and are painted with nail polish along the top surface only. Once that dries, you put the wire coil between the pins and adjust the magnet to be at the right height so that the wire coil will spin.

 

The coil we made, with green nail polish just visible along the top.

 

A couple of points worth noting:

  • For making the coil we found that solid conductor wire works better than stranded wire. It is stiffer and also easier to get the nail polish along one surface. (It has a single strand of wire within the insulation instead of several – see photos below.)
  • We used the magnet from an old computer hard drive – these are quite strong and are well worth extracting if you get the chance.
  • If you leave the wire sitting in place for very long but *not* turning, you will short out your battery and melt it …

 

Solid conductor wire

 

 

Stranded wire; *not* really suitable for this project

 

The result was quite pleasing:

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.