Imp005 - Notification LED - Only Blue working

#1

Hey everyone,

Having issues with a device we have set up.
Essentially we have connected the board to to a breadboard with an LED in it. We have used the PWM pins (USV) for the RGB and are using a Slack command to call the different colours.

The commands work correctly as we are seeing the calls appear in the IMP logs, however the only colour that actually appears is the Blue. Neither the Green or the Red seem to be getting power sent to them.

The board appears to be set up correctly but open to any help anyone can provide.

    Device Code
    //***********IMP 2.0 LED CODE******************
// Pin Assignments
// Pin U = PWM for Red
// Pin S = PWM for Green
// Pin V = PWM for Blue
 
// Configure Hardware
hardware.pinU.configure(PWM_OUT, 0.001752, 1.0); // Red
hardware.pinS.configure(PWM_OUT, 0.001752, 1.0); // Green
hardware.pinV.configure(PWM_OUT, 0.001752, 1.0); // Blue
 
local currentColor = null;
 
class RgbLed
{
    // IO Pin assignments
    pinR = null;
    pinG = null;
    pinB = null;
   
    constructor(r, g, b)
    {
        // Save pin assignments
        pinR = r;
        pinG = g;
        pinB = b;
        // Initialise as inactive
        setLevels(0, 0, 0);
    }
       
 
 // Set red, green and blue intensity levels
function setLevels(r, g, b)
    {
        // output pin is configured for PWM, we can set the duty cycle with pin.write()
        // write a floating point number between 0.0 and 1.0, where 1.0 = 100% duty cycle
        //server.log("RgbLed.setLevels");
        this.pinR.write(r/1.0);
        this.pinG.write(g/1.0);
        this.pinB.write(b/1.0);
    }
}
led <- RgbLed(hardware.pinU, hardware.pinS, hardware.pinV);
 
 
//}
//************Color Request******************
//{
agent.on("ColorRequest", function(x)
{
    local r = x[0].tointeger();
    local g = x[1].tointeger();
    local b = x[2].tointeger();
    led.setLevels(r,g,b);
    currentColor = x;
});
//}
//}
//}
 
//************Status Request******************
 
agent.on("statusRequest", function(x)
{
    agent.send("Status", currentColor);
});
 
//************Restart Request******************
 
agent.on("restartRequest", function(x)
{
    server.restart();
});
#2

Are you using current limiting resistors?

#3

We are using a 100ohm resistors but are limiting the voltage to 3v using the PWM.

#4

I’m actually surprised that blue works at all, as 3.3v is usually barely enough to drive blue LEDs (usually it’s nearer 3.8v).

Can you check the wiring of the LED? The datasheets for some of these big LEDs are awful, eg https://cdn-shop.adafruit.com/datasheets/FD-5WSRGB-A.pdf which looks close to your one but forgets to tell you that pin 4 is most likely blue (matching your wiring if the lines are straight).

The way you have this wired, you need a common cathode LED, ie pin 1 (confusingly not at the end, but instead the longest pin) wired as ground.

If you had a common anode LED, like the variant that Adafruit sell here https://www.adafruit.com/product/159 you would need to connect pin 1 to 3.3v (and then the lower the PWM duty cycle, the more “on” each LED would be).