Reversible Constant Current Source (CCS)

I need a current source, that can work in both directions. To make it simple, I need to generate a square signal in current. I am currently using a simple H-bridge, but without any current regulation. All the current regulators that I found don't work for both negative and positive parts.

voltage range: up to 30 - 40 V

current range: few mA

period range: few ms

Do I need to use diodes and use separate regulators for the negative and positive part of the signal?

Can I find a H-bridge controlled by PWM that can deliver a regulated current?

Any other idea to solve this problem?

• Some very simple solutions are available for low currents (mA) but you haven't given any specification for either voltage or current. Please edit your question to add these in. – Transistor Oct 29 '17 at 19:31
• Yes, need range of output current... and voltage too! – peufeu Oct 29 '17 at 19:46
• How do you plan to set a specific current sink or source value? Use a (+) or (-) voltage value at the input? How exactly? Is one end of the load tied to ground? Or am I completely missing what you want? Do you want $\pm 20\:\textrm{V}$ compliance voltages or $\pm 40\:\textrm{V}$? It's not clear to me. – jonk Oct 30 '17 at 0:18
• @jonk If the O.P. is currently using the H-bridge, then his load isn't ground-referenced. – Nick Alexeev Oct 30 '17 at 0:22
• @NickAlexeev Thanks for the catch. That answers that part of my questions. The use of PWM though doesn't entirely, because it could be there is already an analog signal available or, alternatively of course, the PWM can be turned into an analog signal first. But it might be they directly want PWM and expect the device to average? I'm not sure. (Is there a single rail to this? Is that why the h-bridge?) – jonk Oct 30 '17 at 0:26

You're on the right track regarding the use of an H-bridge.

Put some inductor (a couple of mH) in series with your "load" and just use PWM and be fine and dandy with that, as an open loop system.

If you want to be certain that the current is what you want it to be, then use closed loop system. So get a current sensor, put in series with the inductor and the "load" and feed the output of the sensor to your µC (MicroController).

I'm 99% certain there's current sensors that can give out a value in both directions, if not then make one yourself with a differential amplifier (op-amp + resistors + shunt resistor), bias the signal with 2.5V and then convert it to digital (ADC), that way 2.5V will mean 0A, above 2.5V will mean current in some direction, less than 2.5V will mean current in other direction.

Then make an interrupt happening at regular intervals and set up a PID system in software using the sensor values as input and PWM as output.

If you want to know how to implement a PID then I can tell you that it's easy and you have youtube / wiki for that. Or just make another question.

This is what I had in mind: The diodes on the gate in parallel with 10 Ω is just to remove the ringing of the gates. I'm aware you're going to use like 40-50V, so use appropriate voltage shifter and appropriate high voltage op-amp.

I've explained pretty much everything in the image.

Here's the link in case you want to mess around.

If you're going to try this out, then keep in mind that you will definitely have to mess with the PWM (if the resistance of your load is very low, as in the simulation), because right now it's duty cycle is at $\frac{0.06}{5}=1.2\%$. Scale that up with 255 = 100% and 0 = 0%, then 1.2% translates to 3.06 = 3. That's not enough resolution, 1 will be 2 mA, 2 will be 4 mA, 3 will be 6 mA, as in the simulation. But that will depend heavily on the resistance of your load, in the simulation I used 10 Ω because whatever, but if I'd used say 100 Ω then the binary value 30 would have given me 6.3 mA as in the image. Oh well, there's always some drawbacks.

Another way to increase resolution would be to change the size of the inductor to.. say 500 mH and use a 16 bit PWM, then all your problems will most likely go away. You can probably find a couple of Henry in transformers, look in a garbage dump for the transformer in a microwave oven or something.

But with large inductances like that, it would result in long delay changes, say you want 1 mA, maybe 2 seconds later you'll get that, then you want 2 mA, 2 seconds you'll have that. I'm just speculating.

• I like the idea of the PID loop, because of it's power efficiency (no current regulator is heating with the extra voltage), and because it is very easy to set the current from the software. I will check if it is reliable, because i did not find a sensor that is accurate enough in this range of current (few mA). – Rémi Baudoux Oct 29 '17 at 21:37
• And also if the microcontroller can be fast enough to stabilize the signal i want (period of few ms). – Rémi Baudoux Oct 29 '17 at 21:55
• @Remi "And also if the microcontroller can be fast enough to stabilize the signal". You'll be using PWM I suppose, if you're using a typical Arduino or some other AVR then you can get some 16 MHz, 8 bit timer, prescaler set to 1 => the PWM period will be roughly $\frac{16×10^6}{2^8}=62.5$ kHz. Yes, 62.5 kHz. That together with your choice of inductor (greater inductance => smoother current => slower system). I can guarantee you that any µC will be fast enough. Even if it would be clocked at 1 Hz. You can even tune it for a slow system with the PID. Yes, 3 reasons why it's OK. – Harry Svensson Oct 29 '17 at 22:43
• Yes, i see what you mean, and the load could be around a kOhm, but really uncertain, that's why i need a very adaptative controller, and rather high voltages. but this is better for the resolution of the measure, I just have to dimensionize the different parts of this "home made sensor" match the needed range and resolution. – Rémi Baudoux Oct 30 '17 at 19:59

Take a full-bridge rectifier and connect some sort of DC current limiting device between its + and - terminals. Then you have an AC current limiter. (The current between the two AC terminals of the rectifier will be limited in either direction) simulate this circuit – Schematic created using CircuitLab

• Good idea. You forgot to include the load in your schematic. Change the source to square too as that's what the OP is asking for. – Transistor Oct 29 '17 at 19:24
• Clever idea, I will use it for a first breadboard prototyping with a lm317 to limit the current of course the feedback loop is more fancy, but will need more work I will see that later. – Rémi Baudoux Oct 29 '17 at 21:53

Bipolar voltage-to-current converters are a reasonable application of the Howland current pump. You should read this application note, from whence the above image came, but the above should give you an idea. The output current is (ideally) just Vin/R13. Also this article from Analog Dialog.

The output impedance is highly dependent on the matching of the resistors. I would suggest starting with 0.1% resistors.

The value of R13 has to be high enough to drop enough voltage at your operating current that there isn't too much error in the output. Obviously you lose compliance voltage in the op-amp and in R12 so it's best to start with a supply voltage that is perhaps 5V higher than your maximum output voltage.

You can play with this simulation, which works well: simulate this circuit – Schematic created using CircuitLab • I'd like to second the Howland current source idea. The O.P. had added that his voltage range is on the order of 40V. The OpAmp that can work with such voltages do exist. – Nick Alexeev Oct 30 '17 at 0:20