How sensors work
Sensors are a robot's senses. Each one turns something in the world (light, heat, distance, movement) into an electrical signal that a microcontroller can read as a number.
Two kinds of signal
- Digital: only on or off (1 or 0). A button, a PIR motion sensor or a tilt switch.
- Analog: a range of values. On the TinkerPie V1 (ESP32-S3),
analogReadgives 0 to 4095. A light sensor, a knob or a soil sensor.
Sensors on the TinkerPie V1 board
| Sensor | What it measures and how |
|---|---|
| Light | A light sensor gives more signal in brighter light. Use it for night lights and alarms. |
| Temperature and humidity | Measures the air: temperature in °C and humidity in %. |
| Motion (accelerometer) | Feels tilt and shake by measuring acceleration, including gravity. |
| Distance | Measures how far away something is. |
| Sound | A microphone measures how loud it is. |
| Touch | The π logo notices your finger. |
Popular add-on sensors
- Ultrasonic (HC-SR04): sends a sound pulse too high for us to hear and times the echo. Sound travels about 343 metres per second, so distance (cm) ≈ echo time (µs) ÷ 58.
- PIR motion: notices the heat (infrared) given off by people and animals when they move.
- Soil moisture: wet soil conducts electricity better, so the reading changes with water.
- IR obstacle and line sensors: shine invisible infrared light and measure what bounces back. Black lines reflect less.
- Gas, flame, rain, sound and hall (magnet) modules: each gives a digital or analog signal.
Try them
All 47 accessories work in the simulator in TinkerPie Studio, with sliders for each sensor. See the sensor projects and the accessory guides, or wire them up in TinkerPieCircuit.
More guides: Learn with TinkerPie.