A multiplexer, commonly abbreviated down to “mux”, is an electronically-actuated switch, which can turn one signal into many. It routes a common input signal to any number of separate outputs. Similarly, a demultiplexer routes any number of selectable inputs to a single common output. The 74HC4051 can function as either a multiplexer or a demultiplexer, and it features eight channels of selectable inputs/outputs. The routing of common signal to independent I/O is set by digitally controlling three select lines, which can be set either high or low into one of eight combinations. Covered In This Tutorial This tutorial covers everything you should need to assemble the Multiplexer Breakout then wire it and integrate it into your project.
Included in the tutorial are a pair of Arduino examples, which demonstrate how to use the mux for both digital output and analog input. The tutorial is split into the following sections, which you can navigate through using the bar on the right. – A quick introduction to the workings of the 74HC4051 and the extra features of the breakout board. – Tips and tricks for soldering headers or wires to your breakout and mounting it into your project. – An Arduino circuit and example code demonstrating how to use the multiplexer to drive eight LEDs.
– Circuit and an Arduino sketch explaining how to use the board to read eight analog voltage-producing photocells. Suggested Reading Muxes are a great tool for electronics users of all experience levels – anyone who needs to multiply their project’s pin count. There are a few subjects you should be familiar with before diving into multiplexing, though. If the subjects below sound foreign to you, consider browsing through that tutorial before continuing on.
74HC4051 Breakout Overview The Multiplexer Breakout’s is just about as simple as it gets: There’s the chip, a decoupling capacitor, a pull-up resistor, and all of the pins are broken out (some broken out twice): One half of the board breaks out the control signals ( E, S0-S2) and common input/output (Z). The other side provides access to all eight independent I/O’s (Y0-Y7). Both sides include supply and ground connections (V CC, V EE, GND). The table below summarizes each pin and its function. The enable ( E) pin is pulled low on the breakout board via a 10kΩ resistor. Free throw a thon template. If your project doesn't require enabling/disabling the mux, you can leave that pin unused. Power Supply Limits The 74HC4051 supports a wide supply range, but the presence of the optional negative voltage supply – V EE – has the potential to make things a little complicated.
Here are the basic rules that govern the 74HC4051’s power supplies:. V CC must be at least 2.0V (above GND). V CC must not exceed 10V (above GND). V EE must be less than V CC – anywhere between 2.0V and 10V below V CC. The operating area graph below – figure 7 in the – represents those ranges visually: For example, the 74HC4051 supports standard 3.3V, 5V, and 9V supplies, as well as bipolar supplies, like ±5V (but not ±9V). JP1 – Connecting V EE to GND We expect that the majority of multiplexer-equipped projects may not need the 74HC4051’s bipolar supply support.
So, to make the board easier to get quickly up-and-running, we’ve added a jumper to the top side, which shorts V EE to GND. By connecting V EE to GND, you can satisfy both V CC-GND and V CC-V EE limits by keeping V CC between 2.0 and 10.0V. Unless you need a bipolar supply, you can leave this jumper closed and ignore V EE entirely. Using a Bipolar Power Supply The 74HC4051 supports bi-polar power supplies, with a positive supply on V CC and a negative supply on V EE.
The difference between V CC and V EE can be as much as 10V (e.g. ±5V), but V CC must be somewhere between 2V and 10V. To use a bipolar supply, you must first open JP1, disconnecting V EE from GND.
A quick hit of a soldering iron on some should lift that solder right up. Once the jumper is open, your supplies can be connected. The logic levels of the select and enable pins will still be limited by V CC, but your common pin and eight I/O pins will be able to range between V EE and V CC. Arduino Example: Output Now that you’ve got a handle on how to use the Multiplexer works and have the board assembled, here are a few quick example Arduino sketches to help demonstrate both output and input capabilities of the chip. The Circuit To get the most out of this example, you’ll need to connect some sort of output device to each of the independent I/O pins (Y0-Y7).
For example, grab a and some for a quick hardware-verifying circuit. In this example, S0, S1, and S2 are connected to Arduino pins 2, 3 and 4 respectively. “Z” is connected to pin 5, which the example uses to produce PWM “analog output” signals.
Arduino Multiplexer Shield
VCC is connected to the Arduino 5V pin, and GND goes to GND. The breakout board’s JP1 is left intact, shorting V EE to GND.
Finally, the Y0-Y7 pins are all connected to LED/resistor pairs, with the positive anode end of the LED connected to the Y-pin and the resistor connecting the LED’s cathode to ground. This way, when the output is selected and “Z” goes high, the LED on that output will turn on. The Sketch Here’s the code for the above circuit. Upload it, and enjoy the cycling, breathing LEDs!
In 2003, CU student Nate Seidle blew a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado. No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics.
We're here to help you start something.
Multiplexer has several groups of pins. Numeration of pins starts from upper left corner and follow counterclockwise direction until right upper corner. Package marc (usually hole or half hole) have to be turned up, with opposite direction of pins from your point of view. Channel pins are used to control external devices (input or output) using multiplexer.
This model contains 8 pins (numbered from 0 to 7). S7 know how manager keygen 2016 - and reviews 2016. They are not in row. First channel is on pin 13 (channel 0), second on pin 14 (channel 1), third on pin 15 (channel 2), fourth on pin 12 (channel 3), fifth on pin 1 (channel 4), sixth on pin 5 (channel 5), seventh on pin 2 (channel 6) and eighth on pin 4 (channel 7). Address pins or selector pins A, B, C are pins 11, 10 and 9.
This pins we will control from Arduino, and using only four pins (three for address and one for input/output) extend it to eight input/output pins. Pin 3 is communication pin, means that selected channel will be connected with this pin, and using Arduino we will connect input or output pin on it to read or write on sensors using multiplexer. Other pins are power supply pins. When we use it as multiplexer that mean select one of several input signals (analog or digital) and forwards the selected input into a single line. Example on picture shows eight potentiometers connected on eight channels. When we use CD4051BE as demultiplexer that mean to take single input signal (0 or 1) and selecting one of many data output lines, which is connected to the single input.
Example on picture shows eight LEDs control by one output pin and three address pins. Check the truth tables on picture and you will figure out how to address individual channel. This is actually binary logic.
A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a single binary value, either 0 or 1.
That mean with one bit (A) we can control two channels (0 or 1). With two bits (A and B) we can address four channels. With three bits (A, B and C) we control eight channels.
With every next address pin (D, E etc) number of channel control will grows exponentially. For example with just one more pin we will be able to control 16 channel multiplexer. Pin 6 on this type multiplexer is inhibit (break). If we send address and inhibit pin is 1 we will not see any change. That is reason why we connect it directly to ground, but if you need to control this behavior you can use additional pin to send 0 or 1 to inhibit pin.
(Digital) Pins 0 and 1 are used by the hardware serial port you initialize with Serial.begin on a classic Arduino like an Uno. With this type of board it is generally best not to use those for any other purpose; if you do, you have to accept that you cannot use the hardware serial for input or debug/status output. Even if you don't want to use serial during the operation of the your creation, having those pins connected to other functions can interefere with uploading sketches via the bootloader, or else the act of uploading a sketch can misoperate the functions connected to those pins.
The 74HC595 is an easy and inexpensive (at about 60 cents apiece) way to increase the number of digital out pins on your Arduino. In this tutorial I'll show you how to drive up to 16 LEDs with one 74HC595 using a technique called multiplexing.
In the end, all 16 LEDs will require only three of the Arduino's available digital pins. The finished product will look like this: I used the sparkfun button pad pcb to build my 4x4 led matrix because this is the first step in a longer project I'm working on that involves backlit buttons. However, you can build your own 4x4 led matrix pretty easily on a breadboard, and I'll provide schematics that will show how to do that. My parts list is given below: Parts List: SPARKFUN: (1x) Button Pad 4x4 - LED Compatible (1x) Button Pad 4x4 - Breakout PCB (1x) Arduino Uno DIGIKEY (you could find these at Jameco): (16x) White 5mm LED (3mm is fine too) (1x) 74HC595 shift register (1x) 16 pin IC socket JAMECO: (1x) 16 conductor ribbon cable (1x) 16 pin right angle connector (2x) male header pins Additional Materials: 22 Gauge Wire, multiple colors protoboard with copper wire cutters wire strippers solder. Multiplexing is a very efficient technique for controlling many components wired together in a matrix/array.
In this example, I'll be talking exclusively about multiplexing an array of LEDs, but the same basic principles apply to other multiplexed components (sensors, buttons, etc). In a multiplexed array of LEDs, only one row of LEDs is on at any given time. It seems like this would limit the types of shapes we can display on the LED matrix, but it actually doesn't. This is because the arduino (or whatever is sending data to the array) is switching through each row so quickly (hundreds or thousands of times a second) that we do not perceive the flashing on and off of each consecutive row. You can read more about this phenomenon, called, on wikipedia.
Adobe flash cs4 full version download. So how do we send data to one row at a time? If we connect five volts (red) to one row and connect ground (blue) to the other three rows and cycle through each row one by one, it will look something like figure 1. Now image that while one of the rows is at +5, we connect one of the columns to ground.
As shown in figure 2, this will cause the LED at the junction of the +5 row and GND column to light up. This way, we can address each of the 16 LEDs in the matrix individually using only eight leads (four to the rows and four to the columns). Now look at the image below. Imagine if we very quickly turn on the LED in the upper left corner (position 1,1), then the LED at (2,2), then (3,3) and (4,4), and we cycle between these four LEDs very quickly (hundreds of times a second). It will appear that all four of these LEDs are on a the same time (as shown in right image in the image below). Study the diagram below and convince yourself that this is true. The 74HC595 is an 8 pin shift register.
Shift registers are chips which use logic gates to control many inputs or outputs at once. They are inherently digital, like the digital pins on the arduino- this means that they can only read or write 0V and 5V (low or high), they should not be used to read analog data from sensors or potentiometers (instead consider using a mux/demux such as the 4051). The 74HC595 has 8 outputs labeled Qa-Qh (or Q0-Q7), it cannot read data from these pins, they can only be used as outputs (if you are looking for a shift register with inputs check out the 74HC165). The 74HC595 is controlled by three connections to the arduino (or your microcontroller of choice); they are called the data pin, latch pin, and clock pin. Refer to the flow diagram above (figure 1): -first the latch pin is set to ground to disable the outputs, this way the output pins won't change as we are sending in new data to the 74HC595 -next new data is sent to the 74HC595 serially, by pulsing the clock pin and sending each byte of new data out the data pin bit by bit.
Arduino has a handy function in their library called that takes care of this for you.finally, set the latch pin high. This sends your new data to all the output pins at once (parallel output).
In this tutorial I'll show you how to control a 4x4 LED matrix with one 74HC595. In the previous step I showed that it is possible to control a 4x4 LED matrix using only 8 pins (four for the rows and four for the columns). In the next steps I'll show you how to wire the 4x4 LED matrix to the 8 output pins of the 74HC595 and drive the entire thing with the arduino. One more thing to add about the 74HC595: It is also possible to expand your outputs even further by, but that is outside the scope of this tutorial.
Thread the leads of 16 LEDs (5mm or 3mm are fine, I used 5mm) through LED holes in the sparkfun PCB. These boards are compatible with 4 lead RGB LEDs, so there are four available holes on each button pad. You can use the two center holes for single color LEDs (see figure 3). Be sure that the flat edge of the LED (the cathode) lines up with the flat marking on the PCB. Solder the LED leads and cut away the excess wire. If you do not have a sparkfun PCB: See figures 7 and 8 for the LED matrix wiring diagram. Connect the anodes (long lead) of each row of LEDs together and the cathodes (shorter leads) of each column of LEDs together in the matrix.
Cut about 1ft of 16 conductor ribbon cable. Separate and strip the ends of all 16 wires on one side and solder to Sparkfun PCB. The following list gives all the colored conductors in order with the name of the PCB hole they should be soldered to, if you do this correctly none of the wires should cross.
Arduino Serial Example
Note that since I'm only using a single color LED, I'll wire up only the 'blue' anode. See the labels on the schematics above for reference (esp if you are not using the sparkfun pcb). Connections: one side of ribbon cable Brown SWT-GND1 Red LED-GND1 Orange SWT-GND2 Yellow LED-GND2 Green SWT-GND3 Blue LED-GND3 Purple SWT-GND4 Grey LED-GND4 White BLUE4 Black SWITCH4 Brown BLUE3 Red SWITCH3 Orange BLUE2 Yellow SWITCH2 Green BLUE1 Blue SWITCH1 other side of ribbon cable. The 74HC595 will be driving the LEDs in the sparkfun board.
However, this chip only outputs 0 or 5V and it can output as much as 70mA per pin. This means we must use current limiting resistors to prevent damaging the LEDs. Find the resistors connected to the cathodes of the LED matrix in the schematic (fig 4). From the specs of the LEDs I used: max forward current: 30mA forward voltage: 3.2V Calculate the resistance needed to achieve these max ratings from V = IR: resistance = (5V-3.2V) / (0.03A) = 60 ohms It's not a good idea to actually use 60ohm resistors, you could damage the LEDs. We also need to take into account the fact that the 74HC595 can only source up to 70mA per output pin. Since we are multiplexing, a maximum of four LEDs can be on at any time (the entire row can light up at once). If we use 60ohm resistors then all four LEDs together would draw 120mA (30mA.4) of current at once from their common anode.
This probably wouldn't damage the 74HC595 immediately, but it would cause noticeable dimming of the LEDs. I chose to use 120ohm resistors instead; this way four LEDs can only draw a max of 60mA (15mA.4) at a time. Note- I made a mistake a grabbed the 100KOhm resistors when I first soldered this project together, I fixed it later, but the stripes of 120Ohm resistors should be brown, red, brown, gold, ignore the colors in the images. These are the sample calculations for the specific LEDs I used, you'll need to do you own calculations based on the specs of your LEDs. If you are unsure of what to do, use 220ohm or higher resistors; using too much resistance will make the LEDs less bright, but they will not be damaged. Solder four resistors to the protoboard as shown in the images above. Connect the leads of the resistors to their adjacent header pins with solder (figure 2).
The output pins (Qa-Qh) are located on pins 1-7 and 15 of the 74HC595. Connect the resistors to pins 4-7 with jumper wires as shown in figures 1 and 2. Connect the male header pins to pins 1-3 and 15 as indicated in figs 3 and 4 (see the note on the image- I made a mistake while soldering, refer to schematic and info below for proper wiring). Make sure to electrically join all these connections with solder on the underside of the board (figs 2 and 4). As indicated in the schematic, the pin connections are as follows: top row 1 (or 'blue 1') QD(3) row 2 (or 'blue 2') QC(2) row 3 (or 'blue 3') QB(1) row 4 (or 'blue 4') QA(15) bottom left (if you are facing the front of display/looking into the LEDs) column 1 (or 'led gnd 4') QH(7) column 2 (or 'led gnd 3') QG(6) column 3 (or 'led gnd 2') QF(5) column 4 (or 'led gnd 1') QE(4) right.