![]() |
The field of view is divided into two zones, a left, positive, zone and a right, negative, zone. At any given time, the sensor value is based on the relative change in the infrared radiation from these two zones. An increase in IR radiation from the left zone will have a positive effect on the sensor value while a decrease in radiation here will have a negative effect. The right, negative, zone has the opposite result on the sensor value. Here an increase in IR radiation will make the value go negative while a decrease in radiation will have a positive effect on the value. This makes it possible to not only detect when something warm moves in front of the sensor, but also the direction that the subject moved.
Let's see what happens if someone walks in front of the sensor.

//================================================ // PIR Graph Program // Graph the PIR Sensor value onto the NXT screen. // #define PIR S2 // Set the PIR Sensor Deadband. The sensor // has a default deadband of 12. void SetSensorHTPIRDeadband(int port, int db) { byte cmndbuf[] = {0x02, 0x41, 0}; // dev, reg int count; byte respbuf[]; // Resp Buf cmndbuf[2] = db; count=0; I2CBytes(port, cmndbuf, count, respbuf); Wait(25); } // Read the HiTechnic PIR Sensor. int SensorHTPIR(int port) { int count; byte cmndbuf[] = {0x02, 0x42}; // dev, reg byte respbuf[]; // Resp buf int pir; count=1; // Read 1 byte if (I2CBytes(port, cmndbuf, count, respbuf)) { pir = respbuf[0]; if (pir >= 128) pir -= 256; } else { // No data from sensor pir = 0; } return pir; } task main() { int x,y,yPrev; int pir; int yLine; SetSensorLowspeed(PIR); SetSensorHTPIRDeadband(PIR, 0); x = 0; while(true) { // Erase one column on all lines for (yLine=0;yLine<64;yLine+=8) TextOut(x,yLine," "); TextOut(0, LCD_LINE1, "+"); TextOut(0, LCD_LINE8, "-"); pir = SensorHTPIR(PIR); yPrev = y; y = 32 + (pir * 32)/128; if (x>0) LineOut(x-1,yPrev,x,y); Wait(20); x++; if (x>=100) x = 0; // Use Center Button pause graph if (ButtonPressed(BTNCENTER,0)) { // Wait for release while(ButtonPressed(BTNCENTER,0)); // Wait for press until(ButtonPressed(BTNCENTER,0)); // and release to restart while(ButtonPressed(BTNCENTER,0)); y = 0; x = 0; ClearScreen(); } } }
Address | Type | Contents |
---|---|---|
41H | byte | Deadband |
42H | byte | Reading |
Lego Mindstorms NXT PIR Sensor
- Brand: HiTechnic
- Product Code:Hitechnic-PIR-Sensor
- Reward Points:69
- Availability:In Stock
-
रo 6,920.00
- Price in reward points:6920
Related Products
Lego Mindstorm Acceleration / Tilt Sensor for NXT / EV3
Now you can make robots that know which way is up! The Accelerometer / Tilt Sensor measures accelera..
रo 6,920.00 रo 7,550.00
Lego Mindstorms Magnetic Compass Sensor for NXT / EV3
Expand your NXT experiences with the new NXT Compass Sensor and add accurate navigation to your Mind..
रo 7,385.00 रo 7,550.00
Lego Mindstorms Infrared Seeker V2 for NXT / EV3
Play robot soccer and zero in on your infrared (IR) beacons with IRSeeker. You can use most TV remot..
रo 6,920.00 रo 6,985.00
Lego Mindstorms Color Sensor V2 for NXT / EV3
Add a spectrum of color to your models with the new and updated Color Sensor. Detect an extended ran..
रo 6,920.00 रo 7,550.00
PICAXE I2C Explorer Kit AXE216
A self-assembly kit for the PICAXE-20X2 (included) for those wishing to interface and experiment wit..
रo 1,350.00
BrickPi+ Base Kit
BrickPi is best for someone who already has LEGO MINDSTORMS sensors and motors. The BrickPi connects..
रo 17,563.00
EV3 Infrared Beacon
This has been designed for use with the EV3 Infrared Seeker Sensor. The beacon emits an infrared sig..
रo 4,425.00
EV3 Infrared Sensor
The digital EV3 Infrared Seeking Sensor detects proximity to the robot and reads signals emitted by ..
रo 4,425.00
EV3 Color Sensor
The digital EV3 Color Sensor distinguishes between eight different colors. It also serves as a light..
रo 5,175.00 रo 5,885.00
EV3 Ultrasonic Sensor
The digital EV3 Ultrasonic Sensor generates sound waves and reads their echoes to detect and measure..
रo 4,425.00
EV3 Gyro Sensor
The digital EV3 Gyro Sensor measures the robot’s rotational motion and changes in its orientation. S..
रo 4,425.00
Lego Mindstorms NXT Magnetic Sensor
The NXT Magnetic Sensor will enable you to build robots that can detect magnetic fields. The sensor ..
रo 2,865.00
Tags: NXT, PIR, Sensor, Lego, Mindstorms