Description: Initially, a PIR Motion Sensor was selected for testing to detect motion in front of the sensor; however, it proved to be insufficiently sensitive. Therefore, a QRD1114 IR Sensor was considered as a substitute. In this test, both sensors were utilized as digital and analog inputs to compare their sensitivity. Objects or surfaces must be within 0.5 cm for detection. This circuit does not differentiate between white and black objects but indicates when an object is at the edge of a surface. To detect differences between white and black surfaces, the input pin on the microcontroller should be connected to an analog-to-digital converter (ADC) or another device capable of interpreting varying voltage levels. A black surface will produce a voltage between 0V and 5V, while a white surface will yield a voltage of 5V. Experimentation is required to determine the specific voltage levels for black and white surfaces. Object and surface detection has been tested, and efforts are ongoing to establish black and white differentiation. The schematic illustrates the connection of the QRD1114 IR Sensor to a PIC18F452 microcontroller. Port D.1 is designated for digital input from the QRD1114's signal, while Port B.7 is used for output to control an LED. Pulse-width modulation (PWM) is employed to gradually illuminate the LED, with brightness dependent on the variable "adcVar," which is directly or inversely proportional to the distance between the reflecting surface and the sensor. In the first code configuration, when the reflecting surface is beyond the detection range (0.5 cm), the sensor reads the maximum adcVar value (theoretically 1023, practically 1016), with a minimum value of 30 instead of 0.
The circuit utilizes a PIC18F452 microcontroller, configured for ADC operations with a 10-bit resolution. The oscillator frequency is set to 20 MHz, and the ADC clock source is defined as RC. The sampling time for the ADC is established at 50 microseconds. The TRISA register is set to all inputs, allowing for analog readings on PORTA. The ADCON1 register is configured to set PORTA as analog input, with the output justified to the right.
The main program loop begins by reading the ADC value from channel 0 into the variable adcVar. The serial output on PORTC.6 displays the decimal value of adcVar, followed by a carriage return. The duty cycle for PWM control is calculated based on adcVar, with two different code configurations available. In the first configuration, the duty cycle is set directly proportional to adcVar, while in the second configuration, it is inversely proportional, allowing for flexible control of LED brightness based on the detected distance from the sensor. This setup enables effective object detection and surface differentiation in various applications, including robotics and automation systems.Initially I chose another infrared sensor for test, PIR Motion Sensor, which was to detect any motion in front of the sensor but it turened out not so sensitive. So that I looked at this QRD1114 IR Sensor for substitute. In this test, I used both as digital and analog input to see what difference it has and how sensitive it is.
Object or surfaces must be within 0. 5cm. This circuit will not distinguish between white and black objects but it will let you know when you are at the edge of a surface. If you want to detect the difference between white or black surfaces, in the circuit the Input pin on the Micro should be an analog to digital converter or some other device that can utilize variable voltage levels. A black surface will give a voltage some where between 0V and 5V and white surfaces will give a voltage of 5V.
Determining the voltage level for your black and white surfaces will require experimentation. I have tested object/surface detection and stiil try to figure out Black/White difference detection. Here is the schematic of how I hooked up QRD1114 IR Sensor to PIC18F452. Portd. 1 is used for digital input from QRD1114 IR Sensor`s signal while portb. 7 is for output to light a LED. Here I use PWM to let LED light gradually. The lighness depends on the variable "adcVar", which is in direct-ratio (code 1) or inverse-ratio (code 2) to the distance between reflecting surface and the sensor. In code one, when the reflecting surface is out of the range (0. 5cm), the sensor will read adcVar in the maximum (It should be 1023 in theory but it`s 1016 in fact. Also, the minimum is 30 instead of 0. DEFINE OSC 20 DEFINE ADC_BITS 10 ` Set number of bits in result DEFINE ADC_CLOCK 3 ` Set clock source (3=rc) DEFINE ADC_SAMPLEUS 50 ` Set sampling time in uS TRISA = %11111111 ` Set PORTA to all input ADCON1 = %10000010 ` Set PORTA analog and right justify output portb.
7 adcVar VAR word dutyCycle var byte main: ADCIN 0, adcVar serout2 portc. 6, 16468, [DEC adcVar, 13] dutyCycle = adcVar/5 pwm portb. 7, dutyCycle, 10 goto main DEFINE OSC 20 DEFINE ADC_BITS 10 ` Set number of bits in result DEFINE ADC_CLOCK 3 ` Set clock source (3=rc) DEFINE ADC_SAMPLEUS 50 ` Set sampling time in uS TRISA = %11111111 ` Set PORTA to all input ADCON1 = %10000010 ` Set PORTA analog and right justify output portb. 7 adcVar VAR word dutyCycle var byte main: ADCIN 0, adcVar serout2 portc. 6, 16468, [DEC adcVar, 13] dutyCycle = (1023-adcVar)/5 pwm portb. 7, dutyCycle, 10 goto main
This is a remote tester circuit designed to test TV and other remote controls. The circuit is simple and utilizes only a few components. The infrared sensor used in the circuit is the TSOP1738. When the infrared waves are received...
This circuit is a motion detection sensor that utilizes a light source and detector as an infrared motion detector. It incorporates components such as a light-emitting diode (LED), a phototransistor, a transmitter, a receiver, an NE555 timer configured as an...
The SB0061 is a pyroelectric sensor module designed for human body detection. It integrates a PIR (Passive Infrared) detector with a Fresnel lens on a compact printed circuit board (PCB), along with an analog integrated circuit (IC) identified as SB0061...
The circuit is depicted in the diagram. It is a control circuit that consists of the infrared-specific integrated circuit KC778B, which serves as the central component. Surrounding it are a pyroelectric infrared sensor head (PIR), a light control and adjustment...
This is a simple update to Mr. Hareendran's PIR Sensor Security Light circuit. It has a shortcoming that limits the relay voltage to approximately 3.3V. While this may function with some 5V relays, it will not function with all.
The PIR...
Construct a device to measure the depth of the flocculent layer in a lake. The flocculent layer is a mud layer with a consistency similar to water, making it challenging to measure its depth from the surface accurately. A referenced...
The focus is on 12 Volt DC powered PIR sensors and their associated circuits, which can be directly powered by a 12 Volt battery charged through renewable energy sources such as wind or solar. This article examines how the low...
The circuit is depicted in the diagram. It is a control circuit that consists of the infrared-specific integrated circuit KC778B, which serves as the central component. Surrounding it are a pyroelectric infrared sensor head (PIR), a light control and adjustment...
The core component of the motion detection circuit is the motion detection chip IC1 (KC778B). The signal frequency from the PIR sensor is low, ranging from 0.1Hz to 10Hz, while the bandwidth is quite broad, which the chip will optimize....
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more