Hello !
I have a little problem here... let me explain.
I want to extract maximum power from a small alternator, which gives
10-30V AC at 20-100 Hz depending on conditions. To do this, and get a DC voltage that doesn't vary too widely with RPM, I'll match the load to the alternator. I've got a H-bridge with the alternator at the center, a bidirectional current sense (AD8210) in the VCC rail, and PWM to adjust the voltage on the alternator. I've decided to sense the current in the Vcc rail of the H-Bridge to also permits detection of short to ground of one of the load wires. Since the internal inductance is more than 100 mH, and AC frequency between 20 and 100 Hz, PWM frequency doesn't need to ve very high.It is, in fact, similar to motor control, but instead of trying to set motor speed, it is imposed. Same circuit, different software.
The control algorithm is : compute optimal load impedance given conditions (RPM, etc), sample current avd Vcc, set voltage on alternator using PWM.
Now here is where the interesting stuff starts : the load is AC-driven, it is inductive, and I want the DC current in the load to be as small as possible, because DC current is lost power, and at high doses, might saturate the core.
So, what I want to do is sample the current twice per PWM period :
- when the H-bridge connects the alternator "+" to Vcc and "-" to ground
- when the H-bridge connects the alternator "-" to Vcc and "+" to ground
So, at each PWM period, I'll get two current samples, in opposite directions (+i and -i), each having the same offset from current sense amp and ADC. Averaging will easily give the DC offset, and inverting every other measurement gives the instantaneous current for the control system.
Now, I'd like to use an AT90PWM3 for this ; I'm not religiously attached to this chip, but I like the PSC (power stage controller) peripherals, which nicely interface to the on-chip comparators, very useful for short circuit protection. Also, I can use the other PSC's for the battery charger, etc.
But the datasheet is not very clear on the ADC synchronization... I'd like to sample the current twice in each PWM period, and it looks like the hardware only supports doing this once per period...
If any of you have experience with this chip, help is welcome !
(Or I could use another uC, provided it can do that...)
Regards, Pierre