If you have ever attended a robotic contest and you want to take part in it, or if you are interested in building a line follower this project might be a tower of strength. In this post you will find a detailed description of all the steps taken to end up with a basic line follower, easy to do and low cost, ideal for beginners who always wanted to enter into the fascinating realm of robotics. Although, the project as a whole has already been developed at Robot Zero (in Spanish) I would like to gather the most relevant concepts turning out the final version.
One of the common targets at C.I.r.E. Is the development of line followers, actually we have been discussing this topic for months and a few ideas have come up. Aiming at summarizing these ideas I hereby present my final version of Robot Zero.
I am not an expert on this I have participated in a couple of contests, nevertheless due to the lack of information I hope this document can set a couple of guidelines for those who are willing to compete but not fully knowledgeable of the basic concepts. Having said that I would like to point out that I don’t guarantee the same outcome, I only state what has worked for me, hence the performance will be subjected to the designer’s criteria.
One alternative for beginners is to buy an already built line follower kit, internet offers this choice. I totally discourage this option, since it losses a big part of the appeal, everything is assembled an mostly programmed so the major challenge is virtually reduced to push a bottom. In addition, I presume this sort of robots won’t be allowed, the merit that entails is minimum therefore it is not worthy of been awarded.
The first thing to design a robot is a proper selection of the components and probably this is the first difficulty to be tackled by newbies, questions like what kind of motor or sensors do I need, are likely to come up at this stage. The best option I have found are the Pololu components, with a very reasonable price we can choose everything is needed to meet the performance standards in the competitions, we are not going to win but we might go successfully through the qualifying sessions which would be a great achievement for a novice.
My components selection is as follows:
- Programmer and control board $31.95.
- Sensor board $14.95.
- Wheels $6.98.
- Ball caster $2.99.
- Motor mounting brackets $4.99.
- DC-DC Converter $11.95.
- Battery $11.95.
- Battery Charger $16.95. (Me he fijado que el cargador está descartado)
- Motor HP $31.90 (option A).
- Motor $31.90 (option B).
We can choose between two types of DC motors for this project, if your objective is to build your first line follower and you would be happy with get it to work, then I suggest to select option B. On the contrary if you rather run as fast as you can then go for option A. The issue with the latter is that the motors will request a significantly higher source of current and there is a possibility of burning the DC-DC out, the possibility is remote but it does exist. From my point of view, these are the motors with a superior quality/price ratio. With the chosen wheel and the option B the maximum speeds are around 2 m/s while with A the top would be close to 4 m/s.
Looking at our budget we could have the lot for $122.66, if we add another $10-15 we will have everything we need to crack on. This list includes two different north American suppliers, each shipping expenditure is between $10 and $15 for an economy delivery and it will take up 7-12 days to Spain, you have to consider the fact that depending on where you live you might encounter custom duties.
Nonetheless if you live within Europe and if you cut the shipping costs you can buy all at http://www.robotshop.com/eu , the only drawback would be that the change rate is $1 = €1 instead. You can think it through and go for your most affordable choice.
In order to assemble all the components there are two alternatives: we can either use a PCB that works as a chassis too or place a PCB/stripboard onto another base. Below I show a picture:
For our purpose the best decision would be to build a external chassis and attach the electronics on, because it will allow us to have several interchangeable chassis providing flexibility and consequently adaptation to different tracks, this way we can test configurations differing in width and/or length and pick the one which suits best. For instance, if there is track featured by large turning radius and straight stretches it may be convenient to have a longer and wider chassis, whereas if the configuration is mainly composed of small curves and short straight stretches a smaller design is likely to perform better. Besides the robot dimensions are dependent on the inertia and friction forces that reach with traction, therefore the easiest way of assuring the optimal size is to try diverse arrangements out.
If we have put everything together sharing a PCB we can’t easily change its dimensions, this is usually the case if we decide to buy a commercial robot due to economic reasons and ease to manufacture, if you are concerned about the overall weight I should state that the difference can be neglected. The weight of plastic is roughly the same to PCB offering similar stiffness. For all these reasons, I believe that the first design should encourage beginners to learning and testing new ideas so an interchangeable would be desirable.
The final purpose is to have something like this, a robot to attach onto different bases.
Let’s start building the chassis, my suggestion is to design a layout either hand drawn or computer aided. We can stick the template onto a piece of a 3 mm thick Forex or expanded PVC, for boring you can use a drill previously marking the holes with a bradawl (this is an important task since the motors should be perfectly aligned) and with a utility knife we can cut the PVC following the contour. A good point to choose expanded PVC is that it is very use to work with and no sophisticated equipment is needed.
Below I attach a couple of samples (usually to enter competitions your size must be within the maximum dimensions permitted) and a picture of the base manufacturing process.
In my opinions, these aren’t the ideal dimensions but they are the ones I have tested.
What we need to assemble the electronics is to either a PCB design or we can use a stripboard, as Guillermo previously explained here, which might be the easiest solution for those of you who aren’t familiarised with home made PCB techniques. In addition, we can use double sided tape to adhere the selected battery to the electronic board, in a way that its location is in the lower part of the robot. This will cause a lowered centre of gravity.
The image below is a close-up view of the electronic board.
The technical features of the assembled electronics would be:
- Either 8 digital IR sensor inputs or 6 analogue corresponding to the central ones ( I didn’t want to desolder the ADC potentiometer to use 8 sensors instead).
- 1 Digital output to enable/disable the IR emitting diodes and hence adjust its light threshold.
- 2 LEDs.
- 1 general purpose push button, activation, RC sensor calibration, etc…
- 2 switches to select different programmed strategies, this is essential to modify the speed against other competitors, if we want to take a risk switching speed to full blast.
- 1 DC/DC converter which supplies a constant reference voltage to the motor driver, this way the control policy can be simplified.
- 1 connector to provide a 5V outpout and Serial USART communication, Rx and Tx pins, in case we wish to communicate our robot through a module to the PC.
- Battery duration: 28 minutes (PWM 160/255, Average speed = 215 cm/s running on the tested track).
In case we are using high-power motors the DC/DC might be burnt out if we don’t add the electrolytic capacitor placed close to the converter board, of if its value is too small. Even though it is the typical component in every dissipative regulator this capacitor supplies the current peak demanded by the motors while their c.e.m.f. Are low.
Particularly, I am using a value of 22 uF and it is enough indeed for the motors to work at high speeds. I tested what would happen if I removed this capacitor and check whether the regulator will cut off for the overrated current demand and it turned out burnt out, as the HP motors can exhibit current peaks up to 1.6 A per motor and the DC/DC only supports up to 2A inputs. By placing this capacitor (locating it closer to the converter or doubling its value) we shouldn’t have this problem with the robot running at fast speeds. With the other motor selection there aren’t any worries since their current consumption won’t exceed 0.36 A rated at 6V.
In order to plug the microcontroller board, as well as the DC/DC regulator, we can employ female 0.1” pitch breakaway connectors. This option is pretty versatile as it allows us a further use of the components for other projects. If we have picked the HP motors the DC/DC voltage regulator would be configured to provide a 5.5-6.5 V output, on the contrary if our design is composed of low power motors the voltage output has to be 9V in order to get more torque and velocity out of them.
The battery connectors, push buttons and so on could be purchased at Pololu too (increasing the possible custom duty), however usually you will have a local supplier where this kind of products are easy to find at a reasonable price.
The electronic schematic (click the picture for more detail) will result in something like that, unless I have mistaken any pin assignment (it has been reviewed so shouldn’t be the case).
C1 and C2 are the 22uF electrolytic capacitors, R1 R2 and R4 equal to 470 Ohms, R10 R7 and R8 330 Ohms, R3 R5 and R6 15K, a dissipative 5V voltage regulator, if we are draining from the DC/DC 9V then we could select a 7805, but while draining only 6V it would be better to pick one with a lower drop-out voltage such as LF50ABP, L4941BW, namely any LDO. The SMD components are 1206 size.
A picture showing the mounted electronic components and the layout.
Let’s attach the electronic board, once soldered, to the base of the robot. In order to connect the motors you can either employ a couple of matching connectors or solder the wires directly to the board. The next step is to stick the battery to the PCB with double sided tape.
We can screw or glue the ball caster, the latter action will imply a caster per chassis. Finally we can screw the sensor board, having drilled the necessary holes before, and tailor the ribbon cable to connect them to the main board.
Concerning the sensor board we have to replace both resistors or remove one of them, since the sensors are going to be placed too close to the floor and the original values are intended for for the value which the resistors are intended for a larger distance.
In the image above you can tell how two resistors have been replaced by a 50 -100 Ohm one, the formers were associated in parallel and were limiting the current drawn by the IR diodes, we can either one or both and solder another back (as shown in the image). Though I haven’t tried a long range of different values, a 82 Ohm resistor should do the job. This will vary as some of the boards will come with 43 Ohm resistors and other with 66 Ohm. Another fact that has been checked is that unfortunately these boards don’t provide good analogue readings, because its inclination strongly affects the readings, the track surface is not perfectly flat therefore the robot will be subject to certain vibrations or oscillations, we might encounter some trouble with the readings. This effect will show up when the telemetry techniques are developed at C.I.r.E., I guess that would be next stage.
The outcome should be something like this:
Everything said so far had to do with a physical construction of the line follower. The remaining part will rely on programming. I attach a simple code example which controls the robot at a constant speed following a line virtually with no oscillation. The amount of time devoted to the software hasn’t been large, it is the first programmed and has been running on different robots as its performance seemed to be adequate, having said that you may find any bugs. The overall approach is very straightforward and consists of measuring the distance from the centre of the line, calculate the speed which the line is getting closer or farther away from the centre, multiply these measurements by the constants that tune the robot response, add them all and convert the result into an offset in both motor speeds which generates a rotational movement in combination to the translational displacement.
I have uploaded a couple of videos where the final performance is exhibited, the second one was captured at high-speed (from second 30). The robot is assembled with the longest base and the DC/DC output voltage is 6.4 V.
High-speed video capture (from second 30).
The average speed showed is 210 cm/s. I think in the last Spanish national contest the winner achieved an average velocity of 260 cm/s, although is not totally comparable as the resulting speeds will rely on the type of track. Nevertheless, I believe with this performance one should go through the qualifying sessions and at least get to the two robot stage. We are not going to win with this design, but it wouldn’t be fair to compare a robot whose whole cost could be equivalent to the price of some of a single rival’s motor either. In addition, the top competitors are regulars in these sort of disciplines and their robots have been largely tested.
This is my suggestion for a line follower robot whose intention is to gain an insight into the basic concepts: hardware, components selection and simple programming to track a line, if you require further explanation you could find it here (written in Spanish).
There is still a great deal of work to do on the software development, which could be where a considerable part of the difficulty lies and necessary to carry out if you want to get quicker and more competitive. The set of ideas and strategies is extensive, however my intention is not to enter any competition and so I am not going to work on those, in the current situation it isn’t worth and there are other projects which will demand time and are targeted at C.I.r.E.
For those of you who are entering this hobby I would like to recommend you to share your improvements, it is the only way to learn and provide access to potential hobbyists as well as spreading the competitions. In Spain the fact of being competitive won’t pay off in the current situation, there aren’t enough hobbyists and there is no point in winning a contest which people have forgotten about in a couple of months. Anyway, it may come a day when we will have an actual Robotics community but I am afraid we won’t get it while the main ambition is to collect newspaper cut outs.
I hope the attempt at explaining the construction of a line follower robot will be helpful to someone, that will justify the effort invested during prototype design and testing a few versions…