Traffic Light Using a Membrane Keypad and Arduino

by RonFrtek in Circuits > Arduino

223 Views, 1 Favorites, 0 Comments

Traffic Light Using a Membrane Keypad and Arduino

Traffic Light Using a Membrane Keypad and Arduino

In this tutorial we will learn how to control a traffic light using a Membrane Keypad and Arduino.

Also checkout this tutorial: https://www.instructables.com/Arduino-How-to-Control-Traffic-Lights/

Watch the video.

What You Will Need

traffic-membrane-fkeypad.jpg
traffic-light-led.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
arduino.jpg
jumper-wires.jpg
  • Arduino UNO (or any other Arduino)
  • Membrane Keypad
  • Traffic lights module
  • Jumper wires
  • Visuino program: Download Visuino


Brought by PCBWay

2022-08-26_13-41-18.jpg
pcbway.png

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

NEW! Now you can get Aluminum PCB & FLEX PCB in their Special Offer!

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.

The Circuit

2023-03-15_20-08-53.png
  • Connect "Traffic lights module" pin [GND] to Arduino pin[GND]
  • Connect "Traffic lights module" pin [R] to Arduino digital pin[11]
  • Connect "Traffic lights module" pin [Y] to Arduino digital pin[12]
  • Connect "Traffic lights module" pin [G] to Arduino digital pin[13]
  • Connect Membrane Keypad pin [1] to Arduino digital pin[2]
  • Connect Membrane Keypad pin [2] to Arduino digital pin[3]
  • Connect Membrane Keypad pin [3] to Arduino digital pin[4]
  • Connect Membrane Keypad pin [4] to Arduino digital pin[5]

Start Visuino, and Select the Arduino UNO Board Type

FD9ZV5DKU43CVCH.jpg
Visuino-Select-Board-UNO.jpg

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

In Visuino Add Components

2023-01-24_11-02-32.png
2023-03-12_15-01-06.png
2023-03-12_15-01-52.png
2023-02-28_19-47-02.png
  • Add "Keypad" component
  • Add 3X "Digital Multi Source" component
  • Add 3X "Toggle(T) Flip-Flop" component
  • Add "Pulse Generator" component

In Visuino Set Components

2023-03-12_15-04-47.png
2023-03-12_15-07-00.png
2023-03-12_15-07-47.png
2023-03-12_15-08-05.png
2023-03-12_15-08-21.png
2023-03-12_15-09-34.png
  • Select "Keypad1" and in the properties window set "Columns Output Pins" to 3
  • Double click on the "Keypad1" and in the "Keys" window drag 3X "Digital Key" to the left side
  • Close the window
  • Select "DigitalMultiSource1" and in the properties window set "Output Pins" to 3
  • Select "DigitalMultiSource2" and in the properties window set "Output Pins" to 3
  • Select "DigitalMultiSource3" and in the properties window set "Output Pins" to 3
  • Select "PulseGenerator1" and in the properties window select "Enabled" and click on the Pin icon and select "Boolean SinkPin"

In Visuino Connect Components

2023-03-12_15-12-20.png
trafficlight.png
  • Connect Arduino Digital Pin[2] to "Keypad1" > Rows Pin [0]
  • Connect "Keypad1" > Columns Pin [0] to Arduino Digital Pin[3]
  • Connect "Keypad1" > Columns Pin [1] to Arduino Digital Pin[4]
  • Connect "Keypad1" > Columns Pin [2] to Arduino Digital Pin[5]
  • Connect "Keypad1" > Keys > Digital Key1 Pin [Out] to "DigitalMultiSource1" Digital Pin[In]
  • Connect "Keypad1" > Keys > Digital Key2 Pin [Out] to "DigitalMultiSource2" Digital Pin[In]
  • Connect "Keypad1" > Keys > Digital Key3 Pin [Out] to "DigitalMultiSource3" Digital Pin[In]
  • Connect "DigitalMultiSource1" Digital Pin[0] to "TFlipFlop1" pin [Clock]
  • Connect "DigitalMultiSource1" Digital Pin[1] to "TFlipFlop2" pin [Reset]
  • Connect "DigitalMultiSource1" Digital Pin[2] to "TFlipFlop3" pin [Reset]
  • Connect "DigitalMultiSource2" Digital Pin[0] to "TFlipFlop2" pin [Clock]
  • Connect "DigitalMultiSource2" Digital Pin[1] to "TFlipFlop1" pin [Reset]
  • Connect "DigitalMultiSource2" Digital Pin[2] to "TFlipFlop3" pin [Reset]
  • Connect "DigitalMultiSource3" Digital Pin[0] to "TFlipFlop3" pin [Clock]
  • Connect "DigitalMultiSource3" Digital Pin[1] to "TFlipFlop1" pin [Reset]
  • Connect "DigitalMultiSource3" Digital Pin[2] to "TFlipFlop2" pin [Reset]
  • Connect "TFlipFlop1" pin [Out] to Arduino Digital Pin[11]
  • Connect "TFlipFlop2" pin [Out] to "PulseGenerator1" Pin[Enabled]
  • Connect "TFlipFlop2" pin [Inverted] to "PulseGenerator1" Pin[Reset]
  • Connect "PulseGenerator1" Pin[Out] to Arduino Digital Pin[12]
  • Connect "TFlipFlop3" pin [Out] to Arduino Digital Pin[13]



Generate, Compile, and Upload the Arduino Code

Visuino-Compile-UNO.jpg

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.

Play

If you power the Arduino UNO module and press the membrane button, the traffic light module will start to change colors according to the pressed button.

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