mohan-bee/light-controller

This code defines the hardware sections and symbols for a PCB involving USB power, voltage regulation, ESP12F module, RGB outputs, I2C sensors, and debug points, along with rendering labels for test points.

Version
1.0.30
License
unset
Stars
2

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone mohan-bee/light-controller  # download the package files into ./light-controller
tsci add mohan-bee/light-controller    # add it to your project as @tsci/mohan-bee.light-controller

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

Files

README.md

# Wi-Fi RGB Light Controller

This is a small board that makes a normal RGB LED strip smart. It also has a small RGB test LED in the center, so you can program and test every color before connecting a strip.

Connect a 5 V RGB strip, power the board through USB-C, and program the ESP8266 through the UART holes using an external 3.3 V USB-to-UART adapter. The included Wi-Fi firmware creates its own network and provides a color wheel, scenes, more than 20 light shows, custom palettes, detailed animation controls, clap/beat disco, and a sleep timer. The Android app can also use the phone's microphone, motion sensors, light sensor, proximity sensor, step detector, rotation sensor, and camera.

![Light controller board](dist/index/pcb.png)

## How it works

The ESP8266 is the brain of the board. It connects to Wi-Fi, listens for commands, reads the sensors, and controls the red, green, and blue parts of both the onboard test LED and the LED strip.

By mixing those three colors, the board can create many other colors:

- Red and green make yellow
- Red and blue make purple
- Green and blue make cyan
- All three together make white

USB-C powers the controller and the 5 V LED strip. To reduce cost, programs are uploaded through the UART header with an external 3.3 V USB-to-UART adapter.

## Sensor connections

The board has three four-pin through-hole positions for sensors. No headers are fitted by default, so you can hand-solder male or female 2.54 mm headers later. Each position has the same connections:

```text
GND   3V3   SDA   SCL
```

The connections use I2C, which lets several sensors share the same SDA and SCL wires. This means you can connect a temperature sensor, a light sensor, and an I2C motion or presence sensor at the same time.

Each sensor must have a different I2C address. Most different types of sensors already do. If two sensors use the same address, the ESP8266 cannot tell them apart unless the sensor address can be changed.

Always use sensors that work with **3.3 V** and check the pin order before plugging them in.

## A little demo story

Imagine this controller behind a light strip in your room.

In the morning, the light sensor notices sunlight entering the room. The controller keeps the LED strip dim because the room is already bright.

In the evening, the room becomes darker. The controller slowly turns the strip on with a warm orange color.

When the motion sensor notices someone entering, the light becomes brighter. If nobody is detected for a while, it gently fades down to save power.

The temperature sensor can also change the mood of the room. A cool room could use a soft blue color. As the room becomes warmer, the light could slowly change from blue to yellow and then red.

Your phone app can still take control at any time. You could choose a color, change the brightness, turn automatic sensor control on or off, or check the latest sensor readings over Wi-Fi.

## Example automatic rules

- If the room is dark and motion is detected, turn on a warm white light.
- If no motion is detected for five minutes, fade the light off.
- If the room becomes hot, slowly change the light toward red.
- If the room is already bright, reduce the LED brightness.
- At night, use a dim blue light instead of a bright white light.

These rules are created in the program you upload to the ESP8266. The board provides power, Wi-Fi, three optional sensor-header footprints, and RGB outputs.

## Getting started

1. Power the board through USB-C.
2. Hand-solder a three-pin header into J_UART, or temporarily connect wires to its `RX`, `TX`, and `GND` holes.
3. Connect a 3.3 V USB-to-UART adapter: adapter TX to board RX, adapter RX to board TX, and GND to GND. Leave the adapter power pin disconnected.
4. Hold **BOOT**, press and release **RESET**, and then release **BOOT**.
5. Upload your ESP8266 program through the adapter.
6. Connect the ESP8266 to your Wi-Fi network from the program.
7. Test colors immediately with the RGB LED in the center of the board.
8. When ready, hand-solder J2 and connect the 5 V RGB strip to `+5V`, `R`, `G`, and `B`.
9. Add headers or wires to the sensor holes and connect compatible I2C sensors.
10. Use your app or automatic sensor rules to control the light.

