My version of mood lamp project described at
http://tobe.nimio.info/led_mood_lamp.php


The following problems have been fixed:

1. Bright flashes / brief darkness in Random mode. 

This is because the jpwm3 routine needs all 3 pwm values to be different. The "quick and dirty" fix of adding an offset to one of a pair of identical values can sometimes make the new value match the third byte. The new jpwm3 routine exits if any value is duplicated. This then requires that the calling routine does not send identical bytes for long periods. So I made changes to the main program to ensure that identical values are not produced for more than a few consecutive calls. 


2. EEPROM routines did not always work, colour not saved in Pause. 

I replaced the library routines with local code in the main program. Now seems to work okay (different random sequence with each power-up, colour remembered after Pause).


3. Lamp would flicker for high values of fadespeed.

I recoded the fade procedure to eliminate the fadespeed loop as it was taking a long time to complete for larger values of fadespeed (lamp is off during this time). It now completes in one pass regardless of fadespeed value.


Also, I have tweeked with the fadespeed value to get nice (in my opinion) Flash and Transition modes, using Kade's 6DIP scheme.

Finally, I have updated the schematic with more appropriate resistor values to supply the transistors and LED's safely and added supply decoupling which is very important for designs such as this where high current pulses are present.


Disclaimer:
This material is offered "as is" with no warranty expressed or implied regarding merchantability or fitness for purpose. The author accepts no liability for any costs or injury incurred while using these designs.


Steve Rougier - 24 June 2009