Interpolation and sensors: Linear deviation?

Since we figured out a way to obtain a deviation by interpolation and the intention is to apply PID regulation on this deviation, we now want to know that it works properly. cover iphone outlet In this respect it's important that the deviation changes linear when the robot would be shifted perpendicular to the line. samsung custodia outlet This is what we tested:

Linear deviation after interpolating between sensor values








The fact that the deviation calculated by the microcontroller is linear is important because the PID principle expects this kind of input. custodia huawei p smart In case that the change of deviation wouldn't be linear we wouldn't get a effective PID regulation.

An other possibility to improve the working of the whole sensor was to vary the height of the sensors opposite to the subsoil. custodia samsung s7 edge At first the sensors stood very near to the subsoil.

Voltage regulators and DC-to-DC converters

Because we don't want the precision of the sensors or the efficiency of the steering part of the robot influanced by a decreasing voltage from the batteries, a constant voltage to feed the sensors and the microcontroller is desired.

In order to obtain this we have several options.

Steering part with 3.3V obtained with a voltage regulator:

The voltage we intended to work with was 5V coming from four AA batteries. The main problem is that when the batteries approach their expiration, the voltage will sink under 5V and the risk of deranging the sensors and the matching program is probable. cover iphone 6 plus custodia That's why it's designated to regulate the voltage to a lower voltage, 3.3V, and adapt the steering part and the sensors to this voltage in order not to be exposed to that kind of problems again.

Up to now we always tested with a voltage of 5V. samsung custodia outlet Ofcourse multiple changes are to be made when the voltage over the sensors and the microcontroller is changed. For instance the resistance to go with the sensors will be changed to get the optimum result.

The resistors replacing 10kΩ resistors, placed together with the photodiodes, will now hold a value of 5.6 kΩ. cover iphone custodia outlet With this resistance again clear differences will be measured.

Also the resistance to go with the LEDs of the sensors will change because now a lower voltage is available. custodia huawei shop Because those LEDs have a forward voltage from 3.2V to 4V no resistor is needed.

The IR emitter and the green LED have together a forward voltage of ± 3.3V. custodia samsung s7 edge Also here the resister can be left out.

Fortunately all the features are working when 3.3V is used, this makes a voltage of 3.3V for the steering of our robot a reasonable solution.

Steering part with 5V coming from 9V and a voltage regulator:

By using a battery holder fit for six AA batteries a voltage of 9 Volt is obtained. iphone cover original The voltage will never sink under 5V. cover iphone 8 plus custodia outlet So by using a voltage regulator the voltage can be set on a constant 5V voltage.

An inconvenient disadavantage is that a big battery holder is harder to install on our rather small robot.

On the other hand earlier tests showed that all features work perfectly with 5V.

Steering part with 5V coming from 6V and a DC-to-DC converter:

Some DC-to-DC converters, like the SEPIC or the buck-boost converter, can convert a voltage up or down. These converters are used to convert voltages to a constant voltage, like the voltage coming from a battery which can be set on a constant voltage even though the input voltage drops beneath the wanted output.

This means using this kind of converters it would be possible to work with a constant 5V voltage when using four AA batteries (6V) without the functionality of the robot endangered near the expiration point of the batteries.

These converters are quite expensive and are not really necessary when we're going with one of the previous options.


Because the robot we are constructing ought to be small, we want to use a small battery holder. We opt for the simplest and the most inexpensive posibility.

Microcontroller found

The 'ATMEGA48-20AU TQFP32' is an 8-bit microcontroller from Atmel. custodia samsung s7 edge This component is SMD, cover samsung custodia 20 MHz clock speed, samsung custodia a 16-bit timer and two 8-bit timers.







It looks like the features of this microcontroller will be sufficient and thus this microcontroller would fit in our project.

Choosing a microcontroller

In order to choose a microcontroller we need to know how fast our robot needs to read the values from the sensors and adjust output values to drive the motors, without problems occuring or the robot riding off the line. custodia de samsung galaxy We found out the maximum time to do this and to keep the robot out of problems is 4.6 milliseconds.

The maximum time will determine the choice of our microcontroller. We need to use one that is fast enough to execute the main program loop in this time.

