Categories

QRE1113 IR reflectance sensor and Arduino example

The QRE1113 features an easy-to-use analog output, which will vary depending on the amount of IR light reflected back to the sensor. The QRE1113 IR reflectance sensor is comprised of two parts – an IR emitting LED and an IR sensitive phototransistor.

When you apply power to the VCC and GND pins the IR LED inside the sensor will illuminate.

Because dark colors will bounce back less light, the sensor can be used to tell the difference between white and black areas and can be used in robots as a line follower

qre113

qre113

Schematic/Connection/Layout

 

Code

int QRE1113_Pin = 0; 
 
void setup()
{
Serial.begin(9600);
}
 
void loop()
{
int QRE_Value = analogRead(QRE1113_Pin);
Serial.println(QRE_Value);
delay(1000);
}

 

Output

OPen the serial monitor, the lower example readings were when I put my finger over the sensor

729
886
629
1013
1012
1013
1010
51
48
47
1012
1013
1013

 

Links

http://www.onsemi.com/pub/Collateral/QRE1113-D.PDF

QRE1113 Linear Sensor Breakout Board Infrared Reflective Sensor Module Digital Output 3.3V 5V For Line Following Robots

Share

4 channel tracking module and Arduino example

The next module to take a look at is quite often entitled 4-CHANNEL LINE TRACKER SENSOR, thats exactly what it does the module consists of a main module and 4 little sensor/reciever modules that connect via a 3 pin cable


The 4-Channel Line Tracker sensor provides an easy way for line tracking. A line sensor is composed of a number cells and each cell is composed of a sender and a receiver. The particularity of this sender/receiver pair is that it sends light that shall be reflected by the line to be detected but not by the eventually opaque background surrounding this line. Any sender/receiver pair that is able to make a difference between a line and the rest of ground (of a different color) can be used in a line sensor.

VCC pin is connected to 5V , GND pin is connected to the GND, S1, S2, S3, and S4 pins are connected to the digital I/O pins 2 – 5 but you can use others

Applications:

Smart car or a robot hunt (including black and white lines), walking path along the black line, also known as tracking.
Smart car to avoid obstacle and cliff, anti-drop.
Can be applied to other automation applications of photoelectric reflex.

Specification:

Working voltage: DC 3.3V-5V
Working current: try to choose more than 1A power supply
Working temperature: -10°C to +50°C
Detection range: 1mm to 60cm adjustable, the closer the performance more stable, white reflects the farthest distance.
The output signal: TTL level (can be directly connected to I/0 microcontroller, infrared light reflected back to the sensor induction, the red indicator light, output low level; no infrared light, the indicator light does not shine, the output high.)

Module Schematic

Code

/*
Vcc - 5V
Gnd - 0V
IN1 - 4
IN2 - 5
IN3 - 6
IN4 - 7
*/
 
int sensorPin1 = 4;
int sensorPin2 = 5;
int sensorPin3 = 6;
int sensorPin4 = 7;
 
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
int sensorValue4 = 0;
 
void setup() 
{
 pinMode(INPUT,sensorPin1);
 pinMode(INPUT,sensorPin2);
 pinMode(INPUT,sensorPin3);
 pinMode(INPUT,sensorPin4);
 Serial.begin(9600);
}
 
void loop() 
{
 sensorValue1 = digitalRead(sensorPin1); 
 sensorValue2 = digitalRead(sensorPin2); 
 sensorValue3 = digitalRead(sensorPin3); 
 sensorValue4 = digitalRead(sensorPin4); 
 
 Serial.print("Sensor 1 ");  
 Serial.println(sensorValue1);
 Serial.print("Sensor 2 ");  
 Serial.println(sensorValue2);
 Serial.print("Sensor 3 ");  
 Serial.println(sensorValue3);
 Serial.print("Sensor 4 ");  
 Serial.println(sensorValue4);
 Serial.println("***********");   
 delay(1000);
}

Output

Open the serial monitor – block and unblock the sensors

Sensor 1 0
Sensor 2 0
Sensor 3 0
Sensor 4 0
***********
Sensor 1 0
Sensor 2 0
Sensor 3 0
Sensor 4 0
***********
Sensor 1 1
Sensor 2 1
Sensor 3 1
Sensor 4 1
***********

 

