There are several different types of sensors.
Right now we'll talk about some simple sensors.
And a lot of simple sensors we'll call Resistive Sensors.
What they do is they change resistance, so they act like resistors.
Okay, but
they are resistors who resist changes according to some environmental effect.
So, I got, you can see on the right side of the slide, I got pictures of
three different resistors, or rather sensors which act as resistors.
And actually, you should have some of these in your kit.
That first one, the one all the way on the left, that's a Photoresistor.
So it just,
its resistance changes according to the brightness, okay, in the room.
The next one is the Thermistor, so
its resistance changes according to the temperature.
And the next one is Flex Resistor and it bends and
its resistance changes according to how much it's bent.
If it's bent a lot then it has a different resistance than if it's straight.
So these are all three sensors.
They sense things about the environment, and the way sense,
the way they transmit information is by changing a resistance.
So remember that our microcontroller, it doesn't sense resistance directly,
it senses voltage.
So we've got to make this, put a circuit around this thing.
Put this thing inside a circuit.
And in that circuit there has to be a voltage which changes when the resistance
of this sensor changes.
So that circuit it is what I'm showing there.
You can see the circuit up there in the top middle.
And the circuit has got, it's basically a voltage divider.
So at the bottom its got a resistor going to ground.
At the top it has this blue box.
Right? This blue box is gonna be a sensor,
one of these resistive sensors.
So it could be a photoresistor, it could be a thermistor,
it could be a flex resistor, it could be any of those.
As long as they are, they basically act as resistors up there.
And the resistances changes according to the environmental effect that you wanna
observe.
Now, [COUGH] you'll remember several lectures ago,
I talked about a voltage divider, actually when I was talking about potentiometers,
I showed a voltage divider.
And that circuit is exactly a voltage divider.
Okay, it's a voltage divider, if you remember a potentiometer.
Right?
It's got two terminals on the top and the bottom,
then it's got this middle terminal between two resistors.
And these resistors, their ratio, the ratio of their resistance,
can change in a potentiometer.
So similar things happening here.
The bottom resistor is just gonna be constant.
Okay, but the bottom resistor is this sensor.
And that changes according to the brightness, lets say of the photoresistor.
Or the temperature of the thermistor.
And so you see between the two resistors you got that point there
that we're observing, that's connected to, say, and Arduino pin.
We're gonna observe the voltage at that point.
And that voltage will go up and
down according to the resistance on that resistor.
So as the resistance changes on that resistor, the voltage will go up and
down and we can detect that.
And we'll have to take that pin, take that observation voltage and
wire that into an analogue pin, one of the analogue pins, A0 through A5 lets say.
And then we will have to call analogue read to read the voltage.
And based on the voltage value that we get, we can tell how bright it is or
how hot it is or something like that.
So that's the idea.
So that's the circuit that we are gonna try and
build around this resistive sensor to be able to read it properly.
So your connecting sensor in a voltage divider, which is that circuit there.
And the sensor itself,
since it's a resistive sensor it is the top resistor in this voltage,
or you can make it the bottom resistor too, it doesn't actually matter.
As the resistance changes the voltage changes according to Ohm's Law.