A sensor is a device which detects or measures a physical property and records, indicates or otherwise responds to it.
Digital sensors give us output in the form of HIGH or LOW signal.
When it detects a phenomenon it gives a HIGH output else a LOW output signal.
Few examples of digital sensors are-IR Sensors, Digital Sound Sensors, Digital Temperature Sensors etc.
We will interface an Infrared Sensor module.
It basically works as an obstacle detector.
Let us learn how to interface an IR (infrared) sensor.
- IR sensor module 1No.
- Arduino UNO 1No
- Connecting wires.
After making the circuit connections dump the code given below.
int irpin = 2;
int ledPin = 13;
int irValue = 0;
irValue = digitalRead(irpin);
In case your module is working opposite just interchange the HIGH and LOW instructions in the code.
As some modules on detection give 1 others 0 as output.
Below is the output of a sound sensor. Since it’s a digital sensor the circuit connections and interfacing code remains the same.
IR sensor has wide applications you can use them for designing counters, obstacle detectors etc.
IR sensor module has an on-board pot which can be used to adjust sensitivity by altering the resistance.