The SSR will only switch while the AC wave is at the zero crossing, thus limiting the minimum switching time to approximately 8.3 ms. For stability I would like to set a minimum of 20 ms switching time.
I would also like to set the power level between 0% and 100% in 1% increments. My current solution is using the formula "%Power X 20 = timeOn / 2000 - timeOn = timeOff"
Although this works, unfortunately it results in longer than necessary on/off durations in order to get the intended duty cycle.
Eg. A 50% power level would be 1000ms On / 1000ms Off. This would not be as efficient and harder on the element as it would be to get 50% power by having the element 20ms On / 20ms Off.
Hopefully I have explained my problem in such a way that makes sense. What I believe I need to do is factor the larger fractions created by multiplying the the percentage, down to as small as possible with a "numerator On" or "denominator Off" value of no less than 20ms.
Any thoughts or advice or articles/tutorials covering this subject would be appreciated.
Thanks
It's not a super elegant algorithmic solution but will do everything I need for now, and the array is relatively small at 200 indices.