Wagner Lipnharski wrote: >The following circuit using an op-amp or comparator would control >current (500mA) upon a 5V square wave. The resistor divider 10k/560 >actually generates 265mV, but your PIC or oscillator will also not >generate exactly 5V. Increasing the 560 Ohms resistor value would >increase the average current over the LOAD. The square wave is necessary >to create a non-linear current regulation. > >Again, costs still below $12. Wagner - Nice circuit. But why use a square wave? The way I see it, the op-amp with lagging feedback created by the R-C will create the PWM for you. I'd just apply 5V to turn it on, 0V to turn it off. Plus I'd apply a little bias at the inverting (-) input of the op-amp to make sure that it is really off when you turn it off. And I'd say the cost is around $1.50, not merely "below $12". One problem is that it doesn't measure the average solenoid current. It averages solenoid current when the FET is on with zero when the FET is off. That makes it regulate poorly if the supply voltage or load changes, but maybe that's not an issue. I have seen a circuit very similar to this that was used by a large automotive manufacturer. Unfortunately, they left the R-C out, and the PWM frequency was limited only by the parasitic R, L and C, and the speed of the op-amp. It worked, but I thought it was a terrible design. Don