Proposal for dimmed LED

Hi there!

Because some mentioned the very bright (and sometimes annoying) RGB-LED, I dived into the source code and finally came up with this modified hw_config.c

http://pastebin.com/Qe9Ds31g

Modifications are:

L59: Added delta4 (used for new TIM1->CCR4)

L94: Definition of LED_DIM

L462-472: Divide by LED_DIM

L678-757: Modulo stuff with TIM1->CC4 and LED_DIM…

I think it’s evil code but it works! :wink:

Feel free to ignore, improve, fork and pull a request!

Frido.

There is acutally a patch in the project, just not merged yet to the master.

Oh great! This looks far better than mine! :wink:

How timely. My wife was telling me that the flashing cyan led of death was so bright that she thought the police were outside. :slight_smile:

Fun fact: Currently the on-board RGB LED defaults to a max brightness of 39.2% … so it can theoretically get even brighter, at the cost of wasting more power. I would say anything above 80% is really not that perceivable by the human eye. Just my experience.

Max is currently 39.2%?! Wow, I assumed it was 100% - naively, I guess. I can’t even look at it directly.

I would probably prefer a default max brightness of much less (though I admit I haven’t played around enough to know exactly what level - adding that to my todo list).

I should clarify, it’s 39.2% duty cycle ON time @ 100Hz PWM (pulse width modulation) … not really 39.2% of the visible output in lumens, more like just the average voltage on the pin that drives the LED. It does get pretty bright when you are trying to look for the GND, TX and 3.3 pins at night though… I usually have to cover it with my finger and reflect light back down to see. Thereafter I’m blind for a bit xD

This is nothing compared to the neopixels though that are also on my breadboard!

I cover mine with a small square of electrical tape. It covers the LED just enough so that the light illuminates the pins around it so I can see the status, but saves my retinas. :smiley: Eagerly awaiting the intensity patch to be merged into master.

I found a very simple (though drastic) solution. The cyan breathing LED can be switched off by defining RGB_NOTIFICATIONS_CONNECTING_ONLY in main.h. I added the following to the makefile (near line 66).

CFLAGS += -DRGB_NOTIFICATIONS_CONNECTING_ONLY

Now all other LED indications are shown, but not the breathing cyan sequence. I would have preferred showing the breathing cyan a few times then switching it off rather than having it on or off all the time. I’m also wondering if by switching the LED off I’m saving a bit of power. I can test that unscientifically using the battery shield

1 Like

Since my change has now been merged on the compile server branch, you can set the brightness of the LED using the RGB instance. The value is 0-255, where 0 is off and 255 is full brightness. Its best to keep the brightness in the range of 10-100.

void setup() {
    RGB.brightness(20);
}

There is also a RGB color and brightness demo on my github here: https://github.com/mattande/core-firmware/commit/9d90a9147a73253035355edf666fe679e490fd3f

3 Likes

I am interested in dimming the led to reduce current draw. Any idea how much it draws normally. I don’t understand how to use the modifications you guys made. Is this a modified firmware? What am I changing exactly and how do I change it?

You just need to call the RGB.led functions to get this running

1 Like

I think the largest draw is by far and away the CC3000 radio module, details on how to sleep that to save power are here: http://docs.spark.io/#/firmware/sleep-spark-sleep

Thanks!
David