- Stock: In Stock
- Model: IR Speed Sensor Module
- Weight: 8.00g
- Dimensions: 32.00mm x 14.00mm x 7.00mm
- SKU: 3751
Introduction
The Infrared Speed Sensor Module is an IR counter that has an IR transmitter and receiver. If any obstacle is placed between these sensors, a signal is sent to the microcontroller. The module can be used in association with a microcontroller for motor speed detection, pulse count, position limit, etc.
Speed-sensing is very important in industrial applications in which process control require precise speed control of production belts to control the rate of manufacturing and also in robotics and autonomous system to determine the exact position of the arm or the tool and its movement. In industry, we use two types of speed sensors: magnetic induction and infrared. This 4 Pin Infrared Speed Sensor Module is used in speed control applications where you need to read the rotation of a disk. It is powered by any of the 3.3V or 5V supplies and gives digital output, which you can easily read with the help of the interrupt function on your microcontroller or development board.
- LM393 Comparator onboard to give digital output
- Low power requirement
- Sensor output is High when the object is detected in the groove; otherwise, Low
- 4 Pins VCC, GND, Dout and Aout
- Working Voltage: 3.3 to 5 VDC
Principle
The speed sensor module is mainly used to detect changes in rotational speed or velocity. When an object passes by the H2010 sensor, it generates a pulse signal. The integrated LM393 comparator inside the module compares this pulse signal with a preset threshold, producing a stable high-level output signal.
The Infrared Speed Sensor Module has 1 H2010 photocell, which consists of a phototransistor and an infrared light emitter packaged in a 10 cm wide black plastic housing.
When operating, the infrared light-emitting diode continuously emits infrared light (invisible light), and the photosensitive triode will conduct if it receives it.
Module Schematic Diagram
Usage
Hardware components
Arduino Uno R4 or R3 board * 1
Infrared Speed Sensor Module * 1
Jumper Wires
Circuit Assembly
Code
Code explanation
Setting up the pins and initializing variables. Here, we define the pins for the motor and the speed sensor. We also initialize variables that will be used to measure and calculate the speed of the motor.
// Define the sensor and motor pins const int sensorPin = 11; const int motorB_1A = 9; const int motorB_2A = 10; // Define variables for measuring speed unsigned long start_time = 0; unsigned long end_time = 0; int steps = 0; float steps_old = 0; float temp = 0; float rps = 0;
Initialization in the
setup()
function. This section sets up the serial communication, configures the pins’ modes, and sets the initial motor speed.void setup() { Serial.begin(9600); pinMode(sensorPin, INPUT); pinMode(motorB_1A, OUTPUT); pinMode(motorB_2A, OUTPUT); analogWrite(motorB_1A, 160); analogWrite(motorB_2A, 0); }
Measuring the motor’s speed in the
loop()
function. In this segment, the motor’s steps are measured for a duration of 1 second. These steps are then used to calculate the revolutions per second (rps), which is then printed to the serial monitor.millis()
returns the number of milliseconds passed since the Arduino board began running the current program.void loop() { start_time = millis(); end_time = start_time + 1000; while (millis() < end_time) { if (digitalRead(sensorPin)) { steps = steps + 1; while (digitalRead(sensorPin)) ; } } temp = steps - steps_old; steps_old = steps; rps = (temp / 20); Serial.print("rps:"); Serial.println(rps); }
IR Speed Sensor Pin Configuration
There is 4 pins are available on the infrared speed sensor module. With the connections of A0, D0, Gnd and Vcc.
Pin Name | Description |
---|---|
VCC | This pin is used to supply power to the sensor. The recommended voltage range is usually between 3-5 volts. |
GND |
Tags:
Arduino
, Infrared Sensor
From Same CategoryThe product is currently Out-of-Stock. Please enter your details below and we will notify you as soon as the product is available.
Name
Email
Phone
Comments
|