I am working on a project in a photonics teachings lab. In the lab, we perform a demonstration for the students using a \$\mathrm{CO}_2\$ gas laser. The output of the laser is terminated in a wattmeter. The other end of the optical cavity is formed by a reflection grating mounted to a stepper motor. The angle the grating forms with the optical axis determines which wavelength of light is reflected back into the cavity. This allows us to effectively scan the spectrum of the laser (i.e. to plot power against wavelength).

For control, we have a slider which controls the scanrate, and a three-position switch which controls the scan direction.

For data acquisition, I have an RPi and Arduino Nano. The RPi is running a small GUI with a plot window. When the GUI is started, the RPi establishes serial communications with the Arduino. When ready to collect data, the user will press start on the GUI. The RPi then begins to query the Arduino on A1 (where the control voltage is connected). When it detects the necessary condition, the RPi starts to instead query on A0 (where the wattmeter output is connected) and plot in real time.

This all works quite well, except for a few problems relating to the control signal. The signal is a voltage between -5 V and +5 V. The magnitude of the voltage encodes the scanrate, and the polarity the direction. The slowest speed corresponds to a magnitude of 1 V.

We scan in the reverse direction at the slowest speed, which means we need to be able to detect the -1 V signal on A1. However, the Arduino cannot sense negative voltages. I have tried the typical methods here. Voltage divider, inverting amplifier. These "work" in the sense that the script executes as expected. They do not work in the sense that these methods seem to actually change the operation of the stepper motor, which is a critical failure.

My last solution attempt was to capacitively couple the signal in an attempt to extract the edges (the only critical information), but I could not get this to work either.

My experience with electronics comes from personal hobby. I apologize if this is an extremely simple question.

How can I isolate the necessary transformation I need to do to the control voltage without modifying what the stepper controller sees?


  • 2
    \$\begingroup\$ Just use a high impedance input, which is most of them. Show your schematic. I dont think your problem is what you think it is. Are you usin opamps with bipolar supplies to level shift your signal to unipolar voltages? \$\endgroup\$ – DKNguyen Nov 24 '19 at 19:46
  • 2
    \$\begingroup\$ You need to use an isolation op-amp to transform the level to the Arduous 0 --5V range. \$\endgroup\$ – Jack Creasey Nov 24 '19 at 19:49
  • 2
    \$\begingroup\$ @RileyScottJacob But your ADC cannot read bipolar voltages anyways so thats irrelevant since you cannot connect it directly. Whats relevant is the level shifting amp's input impedance and that it can accept bipolar supplies. Show the schematics you attempted \$\endgroup\$ – DKNguyen Nov 24 '19 at 19:53
  • 1
    \$\begingroup\$ @RileyScottJacob You mean Neenad Jaiswal's answer? I dont agree with that circuit since you can do it with one op amp and level shift by biasing the inverting input. Also, did you use dual supplies? I have mentioned this twice already but you keep dodging the question. I cant draw a schematic with the hardware I am at right now \$\endgroup\$ – DKNguyen Nov 24 '19 at 20:29
  • 2
    \$\begingroup\$ @RileyScottJacob The only way anyone could consider a 3-resistor approach (without an opamp it still could be done) would be to know a lot about how much load your speed voltage source can handle. It would actually need to be a pretty low impedance output. Do you know any of the details of that output? \$\endgroup\$ – jonk Nov 24 '19 at 20:41

Try this. Only U1 is really required. The other two op-amps are only conditionally necessary.


simulate this circuit – Schematic created using CircuitLab

The reason I quartered the input signal then re-amplified by two intead of just halving it was becase since I could not figure out how to add an offset using a unity-gain voltage follower or else I would have done that for U1 and just stepped down by half.

Instead, I had to use the non-inverting amp circuit for U1, but the non-inverting amp must always have a gain greater than 1 so I had to make up for it by stepping down the signal more than actually required at R2/R1.

The reason I halved it should be obvious...to fit the 10V peak to peak swing of -5V to +5V into the 5V peak to peak swing allowable by 0V to 5V. I'm assuming your Arduino accepts 5V at the ADC. If it accepts 3.3V max then you have to adjust the stepdown and the gain to accommodate.

If the input impedance is too low without U3, you may be able to do without U3 by increasing R2 and R1 to something like 75K and 25K, respectively. I really feel that input impedance was never your problem though. It was that you were feeding negative supply voltages to op-amps or circuits that could not handle them.

Oh yeah, if you have an oscilloscope, you should scope the user control output to see what it is normally, and what it is with the circuit connected to it. That would let you know what's going on almost immediately.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.