Light-seeking Robot Schematic Circuit Diagram
Whatever the interest of the many types of robot that can be built today, the mobile robot is still an unmissable stage through which any robotics amateur has to pass, for at least two reasons. The mobile robot presents a concentration of the difficulties, and hence solutions, that may be encoun-tered in robotics. You have to deal with problems of mechanics and kinetics in order to manage its movements, problems of sensors, which can be extremely diverse depending on what we want to detect, or on the other hand avoid, behavioural intel-ligence problems for processing the infor-mation provided by these sensors, etc. But the second reason why the robotics amateur needs to pass through the ‘mobile robot’ stage is often much less prosaic, as it’s simply aimed at impressing the peo-ple around you (parents, friends, girl/boy-friend). What could be more impressive than this ‘thing’ straight out of a 50s sci-fi movie, moving around all by itself follow-ing a line on the ground, avoiding chair legs or responding to its signal from its master?
So, robotics novices for all kind, you will have realized that a mobile robot what we’re going to suggest constructing. And so you’ll be able to see quickly just what your own hands are capable of creating, we’ve chosen some solutions that are simple, but no less successful in producing a certain effect. Quite simply, it’s a light-seeking robot —a sort of moth (on wheels) if you prefer, since, just like its counterpart in the liv-ing world, it is always going to head for the brightest source it can find in the room where you let it loose. To simplify construction and enable you to be up and running in just a few hours, or less, after reading this article, we suggest you take advantage of a mechanical base that’s available in a kit. Having opted for propulsion using modified servo motors, we suggest two different bases: the Rogue Blue base from Rogue Robotics (www. roguerobotics.com) or the Carpet Rover 2 base from LynxMotion (www.lynxmo-tion.com).
Of course, if you are good at mechanics, there’s nothing to stop you building such a base yourself. It just needs to be propelled by two modified radio-control servos, and so will need a jockey wheel at the front and/or rear. The modification to convert the servos into propulsion motors is explained elsewhere in this issue, but if you have any doubts about doing it yourself, as of quite recently you can also now buy such servos already pre-modified by their manufacturer. Take a look at Lextronic for example for this (www.lextronic.fr).
For our robot’s ‘brain, to show you it’s not always necessary to use the very latest 32-bit microcontroller, we’ve decided to use the smallest of the Basic Stamps, the Basic Stamp I. The complete circuit looks like Figure 1. The two ports PO and P1 of the Basic Stamp I are used 10 drive the right and leh propulsion servos. The bf ightness , meas-ured using Iwo pholoresistors or 1011 (still called CAS (elk in some Ii0raturel con-nected to ports Pb and P7 of the Basic Stamp I. The 061 mode OICOnnettiOn used here makes it paqsble to use an Instruction specific to the Basic Stamp I, the instruction POT, which measves the chalging time of a capacitor connected to one of its ports, i.e. thereby the resistance of the LDR and thus the brightness falling on it.
For the robot to be able to head towards the brightest part of the room where it is operating, these two LDRs must be mounted pointing forwards, separated from each other by a small piece of card-board or opaque PCB in such a way they can’t both receive the same illumination. The assembly can be powered by four 1.5 V batteries. This voltage is applied directly to the servos and to the unregu-lated PWR input of the Basic Stamp I. Watch out! Under no circumstances con-nect the servo supplies from the Basic Stamp l’s + 5 V output — its built-in 5 V regulator wouldn’t appreciate it! The software part of our robot is at least as simple as the hardware part, as you can judge from the listing below:
PINS = 0
DIPS = %00001111
SYMBOL RightStop = 150
SYMBOL LeftSTop = 150
SYMBOL Move = 30
SYMBOL LightDif = b2
SYMBOL RightLDR = b6
SYMBOL LeftLDR = b7
Main : POT 7, 128, LeftLDR
POT 6, 128, RightLDR
LightDif = RightLDR – LeftLDR
b0 = RightStop + Move – LightDif
bl = LeftStop – Move + LightDif
PULSOOT 0, b0
PULSOOT 1, bl GOTO Main
This listing is very easy to analyse. After an initial phase to define the labels used and the reservation of the RAM in the Basic Stamp I, we go on to measure the light using the instruction POT. This instruction retums, in the variable Lef MDR (or RightLDR), a number representing the resistance of the LDRs connected to P6 and P7 divided by a constant called a scaling factor. You may need to adjust this parameter to suit the characteristics of the LDRs you use. The values thus obtained are subtracted one from the other to yield information about the difference in lighting between the two cells. The calculation of the pulse lengths to be applied to the servos can then be performed, noting that Right-Stop and LeftStop are the values mak-ing it possible to make the servos stop, and that Move is a parameter intended to set the basic speed of the servos, to which is added or subtracted the result of the dif-ference in illumination. Hence, for example, if LightDif has the value 50, b0 will be 150 + 30 — 50, i.e. 130, while b1 will be 150 — 30 + 50, i.e., 170. Given that the resolution of the PULSOUT pulse is 10 ps, the program will thus generate 1.3 ms pulses for one servo and 1.7 ms ones for the other, causing the robot to turn towards the direction of the LDR that is receiving the most light. So this program is fully functional, but, Sven the spread in the characteristics of both the servos, with respect to their drive pulses, and the resistance of the LDRs, it will undoubt-edly be necessary for you to tweak certain numerical parameters again to obtain satis-factory results. To do so, note that:
• RightStop and LeftStop are equal to 1/10 of the pulse width that makes the right and left servos stop. . ,.
• Move lets you define the rotational speed of the servos when the robot is going straight ahead. It is equal to 1110 ol the difference between the pulse width for stop and the pulse width desired for mov-ing straight ahead.
• The coefficients 128 used in the PoT instructions can also be adjusted between 1 and 255 in order to obtain satisfactory behaviour of the robot, given the LDRs used and the ambient light in the place where the robot is operating. Note too that if your robot seems to shy away from the light instead of moving towards it, you’ve probably reversed the wiring between the right and left servos or right and left LDRs (all this is relative, ol course, depending on what you call from and back on the robot). Now it’s over to you…