Arduino Sensors 

Lesson 1

Introduction

This is the first lesson in the Arduino Sensors series. You will learn how to connect and use various kinds of sensors with your Arduino.

About sensors

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
  • Humidity and moisture
  • Vibration
  • Pressure
  • Electrical fields
  • Sound
  • Stretch and stress

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.

What's next

In the lectures in this section, we will play with the following sensors:

  • A photo-resistor for measuring light
  • Combined temperature and humidity
  • Infrared line sensor
  • Barometric sensor for measuring air pressure
  • Ultrasonic sensor for measuring distance to other objects
  • Tilting, so you know if your gadget has fallen over
  • Orientation

How sensors work

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. 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.

"Arduino Sensors" series

Ready for some serious Arduino learning?

Start right now with Arduino Step by Step Getting Started

This is our most popular Arduino course, packed with high-quality video, mini-projects, and everything you need to learn Arduino from the ground up.

Jump to another article in this series.

>