Op-Amp as Voltage Controlled Current Sink

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
I am working on building a lightning emulator to be used in development of an AS3935-based lightning detector. Here is the schematic of the AMS emulator (pdf attached). Sourec is the AMS AS3935 application note.

That device uses an AS1504 (obsolete) as a DAC and an AS1101 (LED driver) as a voltage controlled current sink. Draft1.pdf is a simulation using a current sink limited to 12 mA. The oscillation follows nicely the profile for the current sink, which is in red.

Both 16F and 24F PIC's come with built in 8-bit DAC's and op-amps. Unfortunately, I am quite ignorant of using op-amps as current regulators. There are several documents on using op-amps in that way, including a TI document ( sboa046 ) which includes this design:
upload_2016-8-26_9-40-11.png

I would use an appropriate resistor to give the give the control current. I have not tried to simulate it and wanted first to get opinions on that approach rather than using a separate chip, such as the AS1101.

Any comments, suggestions, or good links for providing that functionality using the built-in op-amps the PIC devices have? The AS1101 is only $1.16, so the issue is not really one of cost, but rather the simplicity of using just one chip.

Regards, John

Comment to moderators: I have a separate thread in Projects that also deals with this lightning detector, but I would like to keep that thread focused on the waveforms needed for emulation, rather than a sub-component of how to get them.
 

Attachments

OBW0549

Joined Mar 2, 2015
3,566
Both 16F and 24F PIC's come with built in 8-bit DAC's and op-amps. Unfortunately, I am quite ignorant of using op-amps as current regulators.
They work well, and the basic circuit is just like the one you posted; I've used it many times.

Any comments, suggestions, or good links for providing that functionality using the built-in op-amps the PIC devices have?
I'm not familiar with the characteristics for the PIC's built-in opamps, but I should think they would work just fine provided their input common-mode range includes the output range of your DAC, and provided that the opamps' output voltage range is sufficient to drive the series pass element (whether MOSFET, Darlington or ordinary BJT) over the range you need it to go.

If those requirements are satisfied, I can't see any problem.
 

#12

Joined Nov 30, 2010
18,224
I'm having difficulty understanding your question but I can tell you that drawing called Fig.17 is dead obvious to an analog designer. By, "dead obvious" I mean simple, accurate, reliable. The main pitfalls are about providing enough voltage supply for the op-amp to stay within its operating range for inputs and outputs...and the fact that it only works for current in one direction.

Then again, OBWO got here first and said the same thing.
 

OBW0549

Joined Mar 2, 2015
3,566
... I should think they would work just fine provided their input common-mode range includes the output range of your DAC, and provided that the opamps' output voltage range is sufficient to drive the series pass element (whether MOSFET, Darlington or ordinary BJT) over the range you need it to go.
Took a look at the specs for a PIC24FV16KM204 (chosen at random, assuming it's representative of the rest) and it looks like the internal opamps feature both rail-to-rail inputs and rail-to-rail outputs; so I expect they'd work well for what you're trying to do.
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
That's exactly the chip that was in my shopping cart before I posted! I also added the 16F1709 which has those same two capabilities.

John
 

OBW0549

Joined Mar 2, 2015
3,566
You should be good to go, then. At most, you might have to fiddle with the values of C1 and R4 to get the best transient response or (heaven forbid) keep the loop from oscillating.

The 100 μA current source and R1 can be omitted, of course; just connect your DAC output directly to the op amp (+) input.
 

#12

Joined Nov 30, 2010
18,224
Your Draft1 looks like it's oscillating at 1/2 MHz and this circuit in Fig17 has a pole at 1 MHz. Too much C1 x R4 is going to cause overshoot. Check on that aspect.
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
Actual target frequency per AMS is 500 kHz. Simulation was a little less (about 460 kHz), but I used generic components. Oscillator component values are exactly as specified by AMS. Caps are 805 ceramic NPO chips, but two different manufacturers are specified. I will, but haven't yet, dig out those datasheets. I suspect that within manufacturing tolerances and type (NPO), there is not much difference. In my business procedures were very specific, but were usually a result of what was already in the cupboard, not an evaluation of alternatives. I doubt that AMS evaluated NPO ceramic capacitor manufacturers and found that Vishay worked for the 1000 pF ones and only AVX worked for the 500 pF one. ;)

My goal this weekend, unless I get interrupted by good weather, is to get a PCB sent off to China for production. I have the oscillator portion routed similarly to what AMS did. As for the rest, I will do my original routing and make provision for using either the MCU's op-amp or the AS1101 driver. The board per se will be for a 24F chip, SOIC, as speed may be critical (don't have a clue yet of what is needed in that regard). I will also make a pin-compatible adapter board so I can use the 16F chip, if the 24F chip overwhelms me. I just can't imagine life without paging and banking.

John
 

OBW0549

Joined Mar 2, 2015
3,566
Your Draft1 looks like it's oscillating at 1/2 MHz and this circuit in Fig17 has a pole at 1 MHz. Too much C1 x R4 is going to cause overshoot. Check on that aspect.
Too much C1 * R4 will cause the circuit's response to undershoot, not overshoot. The C1-R4 combination is a common method of compensating for capacitive loads (like the MOSFET's gate, in this case) called "in-the-loop" compensation, as in this app note from Analog Devices (see Fig. 3); it's there to prevent oscillation.
 

#12

Joined Nov 30, 2010
18,224
Arrgh! You're right. I was only considering the feedback path through R4. The straight-through path of C1 will be dominant.
 
Top