MiniBot, a modded servo robot.

If you've read the micro servo modding page you may be wondering what to do with your newly modified servos. Well, one idea would be to try building a small robot with two of them, perhaps a simple light following bot. Figure 1 shows just such a robot, called MiniBot, that is simply based around a DIY arduino, two modded micro servos and a pair of light sensors. And the good news is that MiniBot used very few parts and so was amazingly inexpensive to build!

You can just as easily use a ready-built Arduino board, although if so you may need an external 5V voltage regulator if your Arduino isn't able to power two servos. The chassis for MiniBot was made using some balsa wood and bits of meccano to provide servo mounting brackets, the front wheels, and a simple rotating back wheel. It may not be terribly sophisticated, but it certainly likes following torches!

The MiniBot robot circuit and chassis.

Figure 1. The MiniBot robot circuit and chassis.

Wiring the servos and light dependant resistors (LDRs) is basically the same as was shown on the servo dial guage page. The diagram from that page is shown in Figure 2 to save you navigating away. You'll need two of everything shown in Figure 2, mounted with your Arduino onto your homemade chassis. The resistors for the light sensor parts of the circuit were 6.8k and the LDRs had a bright light resistance of around 12k. However, it's likely that your LDRs will have a different resistance, in which case you'll need to change the maxLight and minLight values at the top of the Arduino code to suit (more on the code later).

Servo and LDR wiring.

Figure 2. Servo and LDR wiring (two of each are needed).

The Arduino pins used to connect to the servos and LDRs are detailed below. However, don't worry if you use different pins, as long as the servos connect to digital pins capable of providing a PWM (pulse-width modulated) output, and the LDRs connect to analog input pins. Obviously, if you use different pins you'll need to modify the top of the Arduino code to suit.

Item

Arduiono Pin

Left servo

D11

Right servo

D10

Left LDR

A0

Right LDR

A1

Once you have everything wired up, all you need is some code. A very simple Arduino program to follow a light source (e.g. a torch) can be found by clicking here. The code simply measures the left and right light levels and uses them to map a speed to each servo. When you read the code you might wonder why it uses the left LDR to map the right servo speed, and the right LDR for the left servo. The reason is that we want the robot to turn toward the brighter side, which means increasing the speed of the servo on the darker side.

The code is really very simple, so hopefully you will be able to adapt it readily once you've read through it a few times. Also, to help you set the minimum and maximum light levels to suit your LDRs, and to make enhancing the code easier, you'll find that the Arduino program includes some serial functions that will send useful data to a serial console in the Arduino IDE (at 115200kbps).