Quick Links
Imagine transforming a simple room into a vibrant space with dynamic lighting effects. Nanoleaf light panels have become a popular choice for achieving this, offering a unique blend of functionality and aesthetics. But what if you could build your own mini replica for much cheaper controlled by the power of a Raspberry Pi?
This guide takes you through the exciting process of creating your very own mini Nanoleaf with aRaspberry Pi Zero W.While it requires some experience with soldering and 3D printing, the satisfaction of building and customizing your own light display is well worth the effort.

Before We Begin: Here’s What You Need
This project is geared towards those comfortable with basic electronic tinkering. Having some experience with soldering and3D printingwill definitely give you a head start. If you’re new to these areas, don’t worry! There are plenty of online resources and beginner guides available to help you get familiar with the tools and techniques.
Alongside a little experience with soldering and 3D printing, you’ll also need to get your hands on this gear:

Let’s get building!
First, you’ll need todownload the STL files for the enclosure components. These include three mini base/top plates and one each of the box enclosure top and bottom.
Once downloaded, print all the parts according to your 3D printer’s instructions. There are also workarounds to3D print stuff without your own printer.

Step 2: Prepare the LEDs
Using sharp scissors, carefully snip the LED strips along the designated cut lines. For this project, you’ll need exactly nine individual LEDs. Be mindful not to cut in between the designated markings, as this can damage the strip.
Many LED strips come with a waterproof coating. If yours does, you’ll need to carefully remove a small section of the coating from the soldering pads before proceeding.

Now comes the fun part: building the LED layout! Gently bend each LED to fit snugly in the corners of the bottom enclosure. Take your time here to ensure clean and even distribution of the LEDs.
Step 3: Make the Circuit Connections
Here comes the delicate part: soldering jumper wires between corresponding pins on the LEDs. Typically, these will be GND (ground), DIN (data), and 5V (power). Make sure to connect the LEDs in series, meaning each LED’s output connects to the next LED’s input (except for the first and last LEDs in the chain).
Double-check your LED strip’s specifications to see if any resistors are required when connecting them to the Raspberry Pi.

It’s time to add the brain to your DIY Nanoleaf.
Step 4: Attach the Raspberry Pi and Loop Wires
Carefully place the Raspberry Pi Zero W inside the bottom enclosure, ensuring the LED wires can loop through the designated hole.
Now comes the time to solder the jumper wires to the Raspberry Pi’s GPIO pins. Consult the pin layout for your Raspberry Pi model (schematics available online at Raspberry Pi website) and carefully solder the GND, 5V, and DIN wires to the corresponding pins (for example, GPIO 18 for DIN). Next, loop those three previously unconnected wires through the hole in the next enclosure. You’ll be soldering these wires to the fourth LED in the next step.

Step 5: Complete the Circuit and Add Diffusers
Repeat the soldering process from Step 3, connecting the three looped wires from the previous enclosure to the new LED. Continue this process for all remaining LEDs and enclosures, ensuring all LEDs are wired in series.
To diffuse the LEDs and create a softer light, we can use plain white printer paper. Trace the outline of the LED enclosure onto the paper and cut out the traced shape with slight adjustments to ensure a snug fit inside the enclosure. Place the paper diffusers inside the enclosures and snap the top components back on.

Now, let’s control those LEDs with some code!
Step 6: Program Your Pi With the Complete Code
Now to program the Raspberry Pi, make sure you have set up SSH and launched a terminal window. Not sure how to do so? We’ve got a separate guide onconfiguring your Raspberry Piif you need a refresher. Open up thenano editorwith the following command:
Then copy and paste the following code into the nano editor.

The code sets up a Raspberry Pi to control NeoPixel LED strips. It imports necessary modules: time, board, and neopixel. It defines functions for generating colors (wheel(pos)) and cycling through a rainbow effect (rainbow_cycle(wait)). The main loop sets LED colors sequentially to red, green, and blue, then calls the rainbow cycle function.
import time
import board
import neopixel
Choose an open pin connected to the Data In of the LED strip, i.e. board.D18
The LED strip must be connected to D10, D12, D18 or D21 to work.
pixel_pin = board.D18
The number of LEDs
num_pixels = 9
The order of the pixel colors - RGB or GRB. Some LEDs have red and green reversed!
For RGBW LEDs, simply change the ORDER to RGBW or GRBW.
ORDER = neopixel.GRB
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=1, auto_write=False,
pixel_order=ORDER)
def wheel(pos):
Input a value 0 to 255 to get a color value.
The colours are a transition r - g - b - back to r.
if pos < 0 or pos > 255:
r = g = b = 0
r = int(pos * 3)
g = int(255 - pos*3)
b = 0
pos -= 85
r = int(255 - pos*3)
g = 0
b = int(pos*3)
pos -= 170
r = 0
g = int(pos*3)
b = int(255 - pos*3)
return (r, g, b) if ORDER == neopixel.RGB or ORDER == neopixel.GRB else (r, g, b, 0)
pixel_index = (i * 256 // num_pixels) + j
pixels[i] = wheel(pixel_index & 255)
pixels.show()
time.sleep(wait)
while True:
Comment this line out if your LED strips are RGBW/GRBW
pixels.fill((255, 0, 0))
Uncomment this line if you have RGBW/GRBW LED strips
pixels.fill((255, 0, 0, 0))
time.sleep(1)
Comment this line out if you have RGBW/GRBW LED strips
pixels.fill((0, 255, 0))
pixels.fill((0, 255, 0, 0))
pixels.fill((0, 0, 255))
pixels.fill((0, 0, 255, 0))
rainbow_cycle(0.001) # rainbow cycle with 1ms delay per step
Save with CTRL+X and press Y for YES. Then run the code withsudo python3 file-name.py.
Once you’ve completed the above steps and connected the Raspberry Pi, it’s time for the moment of truth! Power on your mini Nanoleaf and watch as the LEDs illuminate.
This might involve individual colors like red, green, and blue, or even a captivating rainbow effect.
Additional Tips and Tricks
This is just the beginning of your mini Nanoleaf’s potential! Here are some other exciting ways to personalize your light:
With a little planning, effort, and this guide as your companion, you’ll be well on your way to crafting a unique and functional mini Nanoleaf that adds a touch of magic to your space!