As an Amazon Associate we earn from qualifying purchases.
Sensors are the part of a circuit that lets a board “notice” the real world. They turn something physical, such as light, temperature, motion, current or weight, into an electrical signal that a microcontroller can read. This page is a guide to the sensor modules we cover on emergingtechs.org, what each one does, and how to choose between them.
How sensor modules work
Most hobby sensor modules are a small sensing element on a tiny circuit board, often with a few extra components that make it easier to connect. Their output usually comes in one of three forms:
- Analog: a voltage that rises or falls with the thing being measured. You read it with an analog input.
- Digital: a simple on/off signal, often with a small potentiometer on the board to set the trigger threshold.
- Serial or timed signal: a stream of data or a series of pulses that your code has to decode, often with a ready-made library.
Knowing which type you have tells you how to wire it and how to write the code. Always check the operating voltage on the module too, since some run at 5 V and others at 3.3 V.
Sensor types and what they are used for
Temperature and humidity (DHT11)
The DHT11 measures air temperature and relative humidity and sends both values over a single data pin. It is cheap and easy to use, which makes it a common first sensor. Its accuracy and resolution are modest, so it suits room monitoring and learning projects better than anything that needs precise readings. It should also not be polled too often, so read it every couple of seconds at most.
Accelerometer and gyro
An accelerometer measures acceleration, including the pull of gravity, so it can tell you how a device is tilted. A gyroscope measures rotation rate. Together they are used in balancing robots, motion tracking and orientation detection. Both usually talk to the board over I2C.
Color sensor (TCS3200)
The TCS3200 uses an array of light detectors covered with red, green, blue and clear filters. It outputs a signal whose frequency changes with the light level, and you read it by measuring that frequency. It can sort objects by color or tell basic colors apart. Results depend a lot on lighting, so shield the sensor from ambient light and use a consistent light source if you can.
Current sensor (ACS712)
The ACS712 is a Hall-effect current sensor. The current you want to measure flows through the module, and it outputs a voltage that changes in proportion to that current. It can measure both AC and DC. Different versions cover different current ranges, so pick one that matches your load. For AC, you need to sample quickly and calculate an RMS value. Be careful when working with mains voltage, since the module does not make it safe on its own. If you also need to measure voltage, see our guide to Arduino voltage sensors.
Hall effect sensor
A Hall effect sensor detects a magnetic field. Place a small magnet on a moving part and the sensor can count rotations, detect position or act as a contactless switch. It is a good choice for measuring wheel or motor speed because nothing physically touches the moving part.
IR sensors
An infrared sensor pairs an IR emitter with a receiver. It detects whether something reflects the emitted light, so it works for obstacle detection, edge detection and line tracking. Dark surfaces reflect less IR than light ones, which is how a robot tells a black line from a white floor. Bright sunlight can interfere with IR readings. A good practical example is a line follower robot using IR sensors.
LDR (light-dependent resistor)
An LDR, such as the common 5 mm type, changes its resistance with the light that falls on it. Resistance drops as it gets brighter. Wire it in a voltage divider with a fixed resistor and read the result on an analog pin. It works well for night lights, dusk-to-dawn switches and simple light level detection. It is not precise, and it responds slowly compared with other light sensors.
Liquid water flow sensor
A water flow sensor has a small rotor inside the pipe fitting. As water passes, the rotor spins and a Hall sensor produces pulses. The faster the flow, the more pulses per second. Count the pulses over time to estimate flow rate and total volume. You will need to calibrate it against a known quantity of water for good accuracy, and only use it with the fluids and pressures it is designed for.
MQ series gas and alcohol sensors
The MQ family are heated metal-oxide gas sensors. Different models respond to different gases, including alcohol, smoke, LPG and others. They need time to warm up before readings settle, and they draw more power than most modules because of the heater. They are good for detecting that gas levels have changed, but they are not a certified safety device. Never rely on a hobby module as your only protection against a real gas leak.
Ultrasonic sensor
An ultrasonic distance sensor, such as the common HC-SR04 style module, sends out a pulse of sound and times the echo. Distance is calculated from the time it takes to return. It is useful for obstacle avoidance and level measurement. Soft, angled or very small objects can reflect poorly, so test it with the real objects your project will meet. A mounting bracket helps keep it fixed and aimed in the right direction, which matters for consistent readings.
Water sensor
A basic water sensor has exposed traces on a board. When water bridges them, the signal changes. It is a simple way to detect rain, spills or a leak. Because the traces are exposed to moisture, they can corrode over time. Power the sensor only when you take a reading to make it last longer.
Weight sensors (HX711)
Weight measurement uses a load cell, which flexes slightly under load. The signal is tiny, so the HX711 amplifier and analog-to-digital converter sits between the load cell and your board. After wiring it up, you calibrate with a known weight to get readings in grams or kilograms. Mount the load cell firmly and keep the platform level, or the readings will drift.
Sensor guides on this site
These pages cover the individual sensors in more detail:
- ACCELEROMETER ,GYRO & HUMIDITY (DHT11)
- COLOR SENSOR -TCS3200
- CURRENT SENSOR
- Hall Effect Sensor
- HUMIDITY SENSOR (DHT11)
- IR SENSORS
- LDR 5MM
- Liquid Water Flow Sensor
- MQ SERIES (GAS & ALCOHOL)
- ULTRASONIC SENSOR & Mounting Bracket
- WATER SENSOR
- WEIGHT SENSORS -HX711
How to choose the right sensor
Start with what you need to measure, then check the practical details:
- Match the sensor to the quantity. Distance, light, temperature and weight each have a sensor type built for them.
- Check voltage and logic levels. A 5 V module on a 3.3 V board may need level shifting, and the reverse can give unreliable readings.
- Decide how accurate you need to be. A DHT11 is fine for a room display, but a project that needs tighter readings may need a better sensor.
- Consider the environment. Sunlight, dust, moisture and vibration all affect certain sensors.
- Look for library support. A sensor with a well-used library saves hours of debugging.
If you are building on a microcontroller, our list of the best sensors for Arduino projects is a good next step. For projects that react to movement, such as an Arduino security system, motion and door sensors are the usual starting point. If you would rather buy ready-made devices than build your own, take a look at our picks of smart sensors for home automation.
Tips for reliable readings
- Give gas and similar sensors time to warm up before trusting the numbers.
- Average several readings to smooth out noise.
- Use a stable power supply, since voltage dips can shift analog readings.
- Calibrate against something you know, such as a reference weight or a trusted thermometer.
- Keep sensor wires short, or use shielded cable for weak signals.
Frequently asked questions
What is the difference between an analog and a digital sensor?
An analog sensor gives a voltage that varies continuously with what it measures. A digital sensor gives either a simple high/low signal or data in a defined format, which your code reads directly.
Which sensor is best for a beginner?
An LDR, a DHT11 or an ultrasonic distance sensor is a good place to start. They are inexpensive, have plenty of tutorials and are easy to wire up.
Can I use more than one sensor on the same board?
Yes, as long as you have enough free pins and your power supply can handle the load. Sensors that use I2C can share the same two data lines if each has a different address.
Are MQ gas sensors safe to use as a gas alarm?
No. They are useful for experiments and detecting changes in air quality, but they are not certified safety devices. Use a proper approved detector for real safety needs.