Circadian Light

by carterl in Circuits > Electronics

208 Views, 6 Favorites, 0 Comments

Circadian Light

download.jpg

I have made a Circadian Light using a Raspberry Pi Pico to control of the LEDs, and made a frame out of wood and 3D print.

Supplies

Screenshot 2025-05-12 095212.png

Tools

  1. Soldering Iron and Wire

Electronics

  1. Raspberry Pi Pico
  2. Neopixel Stick x 2
  3. 6 Wires (Two Red, Two White, Two Black)

Lamp

  1. 3D Printed Lamp Shade

Wire Neopixels

ea14e831-978a-464e-936e-39fe8aa2284b.jpg

Wire and solder between the two Neopixels, attaching GND to GND, DOUT to DIN and 5VDC to 5VCD.

Wire Neopixels to Raspberry Pi Pico

cdc7d63a-8831-4a5a-9609-a54109217f7d.jpg

Wire and solder:

Neopixel GND to Raspberry Pi pin 40 (GND)

Neopixel 5VCD to Raspberry Pi pin 38 (VBUS)

Neopixel DIN to Raspberry Pi pin 1 (GP0)

Test Code

import machine

import neopixel

import time


# Configuration

NUM_PIXELS = 16 # Change if your NeoPixel stick has more LEDs

PIN_NUM = 0 # GPIO0 = physical pin 1


# Initialize NeoPixel

np = neopixel.NeoPixel(machine.Pin(PIN_NUM), NUM_PIXELS)


# Helper to set all pixels to a color

def set_all(r, g, b):

for i in range(NUM_PIXELS):

np[i] = (r, g, b)

np.write()


# Fade in/out function

def fade_to_color(r_target, g_target, b_target, steps=50, delay=0.02):

for i in range(steps + 1):

r = int(r_target * i / steps)

g = int(g_target * i / steps)

b = int(b_target * i / steps)

set_all(r, g, b)

time.sleep(delay)


def fade_off(steps=50, delay=0.02):

current = np[0] # Assuming all same color

r0, g0, b0 = current

for i in range(steps, -1, -1):

r = int(r0 * i / steps)

g = int(g0 * i / steps)

b = int(b0 * i / steps)

set_all(r, g, b)

time.sleep(delay)


# Main loop

while True:

# Fade into blue

fade_to_color(25, 100, 255)

time.sleep(3)


# Fade off

fade_off()

time.sleep(2)

# Fade into orange

fade_to_color(255, 100, 0)

time.sleep(3)


# Fade off

fade_off()

time.sleep(2)



Code similar to the final code, to make sure all connections are correct and working, if all works continue to next step.

Enter Final Code

import machine

import neopixel

import time


# Configuration

NUM_PIXELS = 16 # Change if your NeoPixel stick has more LEDs

PIN_NUM = 0 # GPIO0 = physical pin 1


# Initialize NeoPixel

np = neopixel.NeoPixel(machine.Pin(PIN_NUM), NUM_PIXELS)


# Helper to set all pixels to a color

def set_all(r, g, b):

for i in range(NUM_PIXELS):

np[i] = (r, g, b)

np.write()


# Fade in/out function

def fade_to_color(r_target, g_target, b_target, steps=50, delay=0.02):

for i in range(steps + 1):

r = int(r_target * i / steps)

g = int(g_target * i / steps)

b = int(b_target * i / steps)

set_all(r, g, b)

time.sleep(delay)


def fade_off(steps=50, delay=0.02):

current = np[0] # Assuming all same color

r0, g0, b0 = current

for i in range(steps, -1, -1):

r = int(r0 * i / steps)

g = int(g0 * i / steps)

b = int(b0 * i / steps)

set_all(r, g, b)

time.sleep(delay)


# Main loop

while True:

# Fade into orange

fade_to_color(255, 100, 0)

time.sleep(3600)

# Fade off

fade_off()

time.sleep(36000)

# Fade into blue

fade_to_color(25, 100, 255)

time.sleep(3600)


# Fade off

fade_off()

time.sleep(46800)

Print 3D Model Lamp

Screenshot 2025-05-26 094023.png

Print Lamp Shade with Clear 3D laminate.

Print Electronics Holder with Black/Neutral coloured 3D Laminate

Assemble

9c982475-de4e-483a-9918-187d02a9b7e3.jpg
b0f5821a-6f78-49f1-81c4-407c938f4cbb.jpg

Assemble all the pieces