Go Down

Topic: creating a controllable tens machine (Read 38117 times) previous topic - next topic


I found this schematic on how to construct a TENS machine.

I would like to create a TENS machine but use the arduino to control the output. Instead of using integrated circuit to control the frequency and pulse width, I want to use an arduino. Rather than having a constantly pulsing output, I want to be able to program patterns on the fly. For example, a constant current for 1 second, then a 2 second pause, then a constant 2 second current, then a 10hz pulse with 100 microsecond pulse width for 5 seconds.....etc

From reading the schematic, the voltage can be stepped up using this schematic (although it was not used for the final implementation)

Would it be feasible to create this step up converter and control it using the arduino?


Current is constant. It is voltage that is controlled in a TENS unit. Technically, the current will vary by frequency (the higher the frequency, the lower the resistance of the skin = more current.)

In a TENS unit there are 4 controllable parameters. They are the frequency, the pulse width, voltage, and duration. Of course, you could also experiment with different waveforms, but normally a TENS unit just uses square waves.

Using the Arduino to control this you would use PWM for the frequency and pulse width portions. Since the body is essentially a low pass filter, different PWMs will effectively deliver different voltages.

A TENS unit usually has a step-up converter as you noted which normally operates in the 40-80V range. Some are adjustable down to 10V. But you really shouldn't need to directly change the voltage. For safety reasons, the current is limited at the output so it cannot go high enough to cause injury or death.

At the point of output, you apply your stepped up voltage to a push-pull FET driver and apply your modulated control waveform to the gate of the FETS. This will pulse the 40V to 80Vs into the body.

Now, many people call the whole field of these TENS units, but there are actually several different types of electro-stimulation devices. Each has specific purposes (a TENS unit will not cause muscular contractions, for example) which require different waveforms, different voltages, etc...

A TENS unit is designed for pain control. That is all it is good for. What is your goal?


In summary, the step-up convert is not what you want to control with the Arduino. You want your Arduino to take the place of the Switching Oscillator and the intermittent control of that circuit you linked to.


Hi Retroplayer,

Thank you for taking the time to help me.

I am a medical doctor and I also have a chronic pain issue. I have been using a TENS machine for a few years. I have found that I get a good response from low intensity(voltage), small pulse width output.

It may sound strange, but my pain is not constant and I can get waves of dull pain. The various machines I have used all have patterns of various different types (crescendo decrescendo, slowly increasing etc...)

I want to program my own patterns.

Thank you for your help. If I have understood you correctly, I will need to build a step up converter and then use the arduino to control it via the current at the base of the transistor Q1 in the diagram that I included.

Would you happen to have any links to help me out regarding the step up converter?


I modified the schematic to show you all the parts that would remain. Your Arduino would connect to the Q1 and Q2 inputs. Turning on Q1 will allow the 80V to pass to the electrodes and turning on Q2 would short the electrodes to ground. Never turn them both on at the same time! This is a totem-pole configuration. Turning them both on at the same time would short the 80V directly to ground, and blow things up.

So you would apply your PWM signal output from the Arduino to the Q1 input, and the inverse of your PWM to Q2. This will modulate and shape your 80V waveform.

Everything else is controlled by your code by altering the frequency, pulse-width, and turning the PWM on and off for your patterns and durations.

You could also build a step-up converter from modern and more efficient components (recommended). Check out the SwitcherPro tool at https://focus.ti.com/docs/toolsw/folders/print/switcherpro.html?DCMP=hpa_tools&HQS=Tools+OT+switcherpro

Maxim has a similar tool to design a switching power supply.

I am hesitant to design and post a schematic and code because of liability. But there are enough hints there to get you going.


Thats fantastic Retroplayer. Thank you so much! I completely understand the liability issue.

I will look into everything over the next few days. I will create a schematic here in case it helps anyone else and hopefully get some feedback.

Thank you kindly,



You're welcome.

This is something I have looked at off and on over the years as a one-day project. I don't suffer from chronic pain, so there hasn't been an immediate need to build one. Just an interest in experimenting (more with muscle building, range-of-motion, and CES applications.)


