010 L6-Intro-To-Sensors-Notes
010 L6-Intro-To-Sensors-Notes
Lecture 6
About sensors
!
With the basics right behind us, we can now move on to the next set of lectures where you
get to learn about how to connect and use various kinds of sensors with your Arduino.
Sensors are the eyes and ears of machines: they provide environmental data. There are all
sorts of sensors, some more exotic than others. Here's a shortlist from Wikipedia:
• Light
• Motion
• Temperature
• Magnetic fields
• Gravity
• Vibration
• Pressure
• Electrical fields
• Sound
Clever gadgets combine multiple sensors in order to capture a more complete snapshot of
their environment. This is similar to our human perception of the environment that is based
on multiple senses, like sight and hearing.
Each sensor that is attached to a machine requires processing power. The more sensors
attached, the greater the processing requirements on the machine. In the Arduino Uno, the
ATMega328 micro-controller is a simple computer running at a clock speed of 16MhZ
(mega-hertz). This means that this Arduino can process roughly 16 million instructions every
second. This processing resource has to be shared between all the things that your Arduino
is supposed to do, like reading values from its sensors, doing calculations, updating a
screen or other outputs, communicating with other devices, and interacting with the user.
The Arduino is fast, but it has a limit, and your design must take that into consideration.
1
Peter Dalmaris Lecture 6 Arduino Step by Step
In the lectures in this section, we will play with the following sensors:
• Orientation
Simple sensors, like the photo-resistor for measuring light, work by measuring the voltage
they provide to one of the analog sockets in the Arduino. You can do this by using the
analogRead function (the opposite of the analogWrite function that we saw in the last
lecture, Lecture 5). Other sensors are a bit more involved, and they require special software
libraries to work with the hardware. More often than not, however, these libraries are very
easy to learn and they provide useful extra features at no additional cost.
Let's get right into it, and have a look at the photo-resistor.