In this tutorial we will be using an IR proximity sensor. We are going to program our surilli with a very basic program for line sensing. This program detects line(black and white), while value of sensor is 1, it indicates that it is a Black line, and when white line is detected its value becomes 0.
This IR Proximity Sensor is a multipurpose infrared sensor which can be used for obstacle sensing, color detection, fire detection, line sensing, etc and also as an encoder sensor. The sensor provides a digital output.
In this case, the sensor outputs a logic one (+5V) at the digital output when it detects Black line in front of the sensor and a logic zero(0V), when there is white line in front of the sensor. An on board LED is used to indicate the presence of black and white. This digital output is directly connected to surilli wifi.
STEP 1:Setup Arduino IDE for Surilli
Make sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if everything is working fine).
STEP 2: Thecircuitry:
The circuitry is very simple. It's mostly the programming and it involves adjustment of potentiometer, which will be described in step 4. Follow the Figure 1 to setup your hardware.
STEP 3:Upload & Burn Code Onto Surilli
- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
- After it is uploaded, the IR sensor will start working.
- Observe your results on serial monitor of Arduino IDE.
Adjust the potentiometer (distance adjust) located on your IR sensor according to your requirement.
Play with the program to see how it reacts to different values and logic. This will develop your understanding about IR sensor so you can use them in your practical application.
If you make something fun and interesting do share it with our community :)
That’s all for now. If you have any queries, visit surilli.io or contact our support. Stay connected with Surilli family for more amazing stuff :)