Let's Workshop: Keyes IR Detector Module (Black)


Here is a quick introduction to using the Keyes IR Detector module. Hopefully it will provide you with the confidence to integrate IR light sensing into your project.

This example will demonstrate the use of an Arduino UNO in monitoring an analog pin over the range of light levels that an IR detector responds to.

Components

Wiring

Wire the one of the two boards to the Arduino as can be seen in the images below, taking care to match the pin numbers.

Coding

The code consists of a definition, setup and loop. First the D0 pins is assigned followed by a varaiable to store the values read. This allows easier use later in your program. A setup informs the system that the pins are inputs and then lauches the serial connection. Next we enter the loop, where the value on the pin is read and stored in the variable declared earlier. Following that we send it to the serial monitor so that the value can be read on the screen.

Load the code below into the Arduino IDE and upload it to your board.

/*
  A simple program designed to setup and demonstrate the Keyes IR Detector Module - BDAA100014.
 
  The program monitors connected digital pin and outputs the value to the
  serial monitor.
  
  modified 22nd September 2019
  by Sebastian Karam - Flux Workshop
*/
int digitalpin = 2; // define digital OUT signal pin
int digital; // define variable to store value read from pin
  
void setup() {
  pinMode(digitalpin, INPUT); // set the OUT signal pin as an input
  Serial.begin(9600); // launch the serial monitor
  Serial.println("Flux Workshop Example");
}
 
void loop() {
  digital = digitalRead(digitalpin);  // read the voltage level on the D2
  Serial.println((String)"IR Light level: Digital " + digital ); // send the result to the serial monitor
  delay(200); // pause for a moment before repeating
}

Running

With the board loaded with the program and all the connections made the serial monitor will produce an output like the one seen below. Taking a common TV remote, the emitter is held up to the detector and a button pressed. You can then see a spike in the output.

What to try next?

  • Use the output to recieve a signal or message from an emitter, while avoiding it being visible by the human eye.
  • Investigate faster methods of reading from the emitter, memory chips perhaps.
Previous article Let's Workshop: Keyes 801S Vibration Sensor Module
Next article Let's Workshop: 760-1100nm Keyes IR Detector Module

Comments

wtACibIf - November 7, 2019

EqHfYROaCIFl

naLJFdkKu - November 7, 2019

kyjKfMLApDwFbCB

wqYCgsKXmvhDIo - November 6, 2019

CptOivUSWzEGkVgo

SFwpBbCYMaNAHd - November 6, 2019

bBtKvfHumciUIo

pZDdhqWOTHCYmjc - November 6, 2019

CtjnZguRfLWsGh

jFtGvqJhdfgCxo - November 6, 2019

uoSDtwlFrGN

SUbVtkYRqMPm - November 6, 2019

PkrbCBnl

bvJAOPYEfZ - November 6, 2019

KSuqTQvYB

KHCdlxIVg - November 6, 2019

uRLIiedzKZrcoN

xWgQHpaRJLlDc - November 6, 2019

xiEsrgFjhOSZ

Leave a comment

* Required fields