Home Up Legal Union

Dimmers Page 4
Dimmers Page 2 Dimmers Page 3 Dimmers Page 4 Dimmer Projects

 

Dimmers are not without problems - Continued!

As mentioned in Dimmers Page 3, the standard dimmer does not give a linear increase in light value due to the power curve of a sin wave.  After developing the inverse table in Excel, I loaded it into a PIC 16F877 microprocessor and gave it a try.  I was using a light probe attached to an Apple MAC IC 475 computer and a ULI Interface (all from the mid 1990's).  When the graph of my expected linear light curve showed up on the display it was horrible.  No modifications at all gave a better curve than the mess I had generated!  I received permission from my Principal to bring the MAC home for a weekend and ended up spending about 12 hours working on the curve.  The light source was a string of 100 clear Christmas lights.  Below is the final result.

All values were scaled to 0-255 (8 bit value) in both axis. 

Each half cycle of a 60Hz wave is divided into 32.5us - this gives 256 divisions in each half cycle.  A table was setup in the 16F877 PIC microprocessor with a data value for each of the 256 steps.  After a zero crossing, for every 32.5us interrupt, a counter was incremented by 1.  After being incremented, the table was read to obtain the value for that count of 32.5us.  This data was subtracted from the desired value.  If the answer was 0 or negative then the triac was turned on.

The dark blue straight line is the ideal output. 

The magenta line labeled "L-Scaled" was for the table being 1:1 - that is it went from 0 to 255 in one step increment values.

The yellow line labeled "H26A_Scaled" is the output using the last version of my light curve data table.  Not perfect, but better than no changes at all.

Note that the beginning of the H26A_Scaled line has the exponential curve of the sin wave.  There is not enough power in the sin wave at the beginning of the cycle to bring the light up to the desired brightness.  At the end of the same wave, the light value becomes squiggly.  This  again is due to the nature of the sin wave.  There is too little change in the value of the wave to force a linear output.

Low end linearity is typically accomplished in commercial analog input (0-10vdc) dimmers by providing a voltage which is always present on the controlled source.  Thus the smallest amount of input voltage will bring the light up to a visible value.  Likewise, a high end trimmer allows these dimmers to not "flatten out" when they reach maximum input value.  To do this in a digital dimmer, you would have to likewise settle on a value that almost turns on the light.  Assuming an 8 bit input, the 256 steps would have to be scaled between the remaining values available after raising the zero level to just before the light comes on.  At this point I do not have any plans to pursue this  goal.  I feel it may actually be out of the reach of the 16F87x microprocessor with the other functions I am asking it to do.

You can view the table used to create the above H26A_Scaled graph here.  This is part of the code for an 16F87x microprocessor that I am using in several projects.  How to use the table is explained in the text file.  Mnemonics are standard MicroChip, except perhaps the code that reads the high & low byte of the S_Curve_Start address to modify PCLATH - the syntax shown is for using the TechTools PIC assembler CVASM16 V.5.8

 

 


Please address general comments to web@dv-fansler.com

This page was last modified: 01/22/14
This Document is Copyright © 1998-2014 by David V. Fansler  All rights reserved.
Legal Notice