% !TEX root = master.tex
\subsubsection{Multiplexing}

\begin{wrapfigure}{R}{0.5\textwidth}
	\centering
	\includegraphics[width=0.5\textwidth]{img/mux1.png}
	\caption[Muxing-Demuxing]{Basic concept of muxing into a demuxer, image under CC\cite {muxingdiagram}}
	\label{fig:MuxToDemux}
	\includegraphics[width=0.5\textwidth]{img/mux2.png}
	\caption[LED Multiplexing]{LED Multiplexing Concept, demonstration of using 6 lines to control 9 LEDs}
	\label{fig:LEDMux}
\end{wrapfigure} 
%TODO: All figures used must be refrenced 
Muxing or multiplexing is method which can be used to reduce the total number of lines required to control multiple devices. The method is essentially combining multiple lines into singular lines, i.e. with two lines you can realistically control four lines, four control lines leads into sixteen, and so on. The basic implementation of this idea is achievable through careful usage of a switching network, thus obtaining the amount of control compression needed. Modern discreet packages for such devices are easily obtainable and accessed within a relatively low price bracket, thus implementation cost is low for this method. Though there are considerations that must be made when using this method, such as driving multiple leds at the same time that are connected on the same row or column; depending on implementation only certain arrangements of LEDs can be driving at the same time. Therefore a scanning method akin to the line scanning used in CRT TVs must be implemented in the software controlling the LEDs. As such this also implies that the continually driving and scanning of LEDs must happen to keep the visuals displayed which increases total driver overhead and also increases the complexity of control code. Also the scanning speed has to be taken in consideration, as the array must be driven fast enough such that the refresh rate isn't visible to the eye and such gives visible line flickering which would negatively affect the overall design. The splitting of data and optimization of such data structures and their access cost also must be closely examined due to the nature of having to consider what is essentially a segmented output array to drive, with restrictions given to each piece.  

In consideration of driving RGB LEDs and in relation to the Smart Table and using the assumption of driving a 16 x 32 array, the total line cost would come to 48 lines to fully control each individual LED; this assumes a singular color to drive and thus does not represent the total cost for driving and RGB array which increases line cost to 112 lines depending on implementation. Also realistically this is only the cost assuming the microcontroller is directly driving the LEDs which is not possible due to the massive power load this number of LEDs costs; therefore a solution must be considered in which the LEDs are multiplex and yet do not draw current from the microcontroller. The immediate thought is to drive the lines using mosfets and a separate power supply, as this would give an immediate solution to the issue and is intuitively easy to understand. The shortcoming of this method become apparent when the line cost is considered and the power that the mosfets would have to burn using this implementation; therefore a different method to achieve multiplexing is considered.

TI provides multiple signage driving ICs, some of which are designed to drive multiplexed RGB LEDs arrays as the Smart Table is implementing. For consideration the TLC5940 IC was researched as this is a common device to use in this sort of implementation. The advantages it provides is reducing the pin requirements from the control unit, while integrating constant current driving capabilities for the LEDs into one unit. This unit additionally is driven by using a serial interface which is relatively easy to implement and also additional takes processing load off the main unit and thus saving expensive CPU cycles. As such by using a device such as this, additional circuit work can be simplified and additionally the control drivers to be implemented on the microcontroller can be simplified. The main issue with this driver is the amount required, the number required would take up a large amount of physical PCB space and thus drive up costs by a large margin, thus a better solution must be found. Consequently the TLC5958 LED Driver was selected as a replacement part. This IC supports up to 48 channels, and additionally supports 32-Multiplexing natively. This vastly reduces part count and solves the issue of current sinking the lines dynamically. Additionally the device is driven again with a serial interface and has a sort of buffered memory setup allowing faster streaming to offsite storage by the microcontroller which is useful in the limited resource environment that is being used. As such this device vastly improves the potential design by reducing part cost, space compression, and code compression.

Ultimately the core issue with multiplexing a large device such as the Smart Table comes into play with the physical connections. The table itself is physically large, and as thus requires hand production. The production of a multiplexed setup would take at a base level, four lines per wire, massive line runs in which propagation of power issues comes into play, and a sizable preset array to hold each LED in place. The issue additionally with this, is the possible errors in production which would be costly in terms of time to fix and thus makes this method infeasible. To add onto the issues, is the locking the array into a set size is also an issue, as final physical designs can be changed. The cost of testing a prototype is also high, the cost of building a small test setup is quite high due to the cost of coding a one-off design and then the physical board production. Therefore, this style of driving a large LED array did not pass planning phases.   