Smart Lighting: The Driver, the Controller and the Radio
A smart light is three parts in a box: an LED driver, a small controller and a radio. Learn each one, then you can design one from scratch.
A light is a driver, a controller and a radio
The LED itself is the easy part. A diode has a forward voltage, about 1.9 V for white and about 2.1 V for blue, and it must be driven with a controlled current rather than a controlled voltage, because LED forward voltage rises steeply with temperature. Get the current wrong and the LED gets brighter, hotter, brighter still, and eventually fails.
A plain 5 mm LED takes about 20 mA and needs a resistor to set that current. An addressable strip such as a WS2812B has its own driver chip on every LED, and those chips also set the current, so the strip is a 5 V device with a data line rather than a set of raw outputs. At full white, one LED on such a strip can draw close to 60 mA, which is why a one-metre strip needs a real 5 V supply rather than a USB socket. The controller is what makes it dimmable or colour changing. Dimming is done by pulse width modulation: the LED is switched fully on for a fraction of each cycle, and the average current sets the brightness. The controller also holds the colour maths. An RGB LED has three channels, and a colour is just three numbers between 0 and 255. The radio is what turns it into a smart light, and it can be Wi-Fi, Bluetooth, Zigbee or a thread of its own.
The two mistakes that show up in every class
The first is driving a light from a microcontroller pin. An Arduino pin is rated for about 20 mA, and a strip can pull hundreds. Connect it directly and the first thing that happens is the supply rail sags and the board resets, sometimes taking the USB port with it. The fix is a MOSFET acting as a switch, the strip powered from its own supply, and the grounds joined. The relay driver project shows the same idea for a bigger load.
The second is flicker. The default PWM frequency on an Arduino is around 490 Hz, and at 980 Hz on some pins. That is fast enough to look smooth to the eye but slow enough to show as banding on a camera, and some people with certain conditions find it uncomfortable. A LED strip on a camera at 1000 frames per second shows obvious dark bands, which is a real problem for anyone filming a demonstration. There is a third, subtler issue: dimming by reducing current changes the colour, because the different channels have different forward voltages and different efficiency curves. A red LED at half current looks dimmer than a blue LED at half current. That is why good lighting control dims in a perceptually even space rather than by scaling raw numbers, and it is worth showing students side by side.
Step by step
-
Light one LED correctly
Use a resistor or a constant-current driver and measure the voltage across the LED with a multimeter. Seeing 1.9 V across a white LED explains why the resistor value matters.
-
Dim it with PWM and watch the average
Use analogWrite on an LED and a multimeter in DC mode to see the average voltage fall as the duty cycle drops.
-
Switch a strip with a MOSFET
Drive the strip from its own 5 V supply through a logic-level MOSFET, with the grounds joined, and a capacitor across the strip for the switch-on spike.
-
Send a pattern down an addressable strip
Drive the data line and light LEDs in sequence. The protocol is a timing problem, which is exactly why the Pico's PIO blocks exist.
-
Mix a colour and check the current
Set a red, a green and a blue channel and measure the supply current at each setting. The difference between red and blue at the same number is the real lesson.
-
Put a controller and a radio on the lamp
Add an ESP32 to the driver so the lamp takes a command over Wi-Fi, then drive brightness and colour from a phone or a browser page.
What you'll need
| Item | Qty | Why |
|---|---|---|
| 5 mm LED, assorted colours | 10 | One of each colour so you can compare forward voltage and efficiency side by side. |
| Resistor assortment, 100 ohm to 1 kohm | 1 set | Sets the current through a plain LED. A missing resistor is the classic beginner failure. |
| WS2812B addressable LED strip, 1 metre | 1 | The smart-light standard for teaching, because each LED has its own driver and colour channel. |
| Logic-level N-channel MOSFET | 2 | Switches the strip from a 3.3 V pin without the pin ever carrying the load current. |
| ESP32 DevKit board | 1 | The controller and radio that turn a strip into a smart light you can command. |
| 5 V, 3 A power supply and electrolytic capacitor, 1000 uF | 1 each | The strip needs its own supply, and the capacitor absorbs the current spike when it switches on. |
Practise it before you build it
Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real
Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the
LED on screen and the readings change when you change the wiring — no hardware, no burnt components.
A "chaser" or "Knight Rider" effect is one of the most iconic Arduino beginner projects. You light up 5 LEDs in sequence: 1, 2, 3, 4, 5, then back: 4, 3, 2, 1, then back: 1, 2, 3... The trick is to store the LED pin numbers in an array and use a for-loop to step through them. This is the same pattern used in real LED animations, scrolling marquees, and Christmas lights.
An RGB LED actually contains three tiny LEDs in one package — red, green, and blue. By switching each color on or off independently and mixing them, you can produce seven colors: red, green, blue, yellow (R+G), cyan (G+B), magenta (R+B), and white (R+G+B). In this analog build, each color has its own switch — flip one or combine several to mix colors.
An RGB LED has three LEDs in one package (red, green, blue). By controlling each one's brightness with PWM, you can mix ANY color of the rainbow — including white, pastels, and off. With three potentiometers as input controls, this becomes a "color picker": turn the knobs to mix live. This is how stage lighting and TV backlights work in miniature.
A 10-segment LED bar graph is the easiest way to visualize an analog input: spin a potentiometer and 1, 2, 3 ... 10 LEDs light up in sequence. This is a "VU meter" — the kind you see on stereo equipment. The Mega is ideal because it has 10 free digital pins without stealing any from the analog or serial pins. The same code can be extended to 20, 30, or 100 LEDs on a Mega.
Real LEDs don't just blink — they fade smoothly. Arduino pins marked with ~ (D3, D5, D6, D9, D10, D11) support PWM, which means analogWrite(pin, value) can output 256 different brightness levels instead of just HIGH/LOW. The LED appears to "breathe" smoothly. This is the foundation of every dimmer, color mixer, and motor speed controller.
When you spin a magnet inside a coil of wire, or move a coil past a magnet, you generate electricity. This is called electromagnetic induction (discovered by Michael Faraday in 1831). Bike dynamos use this principle: a small wheel rubs against the bike tire, spinning a magnet inside a coil. The faster you pedal, the more electricity you produce. In this project, you'll build a simple hand-crank generator circuit that powers an LED — proving you can make light from motion alone.
Common questions
Why does my LED strip reset the Arduino when it turns on?
Inrush current. The strip's capacitors charge in a few milliseconds and pull a sharp spike through the supply, the rail sags, and the board resets. Power the strip from its own 5 V supply, join the grounds, and fit a 1000 uF capacitor across the strip's supply close to the strip. Keeping the strip off the Arduino's 5 V pin is the other half of the fix.
Do I need an addressable strip, or are plain LEDs fine?
Plain LEDs are fine for learning the basics: current limiting, PWM dimming and colour mixing are all taught with three LEDs and three resistors. Addressable strips add a data protocol on top, which is worth doing once you have the fundamentals right, because it adds a timing problem to solve.
How much electricity does a smart bulb use?
A 9 W LED bulb replaces a 60 W incandescent lamp, and roughly all of the 9 W becomes light rather than heat. The electronics that make it smart add well under 1 W, which is why smart bulbs are still far more efficient than the lamps they replace. The bigger saving in a classroom is switching the lights off when nobody is there, which a sensor and a relay can do reliably.
Related guides
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.