The Arduino open-source electronics and embedded processor platform can be used to control and monitor an infrared sensor. IR sensors can be used to detect proximity, receive communication signals and even detect movement of a person. The Arduino can be programmed to monitor an IR sensor and react to a sensed IR level. Whether you choose an IR sensor with a digital output or one with an analogue output, using an IR sensor with your Arduino requires little, if any, external components and only a few lines of code.
- Skill level:
Other People Are Reading
Things you need
- Arduino development platform
Select an IR sensor. There are different types of IR sensors for various purposes, such as remote control, proximity detection, communication and human motion detection. Pick the IR sensor best suited to your application.
Connect the IR sensor to the Arduino. Depending on the type of output provided by the IR sensor that you have selected, choose an appropriate input pin on the Arduino. For example, if your IR sensor outputs an analogue signal, you may want to connect the IR sensor to pin A0 of your Arduino, which can serve as an analogue input pin.
Program the Arduino. Write code to read the IR sensor value that is being input to the pin of the Arduino. For example, if you have an IR sensor with an analogue output connected to pin A0 of the Arduino, you could include a code line such as "int IRsensorValue = analogRead(A0);" in your program. The variable IRsensorValue will contain a value representing the analogue-to-digital conversion of the signal applied to A0.
Test the IR sensor and Arduino together. After you've transferred your program to the Arduino according to the manufacturer's specifications, you're ready to test. To make testing easier, you may want to provide some form of visual output (such as an LED connected to the Arduino) to indicate a change in state of the IR sensor. If your Arduino and IR sensor do not appear to work correctly, check the circuit connections and check your program to make sure your code is reading the correct pin of the Arduino in the correct mode (digital or analogue).
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for