Introduction: Interactive LED Periodic Table
My girlfriend and I have an element collection - samples of the unique bits of matter that make up everything in the universe! For such an interesting collection I decided to build a display case that shows off the samples in all their world-building glory.
I know that not many people have an element collection but everyone has something to display! The goal for this instructable is to give you enough of an understanding of the construction process, electronics and code to create your own customized display for whatever you want.
The interactivity of the display makes it a great teaching aid for teachers to demonstrate features of the periodic table and how different elements relate to each other. It is also just a lot of fun to watch in general!
Step 1: What You Need
Everything purchased from local hardware store unless otherwise stated.
All electronics purchased from Ali Express (links given). Ali Express is a place to get cheap electronics from that are usually surprisingly high quality.
Frame - Key: (length x width x height) x quantity
- Pine planks (2400x60x10mm) x7
- MDF sheet (1200x600x4.5mm) x2
- Sandpaper (120 grit)
- Wood glue
- Wood filler
- White acrylic paint --- Art store
- Decorative molding (2400mm) x2
- Balsa wood (1000x10x2mm) x6 --- Art store
- LEDs (Neopixels/ws2812b) x90 --- Ali Express Link "1m 100 IP30" will give you 100 non-waterproof LEDs
- Wire (5m rolls 22 gauge or similar. different colors preferable) x3 --- Ali Express Link
- Arduino Nano --- Ali Express Link
- Bluetooth module (HC05) --- Ali Express Link
- Power supply (5V 4A) --- Ali Express Link
- Mains power cord --- Used goods store
- Solder --- Ali Express Link
- Prototype dot board --- Ali Express Link
- Female pin headers --- Ali Express Link
- Screw terminals --- Ali Express Link
Step 2: Planning
- The display is in the shape of the periodic table. This way the LEDs can show off features and trends of the periodic table.
- Each position in the periodic table is an enclosed shelf that the element sample can rest on.
- I used WS2812B LEDs which I can individually light up any color.
- The display has Bluetooth functionality and a phone app to control it. The main thing I wanted with this display was for it to be interactive. The phone app makes it so much fun to play with!
The display is made from 60x10mm pine planks. I got mine in 2.4m lengths but there were many lengths available. All the required pieces to cut fit easily in 7 lengths of 2.4m. There was almost one whole length left - in case I made some mistakes!
I have drawn a "Framing plan" for you to follow. Use this with the "Framing lengths and quantities" which shows how many of each length needs to be cut. Both diagrams are color coded and labeled with letters so you know which piece goes where. All pieces will be cut out then glued with wood glue.
The last diagram depicts the shapes for the front panel and back panel that will be cut out of MDF and glued in place. I recommend to just place the frame on top of the MDF and trace the shapes with a pencil. The shapes of the panels are just to give you an idea of what they look like.
Lanthanides and Actinides
I do not currently have any samples of Lanthanides and Actinides so did not make the portion of the periodic table that contains them. I will in the future though!
Planning the electronics is documented later in the Instructable.
Step 3: Cutting the Wood
Following the plan, the pieces of 60x10mm pine needed to be measured and cut to their specific lengths. I used a tape measure and pencil to mark how long each piece of wood needed to be then used a square to draw a line across the wood. After each marked line I used a saw to cut right behind the line. Don't cut directly on the line or you will end up with a piece of wood that is slightly too small due to the thickness of the saw blade. I smoothed the rough edges of each piece with sandpaper. After every piece cut it is helpful to label it with a pencil according to the plan to make assembly a lot easier.
Note: Accuracy is very important. My cuts weren't all perfect so I had quite a few gaps to fill with wood fill later. A table saw or mitre saw with a fence or stop block respectively would make cuts a lot more accurate.
Step 4: Assembling the Frame
I wanted all the 60mm vertical sections to be aligned so measured, marked and squared where each of them should be glued to the horizontal boards. For example, the bottom plank "J" is marked at 10mm (to allow room for the vertical side board), then I count 60 and mark at 70, then count 10 for the vertical section then another 60 and mark at 140 and so on.
To put the pieces together I applied wood glue to the surfaces that would be joined and carefully positioned them in their correct positions and secured them with clamps. I only glued a few pieces at time and let them dry due to my limited number of clamps and because it was hard to keep everything straight otherwise. I found it helped to lay everything flat on a flat surface and tighten the clamps just enough that I could still fiddle with positioning without all the pieces falling over. Once the pieces were in position I fully tightened the clamps. When the frame was fully assembled it was a lot stronger than I expected due to how many different glue joints there were. If you wanted a stronger display you could use small screws or cut slots to fit the pieces together.
Note: With gluing a structure like this together it helps to have as many clamps as possible. You might be able to borrow some from friends or find them cheaply second hand.
Step 5: Borders
To make the display look a bit nicer for hanging on the wall I decided to frame it. I brought some decorative moulding (the type of contoured wood that makes picture frames) and wood glued it to the sides of the display making sure to clamp it in position while the glue was drying. The tricky part of this was cutting the 45 degree angles in the moulding so the corners fit together nicely. My method was to fold a piece of A4 paper short edge to long edge to make a 45-degree angle and use that to trace a line on the underside (flat side) of the moulding. To get the mouldings lining up measure the length of the side of the display you are putting the moulding on and mark the inside edge of the moulding with that length. Make sure to start about 30mm in and mark the starting point too. The 45 degree lines then go outwards from the two points marked.
Step 6: Backing and Front Panel
The display needs a backing to give the LEDs something to reflect off, make the display more secure and hide all the wires that will be back there. To make the backing I used two sheets of 1200x600x4.5mm MDF. I placed the MDF sheets on a flat surface in landscape orientation right next to each other and place the display frame on top of them. I moved the frame until the seam was hidden by one of the vertical boards of the frame. Then I traced around the outside of the display onto the MDF with a pencil and cut it out using a saw. I turned the display upside down and glued the backing to the back of the display with wood glue. I covered the backing with heavy objects to stop it lifting or moving while drying.
The backing needs holes in each cell for the LEDs wires to pass through. I used a cordless drill and 6mm bit to drill two holes in each cell. One hole in each top corner. With the holes and wires in the top corners they are more difficult to see when viewing the display.
I wanted the display to be more rectangular so I placed a piece of 4.5mm MDF underneath the frame and traced the irregular 16x3 cell shape onto the MDF. I then used a saw to cut out the shape and glued it to the frame with wood glue.
I cut little MDF squares with 1 corner cut off to glue in place to hold the front panel and frame together a little more securely. (Photos can be seen of these tabs in the electronics section).
Step 7: Finishing Touches
It was a tough decision whether to stain the wood or paint it. In the end I painted the entire display white with some cheap acrylic paint. I decided the white would reflect the LED lighting nicely and really light up the cells. It definitely worked out in my favor!
Laser cut letters
I was recently lucky enough to have access to a laser cutter so
cut out some custom black acrylic letters for the display. I think it really completes the aesthetics of the display. Before I had access to the laser cutter I was thinking about buying some cheap wooden lettering and painting it. (Find the file I used attached).
Step 8: Electronics - Planning
I used WS2812B LEDs because of their ease of wiring and coding. Originally I was planning a setup of multiplexed LEDs and shift registers. WS2812Bs make life so much easier! Even if you don't build the display I recommend playing with these LEDs because they are incredible (and cheap from Ali Express)!
I used 90 WS2812B LEDs for the display. Each LED has 3 colors (red green and blue) that each draw up to 20mA at full brightness. If all 3 colors are at max brightness the LED will draw up to 60mA.
60mA x 90 LEDs = 5400mA (5.4A)
I found a cheap 5 volt power supply on Ali Express that could supply 4A so I brought it. This power supply will be sufficient as long as I don't have too many LEDs at full brightness at the same time. I did have an issue with flickering LEDs but it was mainly due to voltage drop (which I will explain later). I would recommend calculating the maximum current draw like I did and purchasing a power supply of at least that value.
WS2812B LEDs run on 5V so make sure to get a 5V power supply.
I wanted the display to be interactive. Bluetooth connectivity with a phone app was the easiest way to do that. The HC05 Bluetooth module is easy to use. You just treat it as a serial connection.
Step 9: Electronics
Read the connections from the wiring diagram image or written below:
(Arduino) D9 ---> DIN (Start of LED chain)
(Arduino) GND ---> GND (Power supply)
(Arduino) +5V ---> +5V (Power supply)
(Arduino) TX ---> 1K Resistor ---> 2K Resistor ---> GND (Power supply)
Center point of the two resistors ---> RX (Bluetooth module)
(Arduino) RX ---> TX (Bluetooth module)
(Power supply) +5V ---> +5V (Start of LED chain)
(Power supply) GND ---> GND (Start of LED chain)
(Power supply) +5V ---> +5V (Bluetooth module)
(Power supply) GND ---> GND (Bluetooth module)
Wiring the LEDs
The wiring of WS2812B LEDs is quite simple but there is A LOT of it! There are 90 LEDs each with 6 solder connections each. That's 540 solder joints! I brought WS2812Bs on little circular circuit boards which was somewhat annoying as I had to hot glue them to the top of each shelf. I would recommend to get the WS2812B LED strips I linked in the "What you need" section because they already have a sticky backing and have a larger surface area so are easier to work with. If you do choose the strips every LED needs to be cut out by cutting on the lines between the contact pads.
Every WS2812B has 6 connections. 2 +5V, 2 GND, DIN and DOUT. DIN and DOUT stand for Data In and Data Out. The data wire must travel from the previous LEDs DOUT into the next LEDs DIN. The power and ground wires follow suit until all of the LEDs are connected together as a chain. The wiring diagram depicts how the LEDs are wired if my explanation didn't make sense!
Note: The LEDs have an arrow on them to let you know what direction they must face in the chain. This is a good indicator rather than just looking at DIN and DOUT.
I hot glued the LEDs to the top of each shelf facing in the direction shown in the "LED arrangement" diagram.
Again following the "LED arrangement" diagram I cut wires that reached between each LED in the chain via the holes drilled in the MDF backing. I used a different color of wire for the +5V, GND and Data lines to make sure there is no confusion as to which wire gets soldered to which LED. I had to strip each wire with a wire stripper before soldering them together as described 3 paragraphs above.
Wiring the power supply
WARNING: MAINS POWER CAN KILL. USE CAUTION WHILE WIRING THE POWER SUPPLY OR BUY A POWER SUPPLY WITH AN ALREADY ATTACHED CABLE.
The power supply I brought did not have a mains cable attached. I found a mains power cable from a local used goods store for my country. The power supply I linked in "What you need" is rated for 110/240V input so should work in most countries.
NOTE: THE COLOR CODED MAINS WIRES BELOW MAY BE DIFFERENT IN DIFFERENT COUNTRIES.
I stripped the power cable to expose the 3 colored wires. Green for earth, blue for neutral and brown for phase. I connected these wires to the power supply screw terminals.
(Wire) Green -> GND (Power supply)
(Wire) Blue -> N (Power supply)
(Wire) Brown -> L (Power supply)
NOTE: IF YOU ATTEMPT WIRING MAINS - LOOK UP YOUR LOCAL COLOR CODING.
Arduino and Bluetooth module
I used a prototype board to solder the components to. I slotted the Arduino Nano into two strips of female pin headers cut to size then slotted the headers with Arduino into the prototype board. I then soldered the headers to the prototype board from underneath. This allows us to have a removable Arduino for programming. I actually used an Arduino nano terminal for my display but would use headers if I did it again.
I did the same with the Bluetooth module but without the headers (it doesn't need to be removable).
Screw terminals were soldered in to make connections to the LED chain and power supply easier (the wiring is still the same as the diagram but the power supply wires and LED chain wires are interupted with a screw terminal.
The Bluetooth module, Arduino, power supply and starting end of the LED chain were then soldered together with cut-to-size and stripped wires according to the wiring diagram.
Securing the electronics
The prototype board and power supply were then secured to the back of the periodic table using hot glue.
Step 10: Code
I have tried to comment descriptively and make the code easy to follow.
Here is a quick run down on how it works:
The top of the code is filled with arrays for storing information about the periodic table and converting between the way the LED chain is arranged and how the elements should be organised.
The only code in the loop is code to read data from the serial connection (to which the Bluetooth module is attached) and call a function that chooses what to do with the commands it receives.
Most commands are just single words. Some have a prefix and a suffix for example: select23 will turn on element 23. There is a function that works out if the command given has a prefix and returns its suffix if it does.
Every animation or functionality is in a function. You'll see that there are quite a few if you look at the code! When the functions are called with the correct parameters given the display lights up and does things!
I based my Bluetooth connection code on this tutorial: Bluetooth and Arduino tutorial
The FastLED library for controlling WS2812B's can be downloaded here: FastLED library
Information about how to use the FastLED library can be found here: FastLED information
Step 11: Phone App
MIT App Inventor is a great online tool that makes it relatively easy to create Android apps. It's got multiple ways to view your app as you create it to make sure it's right. It uses easy to learn block-based programming.
The main reason I love App Inventor is because it can use my phones Bluetooth to connect to an Arduino with a Bluetooth module!
There are plenty of tutorials to get started. Here's a great instructable for App Inventor with Arduino.
My girlfriend contributed here by building the app used to control the display. There is a searchable list to select single elements, slider bars for the temperature and date functions and buttons for everything else. It also has a scroll able top menu!
The App Inventor file is attached if you would like to look at it. Keep in mind we are still working out some bugs.
Step 12: Tips
Here's some tips for any electronics project at all
Whenever you make a complex project with many parts that interact, start with the small individual components.
For the display I started with following a tutorial to wire the Bluetooth module to an Arduino and send data with a ready-built Bluetooth terminal app.
After getting that working I got the WS2812B LEDs working on their own, then connected then added the Bluetooth module.
After adding a few different functions my girlfriend made me the app with App Inventor 2 to send the commands automatically when buttons are pressed.
Don't do everything at once. Start small then build big.
I had a big problem with LEDs flickering when I made too many LEDs white at the same time.
Was this because my power supply was underrated for the number of LEDs? Probably. But another contributing factor is voltage drop over long distance cables.
To fix the voltage drop I connected the power supply +5V and GND wires directly to the end and the center of the LED chain. This fixed my issue.
Note that only the +5V and GND wires should be wired to the end and center. There should only ever be 1 data wire connecting the chain together.
Cutting and filling
Take care while cutting the pieces to get accurate cuts. A mitre saw with a stop block would probably help heaps for the small pieces. My cuts weren't perfect which lead to gaps which lead to lots of wood filling and sanding.
Thanks for reading, hope you enjoyed the process!