LVDT Interface to Arduino Due

I have an input device that I would like to turn into a USB joystick. The technology used to measure displacement on the input device is a Linear Variable Differential Transformer (LVDT).
It has both an X and Y axis split as two separate LVDTs that share a common input.

For those unfamiliar an LVDT is a transformer that is actuated and read by inputting a sine wave (In this case 400Hz. The ouput is zero at center, with an increasing in amplitude sine wave output based on the deflection of the controls. Direction is represented by a phase shift in the signal with 0 being one direction and 90 degrees being the other.

I've been looking through a lot of the posts on the forums and I have some ideas, but I'm not quite sure which way to go.

On a high level I would like to create a sine wave output which I feed into the joystick, then read the 2 separate inputs using the ADC and measure the phase shift from the input as well as the amplitude of the modified wave. Once I have that there are existing libraries that make getting that information over USB into windows as a HID joystick trivial.

So the questions I think I should be asking are

  1. Is there an easy way to generate a 400Hz sinewave that is fairly clean?
  2. What is the best way to read the inputs? If I understand what interrupts are, this might be a good use case for them. Conceptually I would get three interrupts, one for the output, one for each input. By comparing the time the interrupts were thrown you could measure the phase shift from output to inputs. (Or perhaps I could know the time of the output since it may be possible to generate it using the Arduino and if I'm generating it I should already know its timing?)
  3. Does writing to the USB port take up processing time or does the design of the Due handle those items in parallel? Or is the way that interrupts work with the ADC unaffected by the other communication and processing tasks?

Hopefully this makes sense enough,
Thanks,
Jim

The easiest way to interface the basic LVDT is to use a chip or interface module designed for the task. Advanced knowledge and experience with analog circuitry is required for DIY approaches.

LVDTs and resolvers are variations of the same concept and I think there's an arduino-based Resolver reading project on github. I vaguely remember seeing it when I was researching another project a few years back.

My device simulates a resolver to allow retrofitting modern controls to older machines that expected resolver input. I started out by generating the sine wave myself but that turned out to be problematic. Anyway, you can generate pretty high quality sine waves by using a DDS method and there's an arduino DDS library that can be easily found.

I would recommend just using an off the shelf chip if this was for a precision application, but for something like a joystick, you can probably get away by doing it all via arduino.
Also, the classic LVDT interfaces like the NE5521 are going for $$$ these days. I should see if I have any left in my old stock :slight_smile:

I don't think LVDTs work quite like that. The output voltage is zero at the centre and increases as the slider moves to either extreme. In one direction the output sine wave is in phase with the drive, in the other it's in antiphase. Or: "Direction is represented by a phase shift in the signal with 0 being one direction and 180 degrees being the other.

So basically you need a "synchronous rectifier" that multiplies the output signal with the input sine and integrates the result. You don't need to measure the phase shift as such or resolve quadrature signals.

If you're not too interested in ultimate precision sine wave drive also probably isn't too important provided the signal is symmetrical. This means that a sine table with just a few samples in time representing a quarter of a cycle and not high binary precision could be quite adequate. And it's also not necessary to do a full multiply - you can just multiply the sampled output signal by +1 for one half cycle and -1 for the other and add up. It would probably be worth trying a square wave drive even, it might be good enough for your application.

Ok, thank you all for your thoughts on this.

So I did look at utilizing chips, but as cedarlakeinstruments pointed out they are rather expensive. Since the device has two separate outputs, it would require double the amount of expensive chips. In the end if I have to do that, I will. However, I'm cheap and as others pointed out its a joystick for a game, so precision isn't super critical. Combine that with the fact that an Arduino Due is quite a bit of computing power it seems like I should be able to do everything I need in software with the included hardware.

It sounds like utilizing DDS to generate the sine wave is very acceptable for my purpose.

I think I understand jhaine "synchronous rectifier", so let me say it back to you and see if I got it.

I would take the output and multiply it the input. If its in phase, it will be positive x positive or negative x negative and will always be positive. If its 180 degrees apart, it will be positive x negative or negative x positive and will always be negative. That gets me the direction of travel.

By integrating that I get the area under the curve, which would give me the total displacement, which is also the direction because the area will be either positive or negative. I think I get it.

I can utilize timer interrupts to precisely measure the time. Use an interrupt every x portions of a second, then when the interrupt trips I can set the new DAC value for the waveform and then measure the two separate inputs, do the math and get my result.

Now I just have to figure out how to program that, but it makes sense (I think!)
Thank you very much,
Jim

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.