Categories
TUTORIALS

Control the SmartLight based on Other Components

Introduction

This tutorial shows how the Smart Light can work together with vehicle and crosswalk traffic light in the dark environment. We use two boards for the final prototype. One board (board 1) will include the photo resistor, crosswalk traffic light system, PIR sensor, transmitter, and SmartLight associated with the crosswalk traffic light system. On the other board (board 2), we will have the vehicle traffic light system, receiver and Smartlight associated with the vehicle traffic light system.

The tutorial includes three parts:

  1. How Smart Light Works with Crosswalk Traffic Light (Board 1)
PIR Sensor Photo Resister Crosswalk not Allowed
1 There are pedestrians Dark Red light
0 No pedestrians Bright Green Light
 Crosswalk side:

SmartLight = PIR Sensor * Photo Resister*Crosswalk Not Allowed

 Vehicle side:

SmartLight =  SmartLight on Crosswalk * Crosswalk Traffic Light

 

Only when there are pedestrians on the crosswalk and the environment is dark, SmartLight will work. Once the SmartLight is triggered, it will flash at least for 5 seconds from the “start time”. After 2 seconds, it will check if there is pedestrian on the crosswalk again. If there are still pedestrians on the crosswalk, the SmartLight will reset the “start time” to be the current time and will continue to flash for 5 seconds since the new “start time”. Every time it will check if there is a pedestrian on the crosswalk at the end of 2 seconds since its start time is reset.

 

  1. How Smart Light Works with Vehicle Traffic Light (Board 2)
SmartLight on Crosswalk Crosswalk Traffic Light

1

On

Red

0 Off

Green

 

Instead of reading the value from the sensor, the components on the board 2 are simpler. We only have the vehicle traffic light system and SmartLight associated with it. The receiver will return the value of the signal of SmartLight on crosswalk side and the crosswalk traffic light. When the crosswalk traffic light is red, the vehicle traffic light is green. If the SmartLight on crosswalk side is on, that on vehicle side is on as well.

  1. How Photo Resister Works

The photo resister’s resistance varies with the change in light intensity. We use a function to convert light intensity to the output (1/0) to indicate whether it is in the dark environment.

The Components and Set-up

  1. Arduino Board (Uno)*2: here we only use one to show how to control SmartLight and crosswalk traffic light
  2. LED light: to simulate what will happen in real life, we use red LED for red light, use yellow LED for green light. And we use another red LED for the SmartLight. We will replace these components in the next week.
  3. Several wires
  4. Normal Resistors (330 OHM and 10k OHM)
  5. Photo Resistor

Wiring

The board 1 is wired as follows:

For board 1, we mainly have two components: the photo resister and the LED lights (simulate crosswalk traffic light -red and green, and the SmartLight associated with the crosswalk traffic light).

First of all, we connect 5V to (+) on the board, GND to (-) on the board.

Photo resister:

We use the A0 as the photo sensor pin, and connect it to A5. Then, we use E5 and E8 for the two sides of the photo resister. We add a 10k OHM between C1 and C5, and use two wires to connect B1 and (+), A8 to (-) respectively.

LED (three lights):

The wiring for this part is simple and similar. We use three wires to connect (-) to C10, C18, C26 respectively. Then, we connect the negative side (cathode) of the LED1 (red light), LED2 (green light) and LED3(SmartLight) to D10, D18, D26 respectively. There positive sides (anode) are placed at D9, D17,D25. Next, we add three 330 OHM resistors between E9 and G9, E17 and G17, E25 and G25. Finally, we use three wires connect J9 to pin7 (for red light), J17 to pin6 (for green light), and J25 to pin5 (for SmartLight) respectively.

Board 2:

There is no photo resister on the board 2, and the rest part is the same as the board 1.

Code

Board 1:

Board 2:

Video

The video is to show how the SmartLight works together with the crosswalk traffic light system. We assume that it works at night so we remove the photo resister part.

The video is here: https://youtu.be/LZQbpcLSdNA (can’t upload)

 

Leave a Reply

Your email address will not be published. Required fields are marked *