I'm mostly a digital guy, so building a high voltage supply for a Geiger counter has been an educational experience. For the sake of component reduction, my first version used a PWM output from the microcontroller to drive the FET on the primary of a transformer, rather than an external oscillator. I used a shunt regulator (made of MOVs or zeners) to regulate the output at 500 volts. But having the MCU capable of controlling the supply naturally led me to experiment with using it as a more intelligent controller.
But like I said, I'm a digital guy and I don't understand all of what I'm seeing. My HV output and PWM control signals look like this:
-----+ / +--___ / +------- \\ / +-+ \\ / \\ / +____+
-----+ +---------+ | | | | | | | | | | | | | | | +-----------------------+ +
Hopefully that came out right. As the primary is energized, I see the output overshoot a bit and then stay level. When the primary is shut off, it drops rapidly and then rises again, slightly overshooting and then leveling out. It continues a slow decline and then repeats at the next pulse. I wasn't expecting the drop - I was planning for the output capacitor to keep the voltage up, but I must have it configured wrong.
Anyway, I guess I don't really understand the behavior of the transformer that well. In electronics class we just fed them continuous AC and expected AC out - can anyone point me to a good explanation of their behavior with square waves like this?
Also, my next problem is getting feedback into the MCU for control. To me, the obvious approach was to use a voltage divider and send the output into an ADC port for measurement. The difficulty there is in knowing at what point to sample the voltage, relative to the PWM signal. Is there any reference available that describes how this should be done? I think I probably need to examine how it behaves on start-up, before the target voltage is reached.
Another possible approach is to use zeners or MOVs on the output to drive a BJT that kills the PWM input at the primary. I'm not exactly sure how that will behave, if it starts cutting it off in the middle of a cycle.
Fortunately a bit of overshoot in the output voltage isn't critical in this application. At least with a halogen-quenched GM tube, it should just break down and conduct any excess voltage. It'll screw up your reading but won't kill the tube. I think it'd shorten the lifespan of an organically-quenched tube, but I'm not using those so I'm not really worried.
Again, this is mostly just an educational excercise. This project offers an interesting opportunity to get right into the guts of a switching regulator, but having little background in this I'm kind of lost. Any comments or suggestions?