DC to AC and back to DC

Hi everyone, its my first post and I'm teaching myself electronics. I've been learning a lot from this community, but now I've come to something I can't find the answer to :(. I'm sorry if it is a newbie question!

I am trying to get an LVDT (linear voltage displacement transducer) to work with arduino. it is basically a transformer which varies the output voltage according to the position of its movable tip (like a 5 mm range).

I Believe (correct me if wrong), in order to make work any transformer of this kind, it is necessary AC energy.

I am powering everything with an ATX power supply. The LVDT can run in voltages under 12.

My plan, in order to make the LVDT work with arduino, is to transform the voltage from DC to AC, run the transformer and then get it back to DC.

I read online that some chips like IC-555 could help me to easily do this, but I tried to understand how to wire them and I just can't understand how to!

I attach the datasheet of the LVDT which is a solartron AX\5.0\S.

Can you help me understand and do this?
Thank you so much! (Really!)

en_analogue_probe_suite.pdf (239 KB)

Normally LVDT means linear variable differential transformer--but that's just quibbling.

The data sheet you referred to says excitation is 2-20 kHz, 1-10v so you should be able to generate this with the Arduino; the 1,2,3 ma loading should not be a problem.
The output will be the same frequency as the input and variable voltage so you have a little problem in that it is ac and the analog input of the Arduino will not accept negative voltage. If I were doing it I would look into an opamp to offset the ac output so it would not go negative and also get some amplification if necessary. In the software it would then be necessary to subtract this offset. You do not say anything about your ultimate application but if you want to read displacement on either side of the balance position it gets a bit more complicated and you have to get more into a mod/demod approach.


Hi phoxx, thank you for your kind help!

I don't mind Putting a diode in it and simply deny any negative return. It would mean I would be able to read only half the range, but that's quite ok!

I was thinking about powering everything directly from the same atx power supply, and then bringing the LVDT's output to the arduino's analog pins. Is that unwise?

You mentioned using the Arduino to generate the AC signal if I understood correctly. Are you suggesting programming a signal in a digital pin or is there an easier way? My program will be quite long and I'm worried that the long loop may affect this :(.

Also, I suppose the response signal will be AC. Can the low voltage response of the LVDT then be read directly by the arduino or will I need to protect it?

Thank you again!

It would mean I would be able to read only half the range,

I don't think you understand how that transducer works. That statement is wrong.

I was thinking about powering everything directly from the same atx power supply, and then bringing the LVDT's output to the arduino's analog pins. Is that unwise?


You want to generate the excitation signal with a PWM signal. You need to speed up the PWM frequency to make it within the range of your transducer.
Then you want to put a diode and capacitor in the return before applying it to an analogue pin.

I think you can get away with using a square wave excitation, in which case the lower end of the frequency
range is suitable (2kHz) then the harmonics are all within its capabilities. Remember to AC couple the output
with a blocking capacitor.

The output phase is important, as it will switch across the zero point, and this is lost if you simply
smooth the signal to its envelope. Normally you would synchronously demodulate the output signal
(flip its polarity in time with the input waveform), then RC-smooth.


Thanks guys! I will try this path and ask again for advice if I don't manage! :slight_smile:

There is a way to change the divider used by the PWM in the chip
using low level instructions.
You can connect an interrupt to the
driving pin such that you can sample from an RC right
at the end of the cycle. ( I'm sure there is an easier way
but I'd have to look at the chip spec ).
Offset the output of the LVDT to avoid negative levels.
The RC would be something like 80-90 percent on each cycle.
It is only there to give the A/D a little more time to sample
and do the A/D.
Do note that, I believe, that fiddling with the divider also
changes the baud rates in the same ratios.
In other words, doubling the frequency of the PWM will
make a 4800Baud into a 9600Baud.

Ok, I think Step one was completed.

I got the pwm going by:

increasing the frequency in the selected pin ( Arduino Mega 2560, pin 2 ):

 TCCR3B = TCCR3B & B11111000 | B00000010;    // set timer 3 divisor to     8 for PWM frequency of  3921.16 Hz

and setting the pwm to 50%:


I test with the multimeter and I read 4.6 V AC, or if I test in DC I get 2.14.

I didn't offset the voltage, and I connected it directly to the LVDT. The inside of the LVDT follows the scheme attached.

I connected as following:
Exiting the arduino from the pwm port to red (+)
Exiting the arduino from GND to blue (-)

And I tested the following:
Connecting the multimeter set to AC, to white and green, I can read a Voltage of 0.9V to ~0V in the center to 1.1V in minimum, variable according to its position. So I guess the transformation I so much hope for is in fact happening! (which I'm so glad to see!!!)

but now, I tried quite a few different ways to connect it to arduino and read this voltage values, and it just doesn't answer at all!

I was gambling on the following scheme:

Connect Green to GND,
Connect White -> 100uF capacitor -> -diode+ -> AnalogPin.

but the response from pin is as if nothing was connected to it. I tried other setups but they don't seem to answer at all. I don't really know what happens to the flow when I connect green to GND, I understand that I'm just trying around to find the answer so I know I'm missing something crucial.

do you have any sugestions?
Thanks in advance!!

Capture_LVDT_color scheme.PNG

Green and white are not important they can be swapped.
So green to ground, white to diode anode, diode cathode to analogue input. Also capacitor from analogue input to ground. Then you will measure something.
Use a 1uF cap not a 100uF one.

He should be using balanced AC on the input.
I suspect a blocking capacitor would be enough, otherwise
the core could develop and offset.

Grumpy_Mike I tried to make that connection . Unfortunately I couldn't make it perfectly because I didn't have the right capacitors. Tomorrow I will buy them and correct. I did it with .5uF by coupling 5 .1uF in parallel. Unfortunately, it didn't work.

Dwight, I tried to learn how and to do that. I added a 100 uF and 730 Ohm in series right after the pwm pin.

It still doesn't work :(. I use analogRead and it feeds back always 1023, no matter the position of the LVDT.

I attach a scheme of my circuit at the moment, and some voltage measurements I made with the multimeter.

I keep on trying a lot of variations, but I'm not getting the right one hehe.

Thank you guys again!

Unfortunately I couldn't make it perfectly because I didn't have the right capacitors.

Don't worry the capacitors are not vital.

did it with .5uF by coupling 5 .1uF in parallel.

I don't understand that. Capacitors in parallel add up so a 100uF in parallel with a 0.47uF gives you 100.47uF.

Unfortunately, it didn't work.

Now this is electronics you have to be very precise about what you actually saw and what you were expecting to see. I had a thread only last week where someone kept saying "it doesn't work" only to find out that it was working perfectly and it was his expectations of what "working" meant that was at fault. So what readings did you see and did they change, and what software did you use.

The analog input on the Arduino is a very high impedance.
In parallel with the filter capacitor you should put a 10K resistor.
You will not be able to measure half of your scale.
As mentioned, you have no way of measuring negative levels.
You can place a voltage divider ton the grounded end of the
sense coil to offset the level so that the Aduino only sees
positive levels ( If doing this, the resistor should go to this junction
rather than across the capacitor to ground ).
You might use a potentiometer instead of a fixed resistor with the
wiper to the analog input.
With no drive, and the resistor offset, you should read a value around
Start with the pot at minimum ( still 512 ) and increase it.

Hello Again!

Sorry for the late reply. Flu season got me and couldn't take this task further until now.

Grumpy_Mike: I added the 5 capacitors in parallel (each of .1 uF), which I believe would add up to .5 uF.
I am reading the results either with the serial monitor from arduino or with a small Processing program I made to show some graphs. I understand what you said about expectations, and I agree. I'm sorry if I may say its not working and its just an error in my logic. I try to keep perspective but sometimes knowledge fails me.
What I'm trying to do is to read the variations with a good resolution. I attach a graph of my readings in a scale of 1-1024, my aim is for this range to represent the variation of -5mm\5mm in the LVDT (which in reality, due to a spring in the LVDT is 0\10 mm). In an Ideal world, to divide the 10 mm for the whole 1024 resolution (although I know it won't happen hehe).

Dwight: I added the 10k Resistor, and the results did start to come up. Unexpectedly though, they already came with the offset I would be looking for! I attach the updated circuitry as well as graphic results for pushing the LVDT in full range a few times and corresponding readings between 0 to 1024.
In order to test, I also added the potentiometer and tested it around. I was able to make the center line of the graph vary in position, so it is working as predicted I believe.

thank you a lot for your help!

I did it with .5uF by coupling 5 .1uF in parallel.

:slight_smile: :slight_smile: :slight_smile:
I read this as:-
I did it with .5uF by coupling 5.1uF in parallel

where as it was written to say:-

I did it with .5uF by coupling five .1uF in parallel
I know there isn't a 5.1uF capacitor but a lot of non standard values of components are coming out of China, which is why I said 4.7uF which is a standard value.

Did you know you can get a plotted output on the Arduino IDE by choosing Tools -> serial plotter.

From that plot it looks like you have mains hum on that reading, is the Arduino actually grounded anywhere through the equipment connected to it or is it all floating?

For more range either amplify the output with an operational amplifier or feed a bigger PWM signal into it by using a transistor to switch to a higher voltage. You could also from that 1K resistor to something not less than 140R .

The cyclic noise could also be because you were not synchronously
sampling with the input signal.
Try the large capacitor and see what happens.
I was digging back into my brain, 25+ years, when I worked
with these.
If you are not synchronously sampling, you will not be able
to determine the phase of the output relative to the input.
Depending on how the coils are wound, it would mean that
the signal out would be a minimum in the middle and
maximum at the end.
The way they are usually wound is such that the phase cancels
when centered and has less canceling as the core moves in
either direction.
If you make a synchronous sampler, you don't need the diode.

hehe, sorry Mike for the confusing writing!

I could correct the noise by increasing the .5uF to 100uF, it worked quite nicely, the graph is not perfect but much smoother! I also changed the 1k resistor to 220R, it helped slightly, thanks!

Dwight, The LVDT seems to be answering in +, 0, +, yes! So I don't think Negative values will be a problem. (what may actually be a problem is to understand the results if a movement goes through zero, but that is for later!). I send a new graph for you to understand what I mean.

I'm now trying to amplify the signal using a transistor, Arduino's 5V DC and the pwm as clock, but I'm not doing too well.
I'm using this tool to try and help me with calculations, but not even theoretically can I reach the results I want (boost to at least to 5 V):

http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+21.593987231061412+99+15+53 w+176+48+272+48+0 r+176+48+176+208+0+4700 r+176+208+176+352+0+1000 t+176+208+272+208+0+1+-7.122180812647985+-2.1290936777184926+100 w+176+352+272+352+0 g+176+352+176+384+0 R+176+48+80+48+0+0+40+5+0+0+0.5 r+272+48+272+192+0+4700 r+272+224+272+352+0+1000 c+176+208+96+208+0+0.00009999999999999999+-2.1290936776677634 R+96+208+48+208+0+2+60+2.5+2.5+0+0.5 c+272+192+352+192+0+0.00009999999999999999+3.5222649017914076 O+352+192+400+192+1 r+352+192+352+272+0+1000000 g+352+272+352+304+0 o+10+64+0+34+5+0.003125+0+-1 o+12+64+0+34+5+0.00009765625+1+-1

Any other simpler option would be welcome. Although this one seemed the simplest to me from the ones mike pointed out, tell me if others are easier!
I also have the option to bring the +12V from the ATX power supply, can it do any good?

Continuously thankful for your comments,

I haven't read all the posts in this thread so if I missed something let me know.
Have you tried measuring the voltage with a DMM instead of an analog input ?
What frequency are you using for excitation ?

Is this your code ?

 #include <LiquidCrystal.h>

#include <Servo.h>

double Time;
volatile double a = 0;
double ticks = 0;
double rpm;

Servo victor;
void setup() {
  // put your setup code here, to run once:
  attachInterrupt(digitalPinToInterrupt(2), addInt, HIGH); 
  a = 0;
  ticks = a;
  rpm = ((a/360)/5) * 60;
  rpm *= 10.416666667;
void addInt(){

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Reset to Continue");

5000 hz is 200uS period which is 100us HIGH, 100uS LOW.
You can't do that with regular PWM because the highest frequency you can get is 980 hz.
You need to use a special Timer code to get 5000 hz excitation.

I'm now trying to amplify the signal using a transistor, Arduino's 5V DC and the pwm as clock,

To amplify a signal to say 10V you need a power supply of 10V. A transistor does not amplify the signal as such but causes a larger current to flow in a circuit when a smaller one flows in the base of the transistor. With that circuit you will never get more than 5V out because you are only putting 5V in.
That voltage measurement is only an average not a peak voltage.

Boost converter