# adjustable constant current waveform generator

I’d like to generate a biphasic square wave with a constant current between 80mA and 120mA that can be adjusted in steps of about 5mA or less. 1ms pulses are delivered at a frequency of 30 Hz. Each 1ms pulse is filled with a carrier frequency of 10 kHz. There’s an image attached.

The square wave is both positive and negative (biphasic)
There js a pulse 30 times per second (30Hz)
Each pulse lasts for 1ms
During that 1ms the square wave oscillates at 10kHz, with the amplitude being the set current (80 - 120mA)
Resistance can change over time

I’m not sure yet where the voltage limit will be, but as the resistance changes the voltage should also in order to keep the current at the set value

Where would be a good place to start and which arduino board can send those kinds of frequencies? Would it have to be the arduino due? I’m also open to using arduino compatible boards like a teensy or something else

I'd like to generate a biphasic square wave with a constant current between 80mA and 120mA that can be adjusted in steps of about 5mA or less. 1ms pulses are delivered at a frequency of 30 Hz. Each 1ms pulse is filled with a carrier frequency of 10 kHz. There's an image attached.

The square wave is both positive and negative (biphasic)
There js a pulse 30 times per second (30Hz)
Each pulse lasts for 1ms
During that 1ms the square wave oscillates at 10kHz, with the amplitude being the set current (80 - 120mA)
Resistance can change over time

I'm not sure yet where the voltage limit will be, but as the resistance changes the voltage should also in order to keep the current at the set value

Where would be a good place to start and which arduino board can send those kinds of frequencies? Would it have to be the arduino due? I'm also open to using arduino compatible boards like a teensy or something else

Please help my confusion. Do you want the voltage to be a square wave or the current? In both cases, you cannot have a constant current, by definition. If the current is biphase, then it must change directions, from + to - and back again. That is not constant.

What is the load that draws the constant current you specify. Is the load changing, also?

Paul

Hi,
OPs Image;

Tom...

You should have little trouble creating the timing as described.

You will have to feed the output from the Arduino to something like a comparator cct. to get a bipolar signal.

The constant current part will have to be a separate cct. too.

Yes, I see how that wording is confusing. This is from several research papers I've read on electrical muscle and nerve stimulation. Each use case is a bit different so I just picked the most descriptive one I could find. The current flows between two electrodes placed on a person's body and as the electrodes wear or as the skin becomes dry the resistance between the two electrodes can increase.

The current is the square wave and the amplitude should change between +120mA and -120mA, even if the resistance increases due to worn out electrodes or something else. I'm not sure what the load would be in this scenario.

Thanks for posting the image. I keep forgetting I can post it in-line instead of as an attachment.

Are there any specific op-amps or circuits I should be looking at or that you have in mind? I'll start looking and see if I can find some circuits with some of these new keywords

I see a serious problem in getting the right loads for testing your analog circuitry. Would you like to apply a circuit to yourself that sends 120mA through your body? As a voltage estimate, check the current through your body from a 5V or 12V DC source, then scale up to 120mA.

One current source could be a solenoid that is continuously fed with the desired current. Depending on the resistance of the solenoid the continuous voltage can be very low. When the current source is turned off, the current finds its way through the electrodes attached to the solenoid.

This is from several research papers I've read on electrical muscle and nerve stimulation.

The big problem is that the people writing the papers are not electronic engineers and I have seen many papers that do not accurately describe what they actually use.

The actual pulse profile is easy enough to generate and turning this into a bidirectional signal is simply a matter of AC coupling, that is connecting it through a capacitor.

However it is the constant current bit that is difficult. A normal constant current circuit works with feedback to establish an equilibrium by adjusting the voltage. This can’t happen with pulses because by definition a lot of the time there is no applied voltage and so any feedback has the effect of winding the voltage up to full. Then when a pulse is applied too much current flows and the voltage is wound down but not before that too much current has already flowed through the tissue.

You see the basic problem?

I spent too much time in the last year working with switchmode power supplies in a current-limiting mode.

The typical switchmode controller is extremely good at controlling current in fast pulses. It is quite scary how the controller is able to monitor and adjust while inside a single 20-thousandth of a second.

I am sure that a switchmode controller could be persuaded to do what you want to do but geting it to conform to your wishes will take an experienced engineer and a good set of test equipment. It is not a hobby project except for the most advanced hobbyists.

For larryd’s suggestion, a current comparator circuit seems straightforward enough and should give me the ability to switch from +120mA to -120mA. I’ve looked around at some constant current circuits too. It seems like I should be able to feed a constant +/-120mA to the current comparator and have it do the switching. I would also need a switch to turn off the current for that bit of time between the 1ms pulses. So basically three different parts all controlled by the arduino.

For DrDiettrich, I have an electrical muscle stimulation (EMS, very similar to a TENS unit) machine which is partly what sparked my interest. It uses a constant voltage waveform. I could set it to produce a constant signal and then check the voltage, current and even the waveform using my multimeter and oscilloscope.

Grumpy_Mike, from what I looked at I can use a constant current circuit before the current comparator. The constant current circuit can be set to hold at 120mA listening to feedback and then the comparator will do the actual pulsing. Does that sound plausible?

MorganS, I took a stroll through the wikipedia and I understand the basic concept but I think you’re right about it being too complicated without having an engineer to tweak it. Also most of the applications were for voltage, like in a computer PSU so I’m not sure which commercial applications I could potentially scavenge from if I did decide to go that direction.

I found a neat open source project called pulse pal that can generate a variety of waveforms using an arduino due. The waveforms control voltage so while the hardware may not be too relevant I think the open source code would be. I also stumbled across this in the switch mode power supply wiki: “When equipment is human-accessible, voltage and power limits of <=42.4 V peak/60 V DV and 250 VA apply for safety certification.” So now we have a voltage limit for safety