I mentioned in an earlier post that I think the optos that I’m using in my solenoid driver circuit are adulterating the PWM signal by acting as a low pass filter. The first indication that there was a problem occurred during testing, when I noticed that the voltage across the solenoid did not vary linearly with the PWM duty cycle. Instead, the voltage crept up slowly for low duty cycles and then shot up rapidly as I approached the mid duty cycle range. This is what one would expect if the PWM signal had its edges smoothed out by a low pass filter. (Of course, if I had a scope, I verify this theory). I managed the problem in software by using only a narrow range of duty cycles, but even then, the non-linear relationship between the voltage over the solenoid the PWM signal has caused a lot of annoyance.
[Update: thanks to peabody for correcting my unit conversion below, but now I'm just more confused]. Over the past few days, I’ve gotten two comments on the topic from people more expert than me; one supported me and one disagreed, saying that the switching time for optos is in the tens of nano-seconds and therefore shouldn’t matter. That may be true for some optos, but I looked up the datasheet for the 4N29 optos that I’ve used, and it looks like the switching time is on the order of 150 to 300 nanoseconds, which in the context of a 1000 hz PWM signal, might make a difference for lower duty cycles. A 1000 hz PWM signal has a period of 1 ms = 1,000,000 nanoseconds. Even at a 10% duty cycle, which has an on-time of 100,000 nanoseconds, smoothing out the first 300 nanoseconds shouldn’t make a difference.
My second question is, if I wanted to get rid of the optos, how would I redesign the circuit? I see no reason that I couldn’t eliminate the opto and connect the PWM chip, which pulses a connection to ground, to the base of a PNP Darlington. What I’d like to do for my next machine is use Darlington arrays, but Darlington arrays seem to come only in the NPN flavor, which means I’d have to invert the signal from the PWM chip from active low to active high, which requires more components. Suggestions?