Interfacing Digital IR Sensor Array7 R1

Interfacing Digital IR Sensor Array7 R1

Hi there !
Today I am going to show you how to interface the 7 array sensor by RoboGearsBD.

The most interesting advantage of this sensor array is, you don’t need to manual tune the sensor. You can do it right at the code. 

As usual we connect 5V and GND from arduino to the VCC and GND of the sensor. At last Connect SEN pin of the array to ~3 of Arduino. With this SEN pin we control the sensitivity of the IR’s.

Sensor-pin-connectionNow the code below will give reading of all the sensors.

int sensor1 = 4;
int sensor2 = 5;
int sensor3 = 6;
int sensor4 = 7;
int sensor5 = 8;
int sensor6 = 9;
int sensor7 = 10;

int tr = 3;

int val1;
int val2;
int val3;
int val4;
int val5; 
int val6;
int val7; 

void setup()
{
  pinMode(sensor1,INPUT);
  pinMode(sensor2,INPUT);
  pinMode(sensor3,INPUT);
  pinMode(sensor4,INPUT);
  pinMode(sensor5,INPUT);
  pinMode(sensor6,INPUT);
  pinMode(sensor7,INPUT);

  pinMode(tr,OUTPUT);
  
  Serial.begin(9600);
}

void loop()
{
  analogWrite(tr,255);
  val1 = digitalRead(sensor1);
  val2 = digitalRead(sensor2);
  val3 = digitalRead(sensor3);
  val4 = digitalRead(sensor4);
  val5 = digitalRead(sensor5);
  val6 = digitalRead(sensor6);
  val7 = digitalRead(sensor7);
  
  Serial.print(val1);
  Serial.print(val2);
  Serial.print(val3);
  Serial.print(val4);
  Serial.print(val5);
  Serial.print(val6);
  Serial.println(val7);
  delay(100);  
}

 

Calibration – As I said earlier, the specialty of this sensor is you can calibrate the sensor with code. The SEN pin that is connected to pin 3(pwm pin) is the pin for calibration. Here in the code we set the value to 255 which means no resistance when using a pot. Since you can easily change the value from 0-255 there is no extra hassle of  screw drivers.

Done! You can now see the Digital Values of the sensor reading.

Thank you for reading this tutorial.
Follow me on Facebook Adnan Sabbir


What are your thoughts?