PDA

View Full Version : Oh Dear. My head is spinning. HPWM RGB LEDs What to choose?



jimseng
- 18th March 2012, 17:52
I know this has been covered in lots of posts in various ways but I am swamped in confusion as to how to do my RGB Led dimming. I have a pic16f628 and looked at sPWM and it is all fine but at the same time I want to do some IR stuff to control the colours and perhaps some analogue input. Nobody's life depends on it, it it is just for fun but I can't work out what road to go down. PIC16f628s are in my cupboard, and sit nicely in my programmer with LEDs to test but obviously sPWM falls over as soon as I want to sit there waiting for an IR input.
There is this: http://www.picbasic.co.uk/forum/showthread.php?t=10564 Thread: MIBAM - (Mirror Imaged Bit Angle Modulation) (http://www.picbasic.co.uk/forum/showthread.php?t=10564).
Looks interesting. Can this do it in the background?
Or HPWM? I think that means moving to a 28 pin PIC which is a bit large for such a simple task. On this front there seems to be two hardware options CCP or some PICs seem to have dedicated pwm pins. Which is the simpler to use for a novice who struggles to understand Microchip datasheets. I have my mosfets sitting eagerly waiting for pwm, I just am confused as to what road to set off on.

I'll start my infra-red confusion in another thread when it comes to it!

Any pointers and ideas would be appreciated.

Demon
- 18th March 2012, 18:18
About MIBAM:


This module takes over the Interrupts on the PIC because the timing of the waveforms must be exact.
With 16F's, You can NOT use any other interrupts, this includes ON INTERRUPT.

So you won't be able to have things running in background. Maybe with 2 PIC 16F628 working separate functions?

Robert

BH_epuk
- 18th March 2012, 18:41
It's a bit overkill but a PIC18F24K22 does RGB led's with no hassle, using 3 of the CCP modules.
And in the UK its only £1.98, 4pence more than a 16F628. I have an example that i can post if you want it.

jimseng
- 18th March 2012, 19:35
Demon: Yes I had thought of that although perhaps I should have been a little less hasty. I probably don't mean background, I realize that I can simply put the mibam routine in the appropriate place (i.e. the waiting for an IR input loop) and take advantage of it's low cpu use. But I suspect that in the end a hardware approach is the best and so BH, I think I will go for those. I would love to see your example. It leaves opportunities for expansion. After all, we are all waiting for our Raspis are we not?

Mike, K8LH
- 18th March 2012, 22:39
May I ask how many RGB LEDs you're using? I've done Sony SIRC control of a single RGB LED with 6-bit (64 step) gamma corrected brightness levels spanning 8-bit (256 step) soft' PWM levels, but I used small tight isochronous assembly code.

jimseng
- 19th March 2012, 12:21
I'm only after 3 channels of control for the moment. I want to add IR control and maybe some potentiometers but no doubt I will want to hook it up to some sort of serial connection at some point.

Heckler
- 19th March 2012, 14:18
Go get you one of thes...
http://www.ebay.com/itm/IR-Remote-Control-Controller-for-5050-SMD-RGB-LED-Strip-/280656787319?pt=LH_DefaultDomain_0&hash=item415872b777
or even better get one of the packages that include 5 meters of 5050 RGB LED's in a strip. Amazing and fun to play with.

I just got a kit with 5M LED strip or around $20usd to add lighting to my daughters doll house. I plan on doing my own controller eventually.

The remote allows you to select any range of colors and brightness of the RGB led strip.
I popped the controller open and it looks to have a Vreg, small microcontroller, 3 driver transistors (or FET's), an IR sensor. One could trace out the schematic, burn your own PIC and replace the one on the board to get control of the code and not have to do your own circuit board.

You could also monitor the three RGB channels and see what PWM signals give which colors.

just a thought

jimseng
- 19th March 2012, 17:03
Heckler
Ha! That is exactly what I have got. (well a slightly different but very similar UK version) I was planning to use the fets to drive the LEDs and steal the 5v rail etc. That is why I was trying to get it to work on a smaller pic than the 28 pin but I think there is room in the box for a 28 pin if I am neat and tidy. I opened mine up and removed the MCU which I promptly lost between the floorboards but I was intending to do my own prog so I can use potentiometers. Unfortunately I think I am going to have to go with a 28 pin with HWPWM to achieve it all though. No doubt I will blow it up at some point.