Lesson 4 β Lights!
π§βπ» Duration: 40 minutes
π― Target audience: individuals and groups
1. Introductionβ
In HARDWARIO Playground, you can already find inputs, process them and write them to the Dashboard.
That gave you the basic skills for working with sensors and visualizing data.
In this lesson, you will play with an LED strip, which brings light into your work and opens up new creative possibilities.
2. Whatβs readyβ
β
A prepared and paired Button Module or PIR Module
β
Knowing how to work with messages in Playground (the Change and Switch nodes)
β
A Power Module and an LED strip
3. Flash the Power Module firmwareβ
- Connect the Power Module to your computer with a USB cable.
- On the Firmware tab, select the latest version.
- Mine had
twr-radio-power-controller-rgb150installed, but an update certainly wonβt hurt.
- Mine had
- The LED strip does not need to be connected now, but it does no harm if it is.
4. Pair the Power Moduleβ
The Power Module differs from the other modules in that it has no batteries: it is powered directly from a power supply.
- On the Devices tab, click Start pairing.
- Connect the Power Module to the power supply. This switches it to pairing mode.
- After pairing, the Power Module reports as
power-controller:0.

5. Start it up!β
Once again, start the flow with an input that sends messages. There are several options:
β
Button Module: watching for a button press
β
PIR Module: watching the orientation
β
Any module: they all measure temperature (the option for the patient π)
6. What to send to the Power Moduleβ
So far, you have used the mqtt in node to read from sensors.
Now we need to write to the device β we use mqtt out.
A topic that lights up the strip is, for example: node/power-controller:0/led-strip/-/color/set
7. What message to sendβ
If you connect an input (for example Button with the message 1) directly to an output (the strip setting), it will not work correctly.
That is why you use a Change node and set msg.payload in it to a color in hexadecimal RGB code (for example red: "#FF0000").
π If you donβt know RGB color codes, look them up in a color table.

8. Playing with codeβ
This is how you build code that changes the LED strip color according to the PIR sensor orientation:
- Add a Switch node.
- Set a different color (
msg.payload) for each orientation (1β6). - Send it to the Power Module through mqtt out.

9. Colors and effectsβ
It would be a shame not to use the strip to the full. Try, for example, the command node/power-controller:0/led-strip/-/effect/set with this message:
{"type":"rainbow", "wait":10}
Are your eyes hurting from too much brightness? node/power-controller:0/led-strip/-/brightness/set takes a value from 0β100 as the message and sets the brightness accordingly.
10. Addressingβ
You can also address the strip in sections, down to single LEDs. The topic for this is node/power-controller:0/led-strip/-/compound/set. The message holds a list of pairs: the number of LEDs and their color. For example, this message lights the first 20 LEDs red and the next 20 green:
[20, "#ff0000", 20, "#00ff00"]
11. Summaryβ
You have paired the Power Module with the LED strip firmware.
You can light up the LED strip in different colors and even add effects.