No phone app is required. The included [`WIFI_LIGHT_CONTROLLER.ino`](./firmware/WIFI_LIGHT_CONTROLLER/WIFI_LIGHT_CONTROLLER.ino) firmware serves the control page directly from the ESP8266.

## Important

- Use only a **5 V, four-wire analog RGB strip**.
- Do not connect a 12 V strip.
- J2 directly supports only four-wire analog RGB strips.
- An addressable WS2812B or SK6812 strip can be tested using a sensor-header GPIO and separate wiring, but it does not connect directly to J2. See [`ADDRESSABLE_STRIPS.md`](./docs/ADDRESSABLE_STRIPS.md).
- Use only **3.3 V I2C sensors** on the sensor connections.
- Check `GND`, `3V3`, `SDA`, and `SCL` before connecting a sensor.
- Use a good USB-C power supply that can provide enough power for the LED strip.
- USB-C is power-only; it does not carry programming data.
- Keep the strip disconnected during the first power and programming test.

## Assembly choices

JLCPCB assembles the RESET and BOOT buttons, the 10 ยตF RGB supply capacitor, and the onboard RGB test LED with its three resistors. J2, J_UART, and all three sensor headers are intentionally left unpopulated for hand soldering. See [`HAND_SOLDER.md`](./docs/HAND_SOLDER.md).

## More guides

- [`HOW_TO_PROGRAM.md`](./docs/HOW_TO_PROGRAM.md) โ€” simple ESP8266 programming guide
- [`INSTRUCTION.md`](./docs/INSTRUCTION.md) โ€” buying, wiring, programming, and first test
- [`SENSORS.md`](./docs/SENSORS.md) โ€” sensor choices and example automations
- [`ADDRESSABLE_STRIPS.md`](./docs/ADDRESSABLE_STRIPS.md) โ€” optional individual-LED and tail-animation wiring
- [`HAND_SOLDER.md`](./docs/HAND_SOLDER.md) โ€” parts intentionally left for hand soldering
- [`DETAILS.md`](./docs/DETAILS.md) โ€” simple explanation of every circuit section
- [`SAMPLE_LIGHT_CONTROLLER.ino`](./firmware/SAMPLE_LIGHT_CONTROLLER/SAMPLE_LIGHT_CONTROLLER.ino) โ€” starter ESP8266 program
- [`WIFI_LIGHT_CONTROLLER.ino`](./firmware/WIFI_LIGHT_CONTROLLER/WIFI_LIGHT_CONTROLLER.ino) โ€” complete Wi-Fi color-wheel controller
- [`Mohan-Glow-Studio-v2.apk`](./releases/Mohan-Glow-Studio-v2.apk) โ€” latest ready-to-install Android controller
- [`android-app`](./android-app/) โ€” complete Android app source

## Clap disco mode

The Wi-Fi page includes a microphone button, live sound meter, and sensitivity slider. Strong claps or beats create bright random-color flashes. If the sound stops, the LEDs turn off automatically.

Phone browsers normally block microphone access on the controller's local HTTP page. Install [`Mohan-Glow-Studio-v2.apk`](./releases/Mohan-Glow-Studio-v2.apk) instead. Its native microphone mode supports clap, music-beat, and volume-pulse reactions, with sensitivity, brightness, beat-gap, random-color, calibration, and light-on-time controls.

## Mohan Glow Studio 2.0

The Android app has five simple areas:

- **Home:** color wheel, quick colors, brightness, scenes, saved scenes, and sleep timer.
- **Effects:** 23 animations plus speed, smoothness, randomness, minimum glow, and a custom three-color palette.
- **Reactive:** clap, strong-beat, and volume modes using the phone microphone.
- **Sensors:** tilt color, tilt brightness, shake scene, dance mode, face-down off, hand-wave toggle, room-light brightness, step flash, rotation speed, and camera color capture.
- **More:** daily wake/bedtime routines, controller refresh, and emergency off.

The hardware uses a four-wire analog RGB strip, so every LED on the strip always shows the same color. Individual moving pixels or tail animations need a separately wired addressable strip.