Table of Contents
- IR Barrier Beam Concept
- Components
- Entry-Exit Counter Logic
- Arduino Counter Code
- Gate Integration
- Indian Parking Context
- FAQ
IR Barrier Beam Concept
An IR barrier beam system uses an infrared transmitter on one side of a lane and IR receiver on the other. When a vehicle passes, it breaks the beam, triggering a counter or alarm. Unlike PIR sensors that detect heat, IR beams are directional and immune to ambient temperature changes – ideal for outdoor Indian parking lots in summer heat (40-45 degrees C). Two beams placed 2-3m apart in the same lane allow direction detection: the beam that breaks first determines whether the vehicle is entering or exiting.
Components
- 940nm IR LED emitter + IR phototransistor pairs (Rs 5-15 per pair)
- LM393 comparator IC for reliable threshold detection
- Arduino Uno or ESP32
- 16×2 LCD with I2C for space count display
- 3-colour LED or WS2811 LED strip for Full/Available indicator
- Relay module for gate barrier control (Rs 20-50)
- IP65+ weatherproof enclosure for outdoor transmitter/receiver units
Entry-Exit Counter Logic
Place two IR beam pairs 2m apart: Beam A (outer/road-side) and Beam B (inner/parking-side). Entry: Beam A breaks first, then Beam B within 3 seconds = count +1. Exit: Beam B breaks first, then Beam A = count -1. Timeout resets the sequence if only one beam triggers (stationary vehicle, debris, animal).
Arduino Counter Code
#define BEAM_A 2
#define BEAM_B 3
#define GATE 8
int count=0, maxSpaces=20;
bool aTriggered=false;
unsigned long aTime=0;
void setup(){
pinMode(BEAM_A,INPUT_PULLUP);
pinMode(BEAM_B,INPUT_PULLUP);
pinMode(GATE,OUTPUT);
}
void loop(){
bool a=(digitalRead(BEAM_A)==LOW);
bool b=(digitalRead(BEAM_B)==LOW);
if(a && !aTriggered){ aTriggered=true; aTime=millis(); }
if(aTriggered && b && (millis()-aTime)<3000){
count=min(count+1,maxSpaces);
aTriggered=false;
if(count<maxSpaces) openGate();
}
if(aTriggered && (millis()-aTime)>3000) aTriggered=false;
}
void openGate(){ digitalWrite(GATE,HIGH); delay(5000); digitalWrite(GATE,LOW); }
Gate Integration
Connect relay to parking barrier gate control input. Most Indian parking barriers have a 12V trigger input: apply 12V for 500ms to open. The relay NO/COM contacts bridge to this input. Add a separate exit loop at the exit lane for automatic exit without pressing a button. Once the exit beam breaks, keep gate open for 6 seconds before closing to allow the full vehicle to pass.
Indian Parking Context
- Two-wheelers vs four-wheelers: Indian parking lots accommodate both. Mount IR beams at 30-40cm height for two-wheelers or 50-70cm for cars only. For mixed parking, use two beams at different heights.
- Monsoon flooding: Ground-level IR transceivers flood during heavy monsoon. Mount in IP65 weatherproof boxes at 20cm+ above typical flood level.
- Dust and pollution: Indian roads generate high dust levels. Clean IR lens surfaces monthly. Enclosed transceivers with sealed glass window reduce cleaning frequency significantly.
Frequently Asked Questions
What is the maximum beam distance for IR barrier sensors?
Standard 5mm IR LED/phototransistor pairs work reliably up to 2-5m outdoors. Beyond 5m, use focused IR beam modules with lens (commercial photoelectric beams) that reach 20-100m. For a typical parking lane (3-6m wide), standard pairs are sufficient.
How do I prevent false counts from slow-moving motorcycles?
Add minimum break duration filter: count as valid vehicle only if both beams trigger in sequence within 0.5-10 seconds. If a beam stays broken for more than 15 seconds continuously, assume a stationary object blocking the beam and reset without counting.
Can I connect this to an apartment management app?
Yes – replace Arduino with ESP32 and add a web server with JSON API returning current count and available spaces. Most Indian apartment management apps (NoBrokerHood, MyGate, Apna Complex) offer API integration for third-party sensors.
Why does my counter over-count large trucks?
Large vehicles with complex shapes can create multiple beam-break events. Add a holding time filter: after first valid entry sequence, ignore all triggers for 5 seconds before counting again. This prevents multi-counting of articulated vehicles or vehicles with roof racks.
Add comment