We thought about what the program would look like and can now estimate which microcontroller clock speed we need. With an Arduino Uno, which has a clock speed of 16 MHz, we tested and timed the program. The time we needed to run the program was about 1 ms, this means the Arduino Uno would be fast enough. cover samsung custodia Although the program isn't complete yet, we can make an estimate. We thought if we'd double this time we'll get a good view of the time we need to know.

So a microcontroller with a clock speed of 16 MHz or faster suffices. To be completely safe we'll probably take a microcontroller that is a bit faster.

Besides the microcontroller's speed also the presence of an AD convertor, two 8 bit timers and the availability of enough input and output lines are will determine the choice of the microcontroller.


Calculation: the maximum time for the program

The trail our robot is expected to follow, will have bends with a minimum radius of 10m. custodia huawei outlet In order not to miss the bend, the robot needs to adjust fast enough.

Now assume we have a row of sensors that has a width of 3.5\,cm and that the line is located in the middle beneath this row. The equation of a circle:

\left(x-x_0\right)^2 + \left(y-y_0\right)^2 = r^2

With x_0 and y_0 the coordinates of the middle of the circle.

The line itself has a width of 1.5\,cm, this means the radius of the outer border of the line is equal to \frac{\left(10\,cm + 1.5\,cm\right)}{2}=10.75\,cm.

\left(x-10\right)^2 + y^2 = 10.75^2

In our argumentation we assume that when the outer right sensor will still detect the black line, than the robot will be able to adjust in time. custodia samsung The sensor will have an x-coordinate of 1.75.


When the robot will drive straight on, than the robot will reach a point where the outer sensor will pass the black line. custodia iphone This is the moment of alert.

time=\frac{Distance\,\, travelled}{Speed}


When supposed that the speed is 2\, \frac{m}{s}, which will be the speed of the robot at maximum, we can calculate the time:

t=\frac{5.65\, cm}{200\,\frac{cm}{s}}=34.46\, ms

To be certain the microcontroller will be fast enough we divide this time by 10. custodia samsung shop This will assure us that the robot will adjust far before things are going wrong.

LDR sensors for line following?

We're doing the same test we did with the infra-red sensors, samsung custodia outlet but now we're using LDR sensors instead of IR sensors.

This means we're holding the LDR above a white or black paper as well as a LED and we read the value returned from the LDR. samsung custodia outlet The whole is shielded against environmental a box.







Curious about the difference between the values we get from black or white paper, cover custodia samsung we were also paying attention to the steadiness of the value.

Infrared sensors for line following?


In order to know if infra-red sensors would be a good choice to use in our robot as our line-trackers, cover custodia huawei we tried to read analog values coming from an infrared-sensor, once with a black paper and once with a white one.

Curious about the difference between the values we get from black or white paper, custodia samsung s8 we were also paying attention to the steadiness of the value. cover iphone outlet Big fluctuations are not wanted.







The infra-red sensors were held just above the paper and was shielded for environmental light by simply placing a box over it. iphone 8 plus custodia Under the paper tinfoil was placed to reflect the infra-red.

At the same time also tests with IR communication were going on. cover iphone 8 custodia outlet Our robot will also use IR communication,

Estimated time needed to accelerate from 0 m/s to 2 m/s

Now that a motor is proposed, we tried to estimate the time that the final robot would need to accelerate to its top speed.

Our angle of incidence was the law of conservation of mechanical energy. cover samsung custodia Ofcourse we could only guess what the weight of our future robot would be, but notheless we believe that this calculation is usefull.

Our conclusion is that the robot would need only 0,42 seconds to do this acceleration which is quite fast.


Estimated time needed to accelerate from 0 m/s to 1 m/s

Law of conservation of mechanical energy:

K_2 + U_2 = K_1 + U_1 + W

In our case U_2 = U_1 = 0\,J. cover iphone 6 plus custodia outlet There’s no significant gravitation energy, no elastic energy, … This means work is equal to the change in kinetic energy.


The robot accelerates from stand. cover custodia iphone He has not gained any speed yet, so there’s no kinetic energy


Now we can calculate the work needed to accelerate to 2\frac{m}{s}, at least when we know the mass of the whole robot. custodia de samsung galaxy For now we estimate the weight at 0.3\,kg.

W=m\frac{v^2}{2}=0.3\,kg \frac{\left(2\frac{m}{s}\right)^2}{2} = 0.6\,J

We intend to use two DC motors, a pololu metal gearmotor. cover iphone 6 plus custodia This motor depends on the following specifications: 120 mA free-run at 6V.