In this tutorial we will learn how to control traffic lights using arduino and Visuino.
This tutorial is great for beginners.
Watch the video.
Step 1: What You Will Need
- Arduino UNO (or any other Arduino)
- Traffic lights module
- Jumper wires
- Breadboard
- Visuino program: Download Visuino
Step 2: The Circuit
- Connect “Traffic lights module” pin [GND] to Arduino pin[GND]
- Connect “Traffic lights module” pin [R] to Arduino digital pin[2]
- Connect “Traffic lights module” pin [Y] to Arduino digital pin[3]
- Connect “Traffic lights module” pin [G] to Arduino digital pin[4]
Step 3: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Arduino UNO” as shown on Picture 2
Step 4: In Visuino ADD Components
- Add “Sequence” component
- Select “Sequence1” component and in the properties window set “Repeat” to: True, this will enable to repeat the whole process over and over meaning the lights will continue to flash
- Double click on “Sequence1” component
- in the “Elements” window drag 3X “Digital Period” to the left
- On the left side of the “Elements” window select “Digital Period1” and in the properties window set “Delay” to 3000 <<This is the time after (3s) for the first light to flash
- On the left side of the “Elements” window select “Digital Period2” and in the properties window set “Delay” to 6000 <<This is the time after start(6s) for the second light to flash
- On the left side of the “Elements” window select “Digital Period3” and in the properties window set “Delay” to 9000 <<This is the time after start(9s) for the third light to flash
- Close the “Elements” window
Step 5: In Visuino Connect Components
- Connect “Sequence1” > “Digital Period1” pin[Out] to Arduino board digital pin[2]
- Connect “Sequence1” > “Digital Period2” pin[Out] to Arduino board digital pin[3]
- Connect “Sequence1” > “Digital Period3” pin[Out] to Arduino board digital pin[4]
Step 6: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 7: Play
If you power the Arduino UNO module, the traffic lights module will start to change colors in a sequence.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu
Download traffic-lights.zip