Introduction

In this project I used a few components I had laying around to control 3 incandescent lights. Although a microcontroller may be overkill for this project it made designing the electronics alot easier. The components used are an Arduino UNO, 2 Relay Modules, an SMPS from an old cellphone charger, and a blank PCB for some of the wiring.


Coding and Hardware

Writing the code for this was fairly straightforward. The PIR signals HIGH when it detects motion and this resets a timer to zero on every rising edge. Whenever motion is detected and the timer has not yet elapsed, the relay connecting to the green light turns on. After the first timer elapses the amber light blinks and a second timer starts. If no motion is detected during the second timer the relay connecting to the red light turns on.

Once the software was completed and tested I prepared the rest of the components. I dismantled the SMPS and soldered wires for the 5V into the arduino and for the AC input into the SMPS. All the AC components were connected to a rail on the PCB and then fit nicely inside the traffic light enclosure.


Demonstration

As can be seen in the video the system operates as described and adds a nicely as decoration to a well trafficed room.