Principle
We will first look at the principle of this system, how it works.
First, I want to clarify something simple but important:
- An analog voltage is a voltage that varies and has an infinite number of states
- A digital voltage is a voltage that has only two states, both states 0 and 1 represented in many cases, we chose to represent the 0 state by 0V and 5V by a
To receive our white line, so we need a sensor, we will use photodiodes, they catch the light and converts it into an analog voltage. Thus, when the photodiode is above the dark area, it will return a small analog voltage, and when it is above the white line, it will return a strong analog voltage.
However, if we want to capture the position of the line we will need several photodiodes! Assuming that our white line is 2 cm wide, we will have several photodiodes online on a length of at least 8 cm to make it effective, spaced from each other of 1cm, which 8 photodiodes need us:
Well we have our analog voltage somewhat weak depending on the position of our photodiode in the dark or white, how will we use it? You should know that the calculators upstream of this system will work more with voltages digital logic circuits or any microcontroller work with digital tension. We'll have to then convert this analog voltage into digital voltage! This is where the real mail comes in!
To summarize the operation of our system here is a diagram:
Finally, let me emphasize that we have eight photodiodes so after the analog-digital conversion we will have 8 times 0 or 1 because each photodiode will send information that each will be converted to digital. So our system will return a word of 8 bits (8 digits equal to 0 or 1).
We consider that the value of a digital means is on the line, and the value 0 means is not on the line.
So if our reference:
- 01100000: that the line is on the left of the robot. The robot will then turn to the left to center the line in the middle of the robot.
- 00000011: that the line is on the right of the robot, it must then turn to the right!
- 00011000: the line is in the middle of the robot, it's perfect! Heading straight!
- 00000000: oh oh, we lost ^ ^ we see over the line, but where are we?
- An analog voltage is a voltage that varies and has an infinite number of states
- A digital voltage is a voltage that has only two states, both states 0 and 1 represented in many cases, we chose to represent the 0 state by 0V and 5V by a
To receive our white line, so we need a sensor, we will use photodiodes, they catch the light and converts it into an analog voltage. Thus, when the photodiode is above the dark area, it will return a small analog voltage, and when it is above the white line, it will return a strong analog voltage.
In fact, the photodiode voltage does not return, but behaves like a current generator, however, we will study an assembly that will allow information from the photodiode to create a voltage change.
However, if we want to capture the position of the line we will need several photodiodes! Assuming that our white line is 2 cm wide, we will have several photodiodes online on a length of at least 8 cm to make it effective, spaced from each other of 1cm, which 8 photodiodes need us:
Well we have our analog voltage somewhat weak depending on the position of our photodiode in the dark or white, how will we use it? You should know that the calculators upstream of this system will work more with voltages digital logic circuits or any microcontroller work with digital tension. We'll have to then convert this analog voltage into digital voltage! This is where the real mail comes in!
To summarize the operation of our system here is a diagram:
Finally, let me emphasize that we have eight photodiodes so after the analog-digital conversion we will have 8 times 0 or 1 because each photodiode will send information that each will be converted to digital. So our system will return a word of 8 bits (8 digits equal to 0 or 1).
We consider that the value of a digital means is on the line, and the value 0 means is not on the line.
So if our reference:
- 01100000: that the line is on the left of the robot. The robot will then turn to the left to center the line in the middle of the robot.
- 00000011: that the line is on the right of the robot, it must then turn to the right!
- 00011000: the line is in the middle of the robot, it's perfect! Heading straight!
- 00000000: oh oh, we lost ^ ^ we see over the line, but where are we?
Theory
Now study the patterns of electrical positioning system!First we will look to the photodiodes and the components that will surround it. A photodiode can be considered as an almost ideal current generator. This current varies depending on the light detected by the photodiode. Here the curve of a photodiode:
To set an operating point with a given value Vd (voltage across the photodiode), the photodiode provides a current which varies depending on the light output (P1, P2, P3, P4). However, this current is very low. So we have to be able to amplify the exploit then so be it cross resistance for a voltage change rather than a change in current.
How will we do to boost the current of the photodiode?
We will use an operational amplifier!
Here is the setup used for photodiode:
Vs now calculate to see if this pattern is consistent with our expectations. The operational amplifier that V + = V, one can easily calculate V + through the voltage divider: . The current flowing in the photodiode is equal to that passing through the resistance of 2.2M. We therefore with (Ohm's law). This gives us with the current flowing through the photodiode. As shown in the curve of a photodiode, the current is negative when it works in reverse. This circuit is correct and provided a tension that goes up when the light output will be higher. As a bonus, here is a graphic study of our output voltage:
ip with the current in the photodiode amp and orderly and the output voltage Vs assembly in volts and horizontal axis.
Now that we have the perfect fit study that deals with making exploitable information from the photodiode, we'll see how to convert the analog voltage output digital voltage.
Well, for this problem, we will use a dial! A comparator is a logic circuit (not programmable) that compares the voltage of one of its terminals with a different voltage to another of its terminals, according to this comparison, an internal switch opens or closes. Call V-V + and two terminals.
If V + - V-> 0 the switch is open.
If V + - V-<0 the switch is closed.
You can imagine can not be, but all the technique in our system revolves around this circuit, the LM339, which in fact comprises four modules designed as above (since they convert to 8 photodiodes, we will therefore LM339 actually two).
We will apply our analog voltage of a photodiode at terminal V +, we will set V to some value that will be a good compromise between "the photodiode sees the line" and "not see the photodiode line." But you can be better understood with the graph that represents the analog voltage that gives us a photodiode according to the light detected:
If we apply our model, when the analog voltage of the photodiode is above Vref (Vref is the same voltage as V, it's just that I decided to change its name because it is a reference voltage that defines the boundary between the two areas) the switch will compare our open below Vref, the switch will be closed.
Maybe you already have, but we get closer to what we want, a switch that can be either open or closed depending on the voltage of the photodiode does not he represent two and only two state: open or closed?
For the remainder of this chapter in order to reduce the diagrams, we will consider the whole system seen above in order to capture the light will be represented by a single photodiode.
We have just completed our circuit diagram:
We will now address the case of Vref, in fact, as the calculation is a bit boring, we will not calculate an ideal Vref with the doc and technical characteristics of the photodiode, we will rather create a small system simple that can change the value of Vref on the ground using a potentiometer, a variable resistor is understand that we can change the value with our hands! Who says said voltage variable resistor we will be able to vary! There will be more than the fixed on the ground, you will see we will come back and it's a breeze.
Here is the mini mount that will allow us to wring the shot at Vref:
Vref with this will be worth a value between 0 and 5V depending on how it will fix the value of the potentiometer.
Go you put all that butt!
Well now, if we took care of that output which should be equal to 5V (1) or 0V (0)! Well we will put a resistance known as "pull up". Let us not forget that when you have to have 1, the switch is open and when we must have 0 the switch is closed. We will also add to the small loupiote (LED) that will allow us to see where that line is detected. You will understand with these patterns:
Here's what happens on a bright area on the white line:
Here's what happens on a gray area:
Assemble all these bricks to create a final drawing:
I took the opportunity to add a high luminausité LED so that the light is properly reflected on the white line. It must be physically very ready for more photodiode.De I calculated the resistance output of the LM339 appropriate (given that we want in the 20mA LED).
These diagrams show what happens to a single photodiode, for the full format it is necessary to make 8 times this pattern next to each other.
No comments:
Post a Comment