This past week in lab we were introduced to multiplexers and shift registers. The need for them comes from the limited space for digitalOut pins on the Arduino. Multiple inputs can be connected to multiplexers and shift registers, which then send and receive information to the Arduino through only several digitalOut pins.
On Monday 2-13-17 we discussed multiplexers, (mux). They have a unique function of switching between inputs that are connected to it. Instead of decisively activating or deactivating the inputs connected to it, it selects inputs in a singular fashion very rapidly. It appears as if it isn’t shutting off and turning on various inputs but we cannot pick up the delay it encounters, much like a AC current powering a light fixture and a certain frequency. However, during lab we were using the mux to illuminate L.E.D.s and since the mux has to select each input one at a time, the L.E.D.s appear dim.
Dr. Hamid explained the concept of their functionality well with the train track analogy. If you imagine the inputs as train tracks, the selector is the singular rotating piece of track, that can link tracks together, but only one track at a time. In this case the rotating piece of track (the selector) moves very rapidly to go down the line of inputs and run the code from the Arduino. In the GIF below, the mux is receiving information from the Arduino, then selecting the individual L.E.D.s in the seven segment display, to illuminate them in a rotating fashion. When the mux tries to illuminate all of them at once, the seven segment display is dim because the individual L.E.D.s are being turned on an off rapidly.
On Wednesday 2-15-17 we discussed shift registers as an alternative to using a mux. Shift registers provide a similar function to a mux, but go about achieving it in a different fashion. As mentioned, a mux selects inputs one a time. But a shift register can simultaneously activate/deactivate any combination of inputs.
The in class demonstration using people to demonstrate how it works helped tremendously in understanding its function. The shift register can be connected to eight individual inputs, while using 3 digitalOut pins on the Arduino. Instead of using a selector like a mux, the shift register will receive data sequentially.Then assign bits of data to each input connected. When the data is assigned the Arduino can tell the shift register to latch the bits of data to the individual inputs. Those bits of data are binary code, that tell each pin to be either HIGH or LOW. This allows for a great deal of combinations for the inputs to be activated, however the process of latching and using the clock pin to sequentially send data is slightly more time consuming than a mux. I do not think that should stand in the way of using one though since the delay is minuscule to us.
For an in-class tutorial, we used a shift register to activate L.E.D.s. Once Graham and I had the components hooked up correctly on the breadboard, we followed along, copying code down to get our lights to illuminate in unique patterns. These patterns were achieved by setting up a data variable, and then a for loop, to send the shift register binary it could understand. The combinations are endless. I learned that you could use the calculator applications on a computer to convert numbers to binary. Which is very useful in deciphering combinations of L.E.D.s you could illuminate.
I learned a lot this week in lab, and I look forward to learning discovering new pieces of technology that will help us in further projects.