Links

F233-01 Four-way infrared tracing / 4 channel tracking module / transmission line / obstacle avoidance / car / robot sensors

Share

KY-036 Metal touch sensor module and Arduino example

This time we look at another one of the sensors in the sensor kit – this time its the KY-35 Metal touch sensor module

Very simple – the touch sensor (mosfet) will generate an output when the metal leg of the mosfet is touched. This is then fed to the LM386 amplifier. The amplifier then sends the data to the analog output pin of the module. We then connect this to an Arduino analog input pin

Schematic

In this example you can see that the ‘metal touch’ is a leg of a

Connection

Easy to connect

Code Examples

Again the best way of testing is a basic analog output to serial example

int touchPin = A0;
int sensorValue = 0;
 
void setup () 
{
  Serial.begin (9600);
}
 
void loop () 
{
  sensorValue = analogRead (touchPin);
  Serial.println (sensorValue, DEC);
  delay (1000);
}

Open the serial monitor and touch the sensor – lower value is when I touched the sensor

1023
383
363
365
355
980
970
970

Another example

int analogInput = A0;
int digitalInput = 3;
 
void setup ()
{
  pinMode (analogInput, INPUT);
  pinMode (digitalInput, INPUT);     
  Serial.begin (9600);
}
 
 
void loop ()
{
  float Analog;
  int Digital;
 
  // Current value will be read and converted to the voltage
  analogValue = analogRead (analogInput) * (5.0 / 1023.0); 
  digitalValue = digitalRead (digitalInput);
 
  // and outputted here
  Serial.print ("Analog voltage value:"); 
  Serial.print (analogValue, 4);  
  Serial.print ("V, ");
  Serial.print ("Touch input:");
 
  if(digitalValue==1)
  {
      Serial.println (" detected");
  }
  else
  {
      Serial.println (" not detected");
  }
  Serial.println ("----------------------------------------------------------------");
  delay (250);
}

 

Links

Free Shipping 1pcs Metal touch sensor module KY-036 Human Body Touch Sensor 100% new original

Share

KY038 Microphone Module and Arduino example

The ky-38 sound sensor is a very basic sound level detector module which features an electric condenser microphone. It is part of  a sensor kit that can be purchased and the main part of the module is an LM393 comparator. There are 2 LEDs on board, one is for power and the other indicates when the sensor reaches a certain value

The board has 2 outputs

  1. AO, analog output, real-time output voltage signal of the microphone
  2. DO, when the sound intensity reaches a certain value, the output goes high

The sensitivity can be adjusted via the potentiometer on the module

Here is a schematic of the module

Connection

This is the basic connection of the Ky-038 module to an Arduino Uno

 

Basic Example

int soundPin = A0;
int sensorValue = 0;
 
void setup () 
{
Serial.begin (9600);
}
 
void loop () 
{
sensorValue = analogRead (soundPin);
Serial.println (sensorValue, DEC);
delay (1000);
}

Output

Open the serial monitor and make noise near the microphone, you should values – the higher the value the louder the noise

165
28
27
29
27
16
228

Another Example

This example will switch on the on board Arduino LED if the analog value exceeds 200.

int soundPin = A0;
int ledPin = 13;
int sensorValue = 0;
 
void setup () 
{
  Serial.begin (9600);
  pinMode (ledPin, OUTPUT);
}
 
void loop () 
{
  sensorValue = analogRead (soundPin);
  Serial.println (sensorValue, DEC);
  //if sensor goes above max light led (could be buzzer)
  if(sensorValue > 200)
  {
    digitalWrite (ledPin, HIGH);
    delay (1000);
  }
  //switch off LED
  digitalWrite (ledPin, LOW);
  delay (1000);
}

 

Links

A very low cost module, comes in under $0.50

KY-038 4pin Mini Voice Sound Detection Sensor Module Microphone Transmitter

The set of sensors cost about $10

37 IN 1 sensor kit for Arduino starter kit high-quality (Works with Arduino Boards) landzo

Share