# LED Periodic Table with Arduino Mega

Discussion in 'Microcontrollers, Programming and IoT' started by Alex L, Oct 26, 2015.

1. ### Alex L

2
0
Oct 26, 2015
My friend and I are working on using an arduino mega to control a LED periodic table at our school. We plan on using Demultiplexers to have enough outputs (118). The only problems are:
1. We need to be able to light up as many elements as we want at a time. The demultiplexers will only allow us to light up 1 of the 8 outputs at a time, meaning we can only light up 15 elements at once (as well as other restrictions). We looked into shift registers but those take two inputs and turn them back into one output, meaning we would have to have more outputs to begin. Are there any IC's that will take ground, 3.3v, and a signal, so that when the signal is set to "HIGH" it changes the state of the output (i.e. when the dmux output is LOW, the IC output is LOW, and when the dmux switches to HIGH, the IC switches to HIGH, but the IC won't switch back to low until the dmux switches back to high again - the IC output would remain high even if the dmux output is low.)
2. We need to be able to control the arduino from a computer, wirelessly. We need to write a program that we can click on the element on an HTML webpage, and that tells the arduino to light up/turn off the LED

2. ### hevans1944Hop - AC8NS

4,615
2,154
Jun 21, 2012
That sounds like a very ambitious project... but doable! You need to break the problem up into specific tasks and then determine how you will accomplish those tasks.

For starters, consider the LEDs in the periodic table display. Each of some 118 LEDs must be individually and independently controlled on or off. That means you will need 118 binary latches, each latch driving an LED. If the LEDs are large and require more than a few milliamperes of current, you will need LED drivers controlled by the latches. So, how big is the periodic table display? From what distance is it viewed? How bright must the LEDs be to illuminate an element? How much power is required for the worst case scenario where every one of the elements is illuminated? You say that won't happen? How will you prevent it from happening? After your team has chewed on this for awhile, you come to the conclusion that you need about 1200 watts to light everything up bright enough to view from the back of the lecture hall. So the whole display can be powered from a convenience outlet, which is a good thing.

The next thing to consider is how independently to set and clear each of those 118 latches. You have already recognized that some sort of multiplexing is required to address all those latches. The easiest way to do this is to use an 8-bit output port on the Arduino to simultaneously present data to fifteen 8-bit D-type latches. That will provide 120 latched outputs, two more than you actually need.

Now you need some way to independently clock data into those fifteen sets of latches. The easiest way to do that is to use four bits of another 8-bit port to select one-of-sixteen latch groups to which you will write data. Of course, one group of the sixteen will be spare so when you connect those four bits to a 1-to-16 line decoder, one of the decoder lines will be unused. The other fifteen will eventually be used to clock the fifteen groups of 8-bit D-type latches, after passing their logic states through a two-input AND gate.

The other input of the fifteen AND gates is a clock signal created from another Arduino output bit. We have now used five of the eight bits on the second I/O port. So, the drill is: you build a fifteen byte look-up table in Arduino memory that holds the state of each of the 118 elements, lit or un-lit, and cycle through that table with a 4-bit pointer pulling up eight bits of data from each 8-bit table entry. Using the first 8-bit output port, this data gets placed on the D inputs of all fifteen groups of 8-bit D-type latches and the 4-bit pointer value is placed on the second output port, the four bits connected to the 1-to-16 line decoder. Then the output bit on the second port, reserved for the "clock," is toggled on and off. This will result in eight bits of data being transferred to one of the fifteen groups of 8-bit D-type latches. Increment the table pointer and repeat until all fifteen groups of latches have been clocked. This little routine can run once and then halt until new data appears. Even if only one element of new data changes, there is no harm repeating the process because the previous results are still "locked" into the latches.

How you determine the "address" of an element from mouse-clicking on an HTML webpage, and sending that address to the Arduino via Bluetooth to update the Arduino look-up table is left as an exercise for the student... that's you! I would get some software weenies to work on that part of the problem while hardware weenies tackle the display.

Hop

3. ### Alex L

2
0
Oct 26, 2015
Thanks for the information. We don't have answers to your questions yet, but we are planning to do some work this week. This shouldn't require much current though, the periodic table is to be viewed from inside a high school classroom, so simple small LED's should work fine.

Thank you
-Alex

4. ### hevans1944Hop - AC8NS

4,615
2,154
Jun 21, 2012
Even if each LED draws only 20 to 30 mA, you should probably still use a transistor driver, like a 2N3904, on the latch outputs to control the LED. If you can, draw up some schematics and post them here for us to make comments and/or suggestions. If you do all the logic in CMOS you will minimize your power requirements to mostly what you need to run the LEDs.

But why even bother to do this? Just put the periodic table up on a large screen color monitor and do it all in software!

5. ### Alex.B

1
0
Nov 15, 2015
HELP!!!! HELP!!! Working on a project and was wondering if a 16 input to 4 output Multiplexer exists? If yes what is the part number? If NO what would you recommend to get 118 inputs to a smaller number of outputs?