Apr 04, 2013, 10:17 pm Last Edit: Apr 04, 2013, 10:26 pm by Erdin Reason: 1
It is also possible to use the Arduino to create the 80V with pwm and a step-up circuit. With a voltage divider the Arduino can measure the voltage to create a steady 80V.

Since you have a few of those devices, can you use the electronics of one of them for safety ? If you build something yourself, you might accidently generate a few hundreds volts.

What kind of pads do you use ?

Do you also have the trouble that the pattern is never just right ? And a random pattern is very annoying.

Would it be possible to generate the pattern on the fly ? For example with a knock sensor.



I have been looking into the more modern alternatives and came across the MC34063A ( http://www.ti.com/product/mc34063a )

I also have come across this link that provides a design tool for using it:

From what I gather, the following inputs would be used (for the design tool)

Vin 5v
Vout 40v
Iout 30mA

Would that be a suitable replacement? Any further hints would be appreciated. I have the programming side sorted (have experience with python) but its the hardware side thats holding me back.

Kind regards,



Apr 08, 2013, 10:38 pm Last Edit: Apr 08, 2013, 10:56 pm by Retroplayer Reason: 1
You must have missed my link to the switcherpro tool? It will actually design and build a circuit for you even including the board artwork and bill of materials.

Micrel, Maxim, Analog Devices and many others also create them, but TI has the best tool for helping to design them.


Hi Retroplayer,

Thanks again for the help - I did miss it.

I just tried to use it and when I enter 5v to 40v it tells me to change to valid inputs. Does it only support step down conversion? I couldnt find anything in the help section.


I'll have to play with it again. When I posted the link, I had played with it then and got it to work for what is needed here but I don't remember all the settings I had chosen.


I investigated Arduino-controlled TENS last year. After some internet research I determined that it needs short (less than 1ms) pulses of constant current, up to about 30mA @ up to about 100V. The pulses are supposed to be alternating polarity to prevent electrolysis. In a multi-channel TENS unit, all the channels should be isolated from each other, since you don't want current flowing between different pairs of electrodes.

I came to the conclusion that the easiest solution was to use a transformer for each pair of electrodes (thereby providing both isolation and voltage step-up), and to feed the primary of the transformer with a constant-current pulse (alternating the polarity) from an H-bridge. It so happens that constant-current H-bridge chips are produced for controlling the shutters of digital cameras, and these chips can switch up to 500mA. If the H-bridge is powered from a 9V battery (which is what almost all the commercial TENS units recommended by the UK NHS appear to use as the power source), up to about 7V can be put across the transformer primary. A transformer with a turns ratio of about 12:1 will then allow the required voltage and current to be generated.

I knocked up a prototype, using 5 mosfets to switch in different current setting resistors (giving 31 intensity levels). For the transformer, I tried using small mains transformers in reverse (which turned out to have too much resistance), designed a home-wound ferrite-cored transformer (which I never got round to winding), and ended up using an audio transformer that did the job well (although it was heavier than ideal for a wearable unit).

If you are interested, drop me a PM and I'll search for the schematic.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.


Apr 11, 2013, 05:45 am Last Edit: Apr 11, 2013, 05:47 am by sonnyyu Reason: 1
After some internet research I determined that it needs short (less than 1ms) pulses of constant current, up to about 30mA @ up to about 100V.

What is the duration time?

designed a home-wound ferrite-cored transformer (which I never got round to winding)

Can I use this one Newark #67R8826 as ferrite-cored as sample to order custom made transformer?

Newark ferrite-cored

I have no clue which one is good. but that one cost most.

Here is the sample image of custom made transformer.


If you are interested, drop me a PM and I'll search for the schematic.

I drop you a PM.

What kind of pads do you use ?

"Square Series" 8 PACKS of 4 (32 Total) Square Series 1.5 Inch x 1.5 Inch Premium Electrode Pads (4 per pack) (20-30 Uses)

32 Premium Electrode Pads $31.99

Go Up