Band 2 · Mood Lamp
Swap Mood lamp on an RGB module
The whole colour story with three wires and no resistors, and an honest look at where the resistors went.
Sketches for this project
Every file opens with a plain-English header saying what it does and how to wire it, hole by hole.
Where did the resistors go?
Band 2's core build uses a loose RGB LED with four legs, and you fit three resistors yourself: one per colour, because an RGB LED is three lights in one case and each needs its own.
The module is the same three lights on a small board, and it needs no resistors at all.
That is either a convenience or a lie, depending on whether you go and look. This build makes you go and look.
Which should you build?
Build Band 2's core with that first. Wire the three resistors, get one backwards, fix it. Then come here afterwards if you want the comparison; it takes twenty minutes.
→ Core first, this second.
Then this is your Band 2, and it teaches the same things. What you would have missed is why the resistors are there, so the Look closer section makes you find them on the board and read their values instead of fitting them.
→ This page, and do the Look closer properly.
Not sure which you have? Run id_02_which_rgb.ino first. It also tells you which way round yours is wired, which you need either way.
Three colour wires, five in all
20 minj, the same pair Band 2 uses. Put every rail wire on that pair and it works; split them across both and nothing lights, with nothing visibly wrong.Turn the module over before you wire anything
Two kinds of RGB module are sold in the same kits and they look identical from the front. This takes ten seconds and it decides whether the next step damages your parts.
The resistors are fitted. This is the common kind and the rest of this page assumes it.
→ Wire the three colour pins straight to the Arduino. Nothing of your own.
This module has no resistors. Wired straight to a pin and asked for 255, it would pull roughly five times what a pin is rated for, and it would damage the light and the pin together.
→ Put a 220 ohm resistor in each of the three colour wires, exactly as the loose LED needs. Then everything else on this page works unchanged.
If you cannot tell, fit the three resistors anyway. On a module that already has them the light is simply a little dimmer and nothing is harmed. When you are unsure, be wrong in the direction that costs you brightness rather than the direction that costs you the part.
| Module pin | Arduino pin | Why this one |
|---|---|---|
R | 9 | All three must have a ~ next to them. Without one you get off and full on and nothing between, which is Band 2's whole subject. |
G | 10 | |
B | 11 | |
- or GND | the − rail | If your fourth pin is marked + or VCC, it goes to 5V instead and yours is the backwards kind. |
Then one wire from the − rail to a GND pin. Five wires in all. The core build also takes five wires, so the module saves you no wiring at all: what it saves is the three resistors and the three careful placements that go with them. Worth noticing, because “a module is simpler” turns out to mean something narrower than it sounds.
Upload b2_05_rgb_module.ino and watch for a full cycle, which takes about twenty seconds.
So the wiring is already right and moving it cannot help. What is left is the numbers, and they really are upside down: 5V on the shared leg means
255 puts five volts on both ends of the light and gives you nothing, while 0 gives you full brightness. Change the three lines inside showColour:analogWrite(redPin, 255 - r); and the same for green and blue.Subtracting from 255 undoes exactly what the hardware did, and every number on every page then means what it says again. Band 2 Part 12 tells you the same two-part story: rewiring the shared leg to 5V is what makes it light, and it leaves 0 bright and 255 off.
~. Check the printing on the board.VCC and you have it on the − rail, the module simply has no power, and that looks exactly like a dead part.Make a diffuser, exactly as the core build asks: a ping pong ball, a sachet-water bottle, or folded white paper over the light.
Find the resistors
25 minTurn the module over, or look closely at the front near the light.
101, 151, 221 or similar. They may be different values from each other.Reading them
At this size they use three digits instead of colour stripes. The first two are the number and the third says how many zeros to add.
101is 10 with one zero, so 100 ohms. Stop at this one if you find it. With five volts on the pin and about two across a red light, 100 ohms lets through roughly 30 thousandths of an amp, and an Arduino pin is rated for 20. On this module all three colours run at once during the sunrise. It works, and it is over the line, and it is the same thing Band 1's traffic module page flags. Note it in your log and do not be surprised if the board runs warm.151is 15 with one zero, so 150 ohms221is 22 with one zero, so 220 ohms, the same value you would have used
Write down all three of yours. If they differ from each other, that is deliberate: red, green and blue LEDs do not need the same resistance to look equally bright, and whoever designed the board made a decision about it that you never got to make.
Questions for your log
- Your module needed no resistors. Where are they?
- If the three values on your board differ, why might that be?
- Comment out everything inside
loopand put six lines there instead:showColour(255,0,0);thendelay(2000);, and the same for green and blue. Upload and watch all three. Do they look equally bright to you? (If yours is the common-anode kind, use 0 where this says 255 and 255 where it says 0.) Putloopback afterwards. - Name one thing you can do with the loose RGB LED that you cannot do with this module.
Something to check yourself against
1. On the module, soldered on, near the light. Turn it over and find them. They did not disappear and they were not made unnecessary: somebody fitted them for you, chose their values without asking you, and put the cost in the price of the board. That is what a module is. Every module you ever meet is a set of decisions somebody made on your behalf, and the useful habit is to go and find out what those decisions were.
2. A red LED lights at a lower voltage than a blue one, so with the same resistor the red would be much brighter. Different resistors even them out. That is a real design decision made on your behalf.
3. Probably not exactly, and blue often looks weakest. Your eye is not equally sensitive to the three colours either, so even perfectly matched LEDs would not look matched. This is why the white in your sunrise may look slightly pink or slightly blue, and why the core build's Part 12 mentions it.
4. Choose the resistor. Put the three colours in different places on the board. Use a different LED. Replace one that burns out. The module traded your choices for your time, and that is a good trade when you already know what you gave up.
Make it yours
40 minThe band's Make task is a colour story of your own, 45 to 90 seconds long, on a real place or a real thing. That does not change here. These are the smaller steps towards it.
- Bronze
- Make the six fades take exactly twice as long, without touching
stepDelay. Leave the twodelaycalls that hold full day and full night alone; those are not fades. Then say what the two different ways of slowing a fade are, and what each one costs you. - Silver
- Add a fourth colour to the story and a fifth fade, so the sequence tells a longer version of the same place. (If you have already done Band 4, do this instead: add a knob that sets the overall brightness without changing the colours, so the same story runs in a dark room. Multiply, do not add, and watch for whole-number division. You will need a potentiometer, which is not in this project's parts list.)
- Gold
- Write your story so that each fade's length is part of the description rather than fixed: give
fadeToa seventh value, how long that fade should take, and work the step delay out from it. Then a slow dawn and a sudden dusk are one line each.
You still owe Band 2 the same evidence
To claim Band 2 you still need:
- A video of your whole colour story, 45 to 90 seconds, not a short clip, with the diffuser on
- Both testers' answers to what they thought it was showing
- Your completed table from Part 8a
- The six PWM pin numbers, written down
- Your sentence about what you saw when you waved your hand
- Your three resistor values off the module, and your answer to question 4
- Your build log
- Five or six correct answers in Part 11, the Check yourself questions, including question 6
Band 2 Part 7 says an RGB light needs three resistors and not one, and getting that wrong is one of the commonest mistakes in the band. You did not fit any. Answer it from what you found on the back of the board, and you will have understood it better than somebody who fitted three without ever looking at them.
Ship it
One video under sixty seconds, and one post of five lines. You built something different from the person next to you, so your video is the one nobody else in the room can post. Say in the post which build you chose and why — that choice is itself worth a line.
The four shots: three seconds of the thing still, fifteen of you doing something to it, fifteen of it responding all the way to the end, and ten of your measurement or the thing that went wrong first.
Show your work has the template and the three checks to
make before anything goes public. Tag it #BozomaBuilds.