Circadian Cycle Lamp

by seanjmarchetti in Circuits > Microcontrollers

52 Views, 0 Favorites, 0 Comments

Circadian Cycle Lamp

image.jpeg

I have made a lamp that is supposed to change its lighting based on the Circadian cycle that can lead to better quality sleep that also has an inbuilt alarm so it indirectly stops phone usage, this is with a Seeed Studio XIAO ESP32-C3 microcontroller.


previous research:

https://www.instructables.com/WeggUp-A-sleeping-cycle-and-light-alarm-clocke/

very complicated design, not super achievable for a beginner, it does use a raspberry pi pico but it also uses a wifi stick, its a light but also makes sound and also a safety feature of temperature sensors to prevent overheating. The main limitation is just how complex the design is and especially all of the excess hardware being used outside the pico.

https://www.instructables.com/LED-Lamp-With-Sleep-Timer/

This person is recycling a office light to be able to have a adjustable brightness settings and for it to be automatic, the materials used are:

  1. Desk Lamp
  2. DC Power Adapter
  3. Bright LED's
  4. 330 microfarad Capacitor
  5. 5 kohm Potentiometer
  6. 10 Mohm Resistor
  7. 6.8 kohm Resistor
  8. 5V Voltage Regulator (such as LM7805 )
  9. IRF510 MOSFET
  10. Switch
  11. Perf Board

The main limitation is the light not using a pico, like we are using and also its a lot of effort when it comes to gutting a desk lamp without damaging it and also repurposing would be difficult

https://www.instructables.com/A-Smart-Lamp-That-Wakes-You-Up-at-the-Optimal-Time/

this light replicates the sunrise and also has a calculator that also wakes you up using sound the supplies used are:

  1. Xiao esp32C3: Link to buy
  2. Ws2813 addressable LEDs: Link to buy
  3. IR proximity sensor: Link to buy
  4. A damaged laptop screen to recycle the diffusion sheet (or a standard diffusion sheet)
  5. Jumper wires
  6. Soldering iron
  7. Wood / Foam board
  8. Paint

one limitation is the laptop screen/diffusion sheet honestly that's too much effort, another limitation is the light plus sound, mainly because I'm still a beginner and I don't know how to run two complicated things in one and also I don't really find the sound worth it.


Supplies

image.png
1-113991054-seeed-studio-xiao-esp32c3-45font_1.jpg
WS2812B 16 ring  1-600x600.jpeg

Tools

  1. Soldering Iron

Electronics

  1. Seeed Studio XIAO ESP32-C3
  2. Wires (assorted)
  3. LED Ring

Diagram

Screenshot 2025-10-15 at 12.23.38.png
  1. Connect a wire between Vbus and the 5v, because Vbus allows for a 5 volt output (dark wire)
  2. Connect a wire between ground on the Micro controller (which is directly underneath the VBUS pin) to Ground on the ring light on the diagram this is the purple wire
  3. Connect the data input pin to a General power output pin (GPO) in this case I'm using GPO 1 which the is dark blue wire.

Solder the Header Pins to the Micro Controller and Assemble the Light

IMG_9696.JPG
IMG_9698.JPG

Code

IMG_9790.JPG
import machine
import neopixel
import time

# Configuration
PIN = 2 # Pin where the NeoPixel is connected
NUMPIXELS = 16 # Number of pixels in the NeoPixel ring
BRIGHTNESS = 128 # Set brightness to 50% (0-255 scale)

# Initialize NeoPixel
np = neopixel.NeoPixel(machine.Pin(PIN), NUMPIXELS)

def set_color(r, g, b):
"""Set the color of all pixels in the NeoPixel ring."""
for i in range(NUMPIXELS):
np[i] = (int(r * BRIGHTNESS / 255), int(g * BRIGHTNESS / 255), int(b * BRIGHTNESS / 255))
np.write()

def orange_to_white_transition(wait):
"""Transition from orange to white."""
# Transition from orange to white
for i in range(256):
set_color(i, 165, 0) # Orange (R: i, G: 165, B: 0)
time.sleep(wait)
for i in range(256):
set_color(255, 255, 255) # White (R: 255, G: 255, B: 255)
time.sleep(wait)

# Main loop
while True:
orange_to_white_transition(0.05) # Adjust the speed of the transition

Test

image.jpeg

as you can see the turns on, not sure why 4 of the leds don't work however its still very bright so I have no issues