Digistump Forums

The Digispark => Digispark Project Ideas => Topic started by: jdmlouis on February 21, 2013, 07:25:14 am

Title: Temperature-controlled RGB LED light (for PC case)
Post by: jdmlouis on February 21, 2013, 07:25:14 am
I'm building a new PC soon, and I had the idea one evening to use one of my three Digisparks to act as the brains behind a device that would use an analog thermometer (TMP36 (https://www.adafruit.com/products/165)) and a diffused RGB LED to provide in-case lighting (visible through the case's window) that changed colour depending on temperature.  I'd also want either an on-off switch for it or some way for it to detect whether the computer is on - maybe a motion sensor placed near a fan would do the trick.  I'd power it via USB.


The end-result would be simple: the case would glow red-hot if the temperature were high, and would glow blue if it were cool.


Thoughts?  Hints?  Advice?
Title: Re: Temperature-controlled RGB LED light (for PC case)
Post by: ephphatha on February 25, 2013, 11:49:25 pm
Should be pretty easy :). If you're using a USB port in the computer itself to power the digispark and it's not a standby usb port (it most likely wont be) then your digispark will shut down when the computer goes into standby or shutdown.


You will need to make sure the RGB led uses PWM pins for the red and blue LEDs. The RGB shield connects red to P0 and green to P1 (blue gets a non-PWM pin P2) so that would require modification to use (either cutting traces or insulating and twisting the green and blue leads at the base of the LED so they go through the necessary holes on the PCB).


If you then use P5 to read the thermometer voltage you will have the USB pins free to also use USB communication if you'd like.
Title: Re: Temperature-controlled RGB LED light (for PC case)
Post by: digistump on February 26, 2013, 12:10:20 pm
You could also use the stock RGB shield with blue on non-pwm P2 and use the softPWM as demonstrated in the DigiBlink example
Title: Re: Temperature-controlled RGB LED light (for PC case)
Post by: jdmlouis on August 28, 2013, 10:08:54 am
It's been a while - still haven't done it, but am getting back into thinking about it.


I was thinking a bit, and I cleared up my 'mission statement' for this.


I want to:
So, to this end, I've decided I'd use the breakout shield as follows:

Before I go off half-cocked with a hot soldering iron, I just wanted to solicit a sanity check to make sure this is likely to work as intended. 


I also would really appreciate any advice on an algorithm or logic to properly scale the TMP36 reading to the PWM values so I can gradually fade from one 'temperature' colour to the next, and proportionally to the heat level.  I went to school for law, not math or computer science (though I wanted to), so be gentle and accept my apologies in advance for my ignorance.


Thanks a lot, folks!