Multiplexing Principles using Traffic Lights

Multiplexing Principles using Traffic Lights

Multiplexing constitutes a technique to optimize the control of sequential hardware. This technique uses less controllers to handle switching and improves the maneuverability. Since each sequence have equal operation, it's preferred for driving in LEDs, 7 segments displays and many more. An example will be shown with traffic lights.

Featured Image: Traffic Light. Respectfully borrowed from Wikipedia.

Don't forget to check out the guide to connect the PICkit to any microcontroller. If you desire to learn more about 8-bit PIC microcontrollers for beginners, click here to see the related posts.

How Multiplexing came to be

Let's see it clear with an example. Suppose that you have a few traffic lights that you need to command. That is to say, you need to give the state information to operate to every light (red, yellow and green for instance). Perhaps giving one cable or one port per light is required; in such case controlling one traffic light seems pretty straightforward, right? But as more traffic lights are added, complexity is increased.

Traffic Light. Respectfully borrowed from Wikipedia: https://en.wikipedia.org/wiki/File:Modern_British_LED_Traffic_Light.jpg

Traffic Lights before multiplexing

Let's picture one traffic light and let's think how it could be driven.

Traffic Lights before multiplexing
A typical traffic light.

The image above represents 3 resistors and 3 LEDs; one per color. The quickest way to control these lights is by attaching each of them to a pin in a microcontroller. In addition, each pin controls individually each light; namely, pin R, Y and G. It sounds simple, right? It is, until more traffic lights are added.

How does it looks like with a group of 4 traffic lights?

Traffic Lights before multiplexing

As shown in the image above, the number of pins required by the microcontroller increases considerably. For every traffic light, the complexity to drive them increases. Since there is a limited number of pins, a simple solution has to be implemented. Fortunately, there is a far better way to deal with scalable circuitry.

Traffic Lights after multiplexing

Let's consider a sequence to handle the information within each traffic light.

  1. Load the state information of each individual light of the first traffic light.
  2. Turn on the first traffic light and let it shine of a couple of milliseconds.
  3. Turn off the traffic light light.
  4. Repeat the process of each traffic light.

But does multiplexing makes it slow? Not at all, this happens so quickly that you won't notice the difference. The

How does the Schematic looks like

Now let's take a look how it could constructed in a schematic. For this sequence to work, a ‘data bus' is shared by all lights; carrying only the information for each light of each traffic light at a given time. Moreover, they are represented by the letters R (red), Y (yellow) and G (green)

At the bottom of the schematic, there is an array of transistors. Named P1 to P4, they turn ON and OFF the traffic lights individually and sequentially. Since only one traffic light in turned ON at a given time, the data bus only carries the state information of the corresponding traffic light.

Traffic Lights after multiplexing

It makes it simple

In conclusion, multiplexing makes sequential hardware easier to control because it is scalable and modular. It's also efficient since it requires less physical pins to work thanks to the data bus. Moreover, it's control speed makes it suitable to control devices such as 7-segment displays.

In the next post, a code sample used in a PIC microcontroller will be shown.

techZorro's Index of Content

Keep Reading!

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.