Magnetic LED Hexagons




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

Be the First to Share


    • The 1000th Contest

      The 1000th Contest
    • Battery Powered Contest

      Battery Powered Contest
    • Hand Tools Only Challenge

      Hand Tools Only Challenge

    14 Discussions


    Question 10 months ago

    love your instruct can pixel rings be used instead of the single led's


    Answer 5 weeks ago

    Hey there sorry for the late reply, dont see why you couldnt use pixel rings


    1 year ago

    Wow, great tutorial, thank you so much for taking the time and sharing your instructions!


    1 year ago

    Your light modules are amazing! What tool did you use to melt the wires to the components?


    Reply 1 year ago

    Thanks so much means a lot! Umm a little unsure what you mean but I used a soldering iron to solder all the components together


    1 year ago

    Nice project.

    I always wanted to buy a few Nanoleaf kits, but they are prohibitively expensive and your solution is far more cost efficient.

    One thing I noticed, in your pictures of the lit hexagons, that there are 'hot spots' where the LEDs are located. I'm not sure if one would be able to notice that when looking at it directly. Seems that one would, especially when the brightness is turned down. Is there a way to mitigate the hot spots so that the light is spread evenly across the surface?

    Here's an idea, LCD screens that are edge-lit as most are, have a film that evenly disperses the light across the entire surface of the screen. Maybe that is something that could be exploited for this project. To reduce cost, find an electronics junk recycler and buy up a bunch of non-working monitors to harvest the special film. Then the film can be cut to shape and applied to the interior of the hexagons.


    Reply 1 year ago

    Hey thanks for the post! So the real solution here is... well nothing. Unfortunately for me and my videos and photos I had to use my phone camera and whilst it's not bad it created these bright spots ... I tried to minimise this keeping the brightness as low as possible also creating less light flow.
    However if you were worried you could diffuse the light more with a different infill on the clear part or add paper as I've seen that diffuse very well. Or even add more leds


    1 year ago

    Awesome project. It's a super cool idea. Thanks for sharing with us!


    Reply 1 year ago

    Thanks so much! This project worked out so well I couldn't resist sharing it! Means a lot people enjoy it, means I can keep on doing this


    Reply 1 year ago

    You did a fine job of explaining how to calculate the current
    required for each hexagon. Then you displayed a lack of understanding
    of how PWM driving of LEDs works. If you measure the current draw
    with an ammeter you are getting the average current, not the peak
    current. When an LED is driven by PWM the LED will draw the full 20mA
    for as long as it is powered on. PWM allows you to set how long the
    LED is on for in a fixed window of time. The longer the LED is on,
    the brighter it appears to the human eye. If you were to use optical
    equipment to measure the brightness, you would see that the LED has a
    constant brightness, no matter the PWM on time. PWM is a trick used
    to fool the human eye into thinking that the LED is dimming.

    My main point here
    is that no matter the perceived brightness, the LEDs always draw the
    same amount of current, just for a variable amount of time. Therefore
    your power supply should always be capable of supplying the
    calculated current for all of the LEDs that you are using. If you do
    not then the 5V line will drop when the maximum current of the power supply is exceeded.
    This could cause random momentary errors.

    If you insist on
    using an under powered power supply then add large bypass capacitors
    to each hexagon. Something on the order of 500uf 10V electrolytic cap
    or a 5V supercap should do it. Then the capacitors can supply the
    extra current when needed and charge when the PWM turns the LEDs off.

    You need to use an
    oscilloscope with a current probe to see the peak current draw when
    the PWM lights up the LEDs. Bottom line here is that your power supply and wiring should be capable of supplying the full calculated current or suffer the consequences.


    Reply 1 year ago

    Hey there thanks for the explanation! I love to learn this stuff!


    Reply 1 year ago

    I maybe think that the reply is
    addressed to the author of the project. I simply added a comment of thanks, this is not my project of course