Back to Step by Step Course by Robojax

Lesson 69: Infrared Proximity Sensor E18-D80NK | Arduino Step By Step Course

Part 7: Obstacle Avoidance with Arduino

In this lesson we learn how to use infrared proximity sensor E18-D80NK using Arduino. the module is explained, wiring diagram shown and wiring is explained. Code is fully explained and demonstrated.

wiring diagram for E18-D80NK
  • 00:00 Introduction
  • 01:20 Code Explained
  • 03:21 Wiring Explained
  • 04:27 Demonstration

  /*
* S08-01
* Lesson 69: Proximity Sensor E18-D80NK with Arduino
 * This is the Arduino code for EL18-D80NK Infrared Obstacle Avoidance Sensor
This code is to use E18-D80NK Infrared Sensor to detect obstacle and trigger an
event like starting or stopping motor or servo or relay or anything else.
  Watch instruction video for this code: https://youtu.be/bu0LHgXq7Pw

 *  * 
 // Writeen by Ahmad Shamshiri for Robojax.com on 
// on Feb 22, 2018 at 20:50 at city of Ajax, Ontario, Canada
 
 * Disclaimer: this code is "AS IS" and for indivitual educational purpose only.
 * 
  
  This video is part of Arduino Step by Step Course which starts here: https://youtu.be/-6qSrDUA5a8

 

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon http://robojax.com/L/?id=63

or make donation using PayPal http://robojax.com/L/?id=64
  
 * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
the Wiring:
Brown: 5V DC
Blue:  GNG
Black: Signal, to PIN 2




 * 

*/
#define SENSOR 2 // define pint 2 for sensor
#define ACTION 9 // define pin 9 as for ACTION

/*
 * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: this code is "AS IS" and for educational purpose only.
 * 
 */

void setup() {
  // E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
  Serial.begin(9600);// setup Serial Monitor to display information
  pinMode(SENSOR, INPUT_PULLUP);// define pin as Input  sensor
  pinMode(ACTION, OUTPUT);// define pin as OUTPUT for ACTION
}

void loop() {
  // E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
  int L =digitalRead(SENSOR);// read the sensor 
  
      if(L == LOW){
        Serial.println(" Obstacle detected");
        digitalWrite(ACTION,HIGH);// send singal
    
     }else{

        Serial.println("  === All clear");
        digitalWrite(ACTION,LOW);// turn the relay OFF
     }
  delay(500);
 // E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
}



   

The least I expect from you is to give the video a thumbs up and subscribe to my channel. I appreciate it. I have spent hundreds of hours making these lectures and writing code. You don't lose anything by subscribing to my channel. Your subscription is a stamp of approval for my videos, helping more people find them and, in turn, helping me. Thank you!

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

Right Side
footer