ESP ZeroCode AI · Community
Arjun's Night Light
I want a little night light for my 5 year old son's bedroom. He is scared of the dark but the room can't be too bright or he won't sleep. I would like it to glow in different colours - he loves orange and purple - and he should be able to change the colour himself with a button, because he likes pressing things. Most importantly it should turn itself off on its own after about an hour, so I don't have to creep in and switch it off after he falls asleep. It should be soft and warm, not a harsh bright white. If I can also turn it on from my phone that would be a bonus but it is not essential. I have no idea what parts I need - please pick sensible ones for me.
What it does
- RGB LED with 6 preset colors (orange, purple, white, warm white, light blue, soft green)
- Button cycles through colors; each press advances to next color
- Brightness dimming (PWM control) for gentle, non-glaring light
- Auto-shutoff timer: light turns off after ~60 minutes unless button pressed in last 10 minutes (keeps light on while child is awake)
- Matter WiFi + Thread connectivity for optional remote on/off and color change from phone
- Mains powered via AC/DC power supply
Manual
Device Type
Smart Color Night Light for Young Children
Device Purpose
A soft, color-changing bedroom light that helps a young child feel safe in the dark while enabling sleep through gentle colors and automatic shutoff. Parents can optionally control it remotely via their phone.
Hardware
chip: ESP32-C6 — powerInput: 5V AC/DC mains adapter (wall plug) — gpios: rgb_red_pwm: GPIO for red LED PWM control — rgb_green_pwm: GPIO for green LED PWM control — rgb_blue_pwm: GPIO for blue LED PWM control — button_color_select: GPIO for color-select button (active-low with internal pull-up) — peripherals: type: RGB LED — description: Common-anode RGB LED driven by three PWM channels for color mixing — reason: Simplest hardware implementation for color control; supports smooth brightness dimming via PWM · type: Push Button — description: Momentary push button wired active-low to GPIO with pull-up — reason: Child-friendly input; one press = next color
Inputs
kind: Button — Local Color Cycle — label: Color select button — hardware: Push button, active-low GPIO with internal pull-up — behavior: Each press advances to the next color in the preset list (wraps from last color back to first) · kind: Matter WiFi/Thread — Remote Control — label: Phone/cloud commands — hardware: ESP32-C6 WiFi + Thread radio — behavior: Parent can turn light on/off and select color from their phone via Matter. Optional convenience feature.
Outputs
kind: RGB Light — label: Night light — hardware: RGB LED with common anode, three PWM channels (red, green, blue) — behavior: Displays one of 6 preset colors: orange, purple, warm white, white, light blue, soft green. All colors run at 30–40% brightness (child-safe, non-glaring). Brightness can be dimmed further by parent via Matter if needed.
Connectivity
stack: Matter 1.6 — transport: WiFi + Thread (dual-radio) — purpose: Allow parent to remotely turn light on/off, change color, and adjust brightness from phone; future automation integrations
Commissioning
method: Matter QR code or manual pairing code — instructions: Parent uses their phone's Matter-compatible app (Apple Home, Google Home, Samsung SmartThings, etc.) to scan QR code or enter 11-digit manual pairing code printed on device or documentation. Device joins WiFi and/or Thread network during commissioning. After pairing, device is accessible for remote control.
Business Logic
powerOnBehavior: On power-up, light turns on to a default safe color (warm white at low brightness). No stored state required; device is ready for use immediately. — dayToDayOperation: 1. Child enters dark bedroom. 2. Light turns on manually (button press or parent's phone). 3. Child cycles through colors via button press. 4. Device tracks button presses. 5. After ~60 minutes with no button activity, light auto-shuts off. 6. If child presses button within the last 10 minutes of the countdown, auto-shutoff is canceled and child stays in control. 7. Parent can override any time via phone (turn off early, change color, etc.). — colorPresets: Orange — warm, calming · Purple — soothing · Warm White — natural, sleep-friendly · White — bright but soft · Light Blue — cool and calming · Soft Green — natural and restful
Timer Behavior
description: 60-minute auto-shutoff with activity detection — logic: Timer starts when light turns on. Every button press resets the timer to 60 minutes and marks the device as 'active'. If timer reaches zero without any button press in the last 10 minutes, light shuts off. If button is pressed within the last 10 minutes, timer resets again and shutoff is prevented. This allows the child to keep the light on as long as they are awake and playing with it, but ensures it doesn't run all night if forgotten.
Factory Reset
trigger: Hold button for 10+ seconds — effect: Device clears all Matter pairing and WiFi credentials, returns to factory state. Light turns off. Parent must re-commission device via QR code/pairing code.
Failure Modes
scenario: WiFi/Thread network unreachable — behavior: Local button control remains fully functional. Light continues to work standalone. Remote phone control is unavailable until network is restored. Timer behavior unchanged. · scenario: Power loss — behavior: Light turns off immediately. No state is persisted (no battery backup). On power restore, light returns to default safe color at low brightness. · scenario: Button stuck or held — behavior: Firmware debounces button input (50ms minimum between presses). Holding button continuously is ignored after first press.
Power Management
batteryPowered: false — architecture: Mains powered via wall adapter. No sleep modes required. Device is always-on and always-ready to respond to button or network commands.
Custom Behavior
colorCyclingLogic: Pressing button advances through the 6-color list in order; after the last color (soft green), next press wraps back to orange. No random mode; predictable and child-friendly. — brightnessDefault: All preset colors are fixed at ~35% brightness to be non-glaring and safe for a young child's eyes. Parent can optionally control brightness via Matter if more dimming is desired. — activityTracking: Timer logic tracks button press timestamps to implement the 10-minute 'active use' window before auto-shutoff. This is local firmware logic; no cloud dependency.
Published 2026-09-09
Built with ESP ZeroCode AI — describe a device, get production firmware.
Terms of Service · Privacy Policy