Traffic Light Using A Membrane Keypad And Arduino

About the project

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

Project info

Difficulty: Easy

Platforms: ArduinoVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Membrane Keypad Membrane Keypad x 1
Arduino UNO Arduino UNO x 1
Jumper wires (generic) Jumper wires (generic) x 1
Traffic LED Light module Traffic LED Light module x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

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

Watch the video.

What You Will Need

1 / 5

  • Arduino UNO (or any other Arduino)
  • Membrane Keypad
  • Traffic lights module
  • Jumper wires
  • Visuino program: Download Visuino

Brought by PCBWay

1 / 2

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 assembly,3D printing,CNC machining and a lot more.

The Circuit

  • 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

1 / 2

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

1 / 4

  • Add "Keypad" component
  • Add 3X "Digital Multi Source" component
  • Add 3X "Toggle(T) Flip-Flop" component
  • Add "Pulse Generator" component

In Visuino Set Components

1 / 6

  • 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

1 / 2

  • 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

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 9: 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

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...