Pic Dimming

From DiyLightAnimation
Jump to: navigation, search

The following is a log from one night in DLA Chat when I asked RJ to explain how it works



[rrowan]Can you explain what the pic chip is doing in relationship to blinky lights?


[RJ]

Oh man that is a loaded question. Which controller they all work different

Ok what is the Pic doing does everyone want to here this or are you going to ban me?


Renard or FireGod Controller:

Let’s talk a typical Pic dimmer like a Renard or Firegod or something like that first.


The pic has port lines that typical hook to the rj45s to send signals out to the SSR's. When these lines go low (Grounded) then it turns on the opto and fires the Triac. Now triacs are kind of a pain in the rear as once the start conduction of current they will not shut off until it stops flowing. This only happens in our case at what we call Zero Cross. This is the point where in an AC power wave the voltage drops to zero prior to going the other way. So this is when our triacs turn off as when there is no voltage there can be no current. To control how much "Power" we get to the lights we either turn the Triac on all the time by having the triac be trigger continuously. Or we never trigger it and the channel is off. Or we wait some period of time after the ZC to turn it on to dim the lights. Each ZC comes at 120 Hz or 120 times a second. In the USA with 60 Hz it works out to 8.333333333... milliseconds or in other places its 50 Hz and it works out to 10 ms and 100 Hz so to control how bright are lights are we divide this and I am only going to do the us 60 Hz at this point. We divide it into 256 slices of the 8.3333 ms. This is 32.5 us or 32.5 millionth of a second. The pics job is to turn the triac on at the right time. So for 1/2 brightness I need to find ZC, This is what the ZC circuit does it creates a pulse at ZC. The pic has external interrupt pins that we use. They will stop a program and go do something everytime it is triggered by this pulse. ... Every 8.3333 ms then the processor starts counting waiting for the right time to trigger that channel. So for 1/2 bright it would wait half of 8.333. ms or 4.15. ms and then turn the triac on. This way the triac only conducts power for half of the time as when 8.333 ms goes by the ZC will come and the triac will turn off again. The ZC trigger resets the whole thing and it starts over.


Now there is a lot more going on as you need to get the data in to tell the system how bright to make the light and such but the is the basics. What I do not like about phase angle dimming. Which is the name of the method of dimming lights that I just explained is that if you can picture a sine wave, at the ends near the ZC the wave is changing voltage very fast compared to the middle where it moves sideways faster than up and down voltage being up and down and time being sideways. So if you divide a sine wave half into 256 equal segments you have equal time but not near equal change of voltage. Volts = Brightness. So for the same time change you get different amounts of brightness change in different areas of you dimming range. You also have such a fast changing voltage to time at the ends you lose your control and in phase angle dimmers you really only get about 80% of your dimming range with it not doing anything at the ends / low values and high values


Lynx:

So I created the Lynx

It does not use phase angle dimming. It does not have a ZC circuit and it has no idea where in the wave it is at any time. And it doesn't care. It uses mosfets so I can turn on and off the power anytime not just at zero cross. Then instead of working on the 120 Hz pwm update cycle we crank up the speed to many times this so instead of a half wave being broke into 256 steps it is broken into 47,000 steps but these many steps are off for a percent and on for a percent. This is where it controls the power. It works more like a switching power supply. I change the amplitude of the wave or in other words the voltage I don’t really cut it off. I do but for so short a time that with the inductance in the wires and the lights it never goes off it just averages out to an average voltage. If I turn the 47000 steps off for 100% of the time and on for 0% it is off. If I turn it on 80% and off 20% you get 80% of the voltage and your lights are 80% bright. This is the difference in it. It is the same all the way across because something neat happens I am sample 80% of the fast change but on both side so they cancel out. In the middle I am sampling the up and down sides of the middle so they cancel out. This makes it linear dimmers. I also do not make the noise from the sudden cut off and on. It cycles to fast for the current to total stop so it prevents this... That is the Lynx. The firmware is very different for it.


Freestyle:

The freestyle is just a phase angle dimmer as I explained but with one twist. This is the freestyle difference. It is cheap!

The freestyle is a phase angle dimmer. In this it is no different than the Renard or any. I do my pwm code different but it does not change how it works. With a pic dimmer like that typical the pic will use 8 data lines to control eight channels.

So for 64 channels you run 8 pic chips. Pic chips are not the cheapest things but not real bad at like $2 a piece. But if you want 128 channels you would need 16 for about $32 - $40 in pics to run it. plus everything else needed to run the board and if you are like me and want to have power and ZC on board where it is a single device then it would get expensive to do this. Then there is the complexity of it. If one pic gets the data from vixen how do the others get it? If it is DMX I can pass the DMX stream to them all but how do I tell each one what it needs. How does it know what info is for it. I would need to program them all with start addresses or do some kind of brute stripping like Phil does on the Renard. My answer was simple. Use one pic and set its start via software like the Lynx but uses a fast pic and multiplexes the 8 pins by sending the data out a data buss and latching it into latches. This make the 8 pins be come 128 pins and the latches each have 8 latches to hold the setting until the next slice of 32.5 us when I tell it again what I want it to be either On or Off. I cycle through all 128 channels every 32.5 us. Why is this better? Cost, that’s all. One $2 pic and 16 $.25 latches is cheaper and less programming. The rj45's cost almost as much as all the other parts including the power supply. The Freestyle is born.