Smart LED Bus Stop Lighting System

by dankricosh in Circuits > Arduino

127 Views, 1 Favorites, 0 Comments

Smart LED Bus Stop Lighting System

Без названия.png
IMG_2249.jpg

In my first instructable, I will build a small prototype of Smart LED Bus Stop Lighting. The idea to make this project came to me after I was left unnoticeable by another bus driver passing me during a cold evening at a Toronto bus stop. At that moment, I started studying PLC, where I found out about one interesting concept - latching. Also, most of the digital electronic components used in this project have been got from the kits used in my college courses. Obviously, there might be several solutions such as latching relays or another IC, but I used what I had.

Demonstration video👇👇👇

Supplies

Electrical Components:

  • Arduino UNO R3
  • Logic Gates (74LS04, 74LS32, 74LS08)
  • Resistors (330, 1k, 100k)
  • LDR photoresistor
  • PIR motion sensor (Amazon)
  • White LED
  • Pushbutton
  • Jumper wires

Tools:

  • Glue pen
  • Soldering Iron Kit (Amazon)

Electric Circuit

Motion Sensor and LDR to control lights (1).png
Latch.png

Recently, I started studying PLC at my college where I found out about the pretty much simple, but at the same time, useful concept which is known as the latch function. Shortly, the latch function is commonly used in PLC programming to hold a particular output state once it has been activated. Once a latch is set, it will remain in that state until it is reset, even if the input signal that caused it to latch goes away.

What I have decided to use the signal from LDR and a pushbutton to set the latch and the value of the PIR sensor to reset.

Coding


//analog pins
int ldrPin = A0;


//digital pins
int ldrSignal = 4; //this pin is turn activates the latch whenever it is dark enough
int stopSignal = 6; //this pin acts as a stop signal for latch
int pirSensor = 3;

int dataVal; //value to track the ldr's data

void setup()
{
  pinMode(ldrPin, INPUT);
  pinMode(ldrSignal, OUTPUT);
  pinMode(stopSignal, OUTPUT);
  pinMode(pirSensor, INPUT);
  Serial.begin(9600);
}


void loop()
{

 dataVal = analogRead(ldrPin);


 digitalRead(pirSensor);
 digitalWrite(stopSignal, LOW);
 digitalWrite(ldrSignal, LOW);
 
  //when it's dark enough, Arduino make ldrPin high, indicating that the button can be pushed.
  //Otherwise the button can be pressed during the day which is not supposted happen)

  if(dataVal <= 400) {
    digitalWrite(ldrSignal, HIGH);
  }else {
    digitalWrite(ldrSignal, LOW);
  }
 
  if(digitalRead(pirSensor) == HIGH) {
   
  digitalWrite(stopSignal, LOW);
    delay(15000); //the latch will continue for the next 15 seconds and then it will be unlatched
    digitalWrite(stopSignal, HIGH);
   
  }
  //This part is here to check the values from ldr
 Serial.println(dataVal);
 delay(1000);
}

Design

For the bus stop design, I have decided to go with 3D printing. It was making sense financially at the time. Below my designs.