Introduction: Magnetic LED Hexagons

About: Just a uni student building fun projects to get me through.

Welcome to my "LED Hexagon" lighting project, interconnecting light up hexagons. Lately I've seen a few different versions of these lighting projects hitting the market but they all have one thing in common... the price. Each hexagon here costs just a few dollars and doesn't sacrifice on the quality or features of the ones available on the market! In addition they are highly customizable and not restricted to just my hexagon shape.

View my video here for help with setup I'll do my best to explain each part here.


  • Easy magnet connection
  • Simple easy design
  • Simple circuit
  • Customizable layout
  • Customizable led pattern
  • Low cost per hexagon

Step 1: Materials

Below I will list everything you need with the quantity per hexagon beside it.

  1. ATTINY85 - one per hexagon
  2. 10k Resistor - three per hexagon
  3. 1k Resistor - two per hexagon
  4. IC Socket - one per hexagon (this is not required but if code on the Attiny needs changing this makes it a lot easier)
  5. Ws2812B LED - twelve LED's per hexagon
  6. Neodymium magnet - eighteen per hexagon
  7. 2N3904 Transistor - Two per hexagon
  8. Proto board`
  9. 5v Power Supply - Only one required (will discuss the amp rating required further in the tutorial)
  10. Dc Female connector - Only one required
  11. Super Glue

Step 2: Tools

Not too many tools needed however you will need:

  1. A 3d printer (unless you want to create your own case)
  2. Soldering iron
  3. wire cutters
  4. wire strippers
  5. hot glue gun
  6. lab bench power supply (like this one, not required but nice for testing)

Step 3: Printing

I have uploaded my design to Thingiverse here.

The print itself is fairly simple i didn't use supports and found it worked well each time. If anybody plans on making another shape feel free to message me and I will do my best to explain what worked for me and what made me have multiple hexagons lying around the house...

Step 4: Uploading the Code


You want to upload Switch_LED_Hive to each Attiny

Because I was uploading and testing my code frequently I decided to make one of these for uploading code, its a nice simple tutorial on what to do and what you need. However if you just plan on using my code with no adjustments this kind of setup will do you just fine (just program all the chips whilst you have it set up).

  1. Fist go to file, preferences and in additional boards insert this URL like image above then press ok:
  2. Then go to file-> examples ->ArduinoISP->ArduinoISP and upload the sketch to your arduino.
  3. Next we want the Attiny running at 8mhz (may work at lower clocks however this is what I tested it at) with your Attiny connected using one of the methods above select all the settings above in the second image and press "burn boot loader"
  4. Finally we want to upload the signal switch code, simply press the upload button and you should get a message confirming the successful upload

Arduino Nano:

I recommend the use of the Fast LED library for the Arduino Nano just edit:

  • NUM_LEDS (Num of Hexagons *12)
  • DATA_PIN (The pin you have used on your Ardunino nano - 5 is default)
  • Also feel free to edit the BRIGHTNESS to any value between 0-255 255 being max

There is a great article on this library and LED strip here if you want to know more.


I'm going to assume many of you will have the same issue as me and uploading to your arduino nano will fail when using the standard nano driver. A common problem with these seems to be the fact that these are Chinese knock offs, and use a different serial chip this causing the time out and failure during upload.

To fix first press uninstall and then press install using this program (if windows or go here to find your OS). Once done select "old boot loader" in the device menu and you should be good to upload.

Step 5: Wiring Pt One: LED's

So in order to try make this as confusion free as possible I will split the wiring into three parts, part one will be LED/Magnet setup, part two the circuit design and three will be the master hexagon.

These LED's are pretty simple themselves with just three inputs and outputs running the whole operation, because we don't want to use an entire strip of them in each hexagon I choose to cut them into pairs and place them in each corner giving a nice even coverage.

  1. Cut six pairs of LED's along their contacts
  2. Cut five of each different color of wire at 80mm long
  3. Pre tin both end of all the LED pairs
  4. Strip and solder the wires in between each of the LED pairs 5V - 5V, GND - GND, DIN - DOUT (not on the first input or last output)
  5. Next cut 6 of both the GND and 5V colour wires at 25-30mm long
  6. Now for the magnets, I found that the best technique here was to have one magnet face down on a piece of steel. Next test the other magnets against this magnet (you need nine that attract and nine that repel,for the first hexagon it doesn't matter as long as there is two groups of nine magnets face down with different poles)
  7. Scratch the surface of each of the magnets
  8. Ensure you have the magnet on a piece of metal! This prevents a large loss of magnetic force!
  9. Apply a generous amount of solder to each of your magnets (try avoid holding the soldering iron against the magnet for a long period of time)
  10. Strip and solder each of your small 5V & GND wires to the magnets. Three of each colourto each group of magnets.

Step 6: Wiring Pt 2: Circuit

Because of the design of this shape in certain layouts a hexagon can have more than one input at any time... basically this is bad for the LED's. My best solution was a simple Attiny85 circuit that reads each of the inputs and turns on or off transistors basically turning on and off transistors leaving just one signal for the next LED strip..

There are three 10k resistors connected to pins 1,2 and 3 each of these goes to 5V as well as this each one has one of the three inputs going to it.

there is two 1k resistors these go to the middle pin of the transistor.

I have included a Fritzing circuit as well as the images above to try best explain this circuit. As well as this I've made a PCB for this circuit that removes this whole step! (Tested and working!!)

From the second image IN 1, 2 and 3 are the inputs (coming from three input magnets) and Out 1,2,3 are the output (going to LED in pin).

Step 7: Wiring Pt 3: Master Hexagon

This will be the Hexagon running the light show.

Power Supply:

So when it comes to choosing a power supply you need 5V and an amperage rating that will suit your Quantity of LEDs. For me I wanted around 8-10 in Hexagons worth. If we take into account that at full brightness each LED draws about 60mA and we have 12 LEDs per shape so, 0.06*12 = 0.72 Amps so for 8 Hexagons it would be 0.72*8 = 5.76 Amps. However this is at Max brightness (this was very bright in person). I found that at around a brightness of 200 (255 is max) the LED's drew around 0.5Amps per hexagon. Meaning with 8 hexagons I would be drawing 4Amps. Because white light is not constantly running (this is the least power efficient color) a 5Amp power supply should work fine. I definitely recommend testing on a lab bench power supply if you want to optimism brightness for your power supply like I have above.

There is good theory on this here where they use 0.02Amps per LED with no repercussions. It comes down to your use and preference.

Note: Its always safer to get a power supply with a higher amperage than needed, Amps are not forced thus only used when needed and will not cause damage.


Much like every other hexagon this one needs the LED setup however it does not require the circuit to decide inputs as it will only output. I decided to put outputs on all sides except to the very bottom of the hexagon this allowed for more interesting shapes to be formed.

  • The setup is pretty easy much like the image above 5V and GND from the barrel jack going the Arduino nano and the signal pin with resistor running to the LED input.
  • The output from these LED's then run to each side of the Hex (making 5 outputs on this hexagon)

Step 8: Finishing Touches

Now for fun with hot glue! Basically I glue down the LED's, circuit and any lose wires. Glue the clear covers onto the main shell.

Annndd thats basically it!

Step 9: Final Notes

Alright guys thanks for reading my Instructable! As always leave any questions below and I will do my best to answer them. Depending on the response to this Instructable I'll try keep it updated and add anything new and any user content you guys come up with.
Please chuck me a follow it really means a lot having sunk countless hours (or months) developing this project and making this tutorial.

Colors of the Rainbow Contest

Sixth Prize in the
Colors of the Rainbow Contest