RGB driver with microcontroller.

I would like to send a RGB LED strip with four potentiometers:
3 potentiometers for the colors red, green, blue.
With the fourth potentiometer I want to adjust the brightness.
Now, most microcontrollers have 4 A/D inputs,
but I would also have 3 ports with a PWM output for the colors.
Can anyone give me some advice which microcontroller (type)
I can use?
Where can I find some examples like this?
I don't want to buy a driver but maked it by myself
Reply to
Loading thread data ...
IIRC Elektor magazine has in the past published uC controlled RGB projects.
Reply to
Ian Field
Pretty much any microcontroller could be programmed to do this task - the solution would be to do the PWM in software, rather than using the on-chip PWM hardware (which, as you noticed, may not exist).
The easiest way I find to do this is by running the PWM in the main loop. The frequency may vary somewhat as other events happen, but on average this will provide adequately fast PWM for visible LED color applications. As an example:
/* Physical outputs to LEDs (syntax is processor/compiler dependent) */ sbit RedLed P1^1; sbit GrnLed P1^2; sbit BluLed P1^3;
void main(void) { unsigned char Red, Grn, Blu, Pwm;
while(TRUE) { /* Do something to acquire values for Red, Grn, and Blu (0..255) */ Red = GetPotentiometer(1); Grn = GetPotentiometer(2); Blu = GetPotentiometer(3);
/* Do PWM processing */ Pwm += 1; /* wraps back to 0 after 255 */ RedLed = (Pwm > Red) ? FALSE : TRUE; GrnLed = (Pwm > Grn) ? FALSE : TRUE; BluLed = (Pwm > Blu) ? FALSE : TRUE;
} // End of main loop }
Note that this method can have a problem. If something happens in the main loop (such as processing a received command) that takes significant processor time (even a few milliseconds), there will be a noticeable perturbation in the brightness of the LEDs. The most reliable way around this is to place the PWM logic in a timer service routine, rather than in the main loop.
The downside of using the timer method is that the timer must trigger fairly rapidly in order to keep the PWM frequency high enough to prevent visible strobing of the LEDs (10 kHz or so), and the additional overhead required by the interrupt service may use up too many processor cycles. This can be mitigated by decreasing the resolution of the PWM from 1/256 to, perhaps, 1/16 (0..0x0F). This reduces the number of distinct colors available, but in many cases (most, in my experience) still provides adequate color rendition. -- Mark Moulding
Reply to
Mark Moulding
if you are controlling all 3 colours then a global brightness control is an unnecessary complication (and probably wont work as expected)
something like an attiny24/44/84 should suffice for both pwm & analog inputs
Never trust an operating system you don't have sources for. ;-) 
	-- Unknown source
Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.