I want to constantly log the voltage of waveform that is coming off a electromagnetic harvester into a SD card. I wish to use the ADC of an Arduino in conjunction with an SD card to do so.

My problem is that as MCU ADCs cannot measure voltages when in negative form, and because the harvester produces voltages from +6V to -6V, I must create a circuit that can reflect negative voltages as positive. I believe I can do this if i can take the absolute value of a voltage using op-amp. I do not mind externally powering the operational amplifier. I only want to record the values of voltages coming off the harvester into an SD card.

Please note that I do not mind logging the negative voltages as positives. I only want to calculate the energy across the load of the electromagnetic harvester. Additionally, as the Arduino ADC cannot take in voltages beyond 5V, I can use the simple resistor divider to reduce the the max voltage of 6V to 5V.

I would appreciate if I can be shown how to configure an op-amp to operate as modulus operator to take in the harvester voltage waveform and make a (rectified) waveform. I would also appreciate a recommended op-amp device.

I would like to also mention that by absolute value, i mean the absolute size of a number. That is, we disregard any sign it might have. Example The modulus of −8 is simply 8.

  • \$\begingroup\$ I think you need a rectifier. \$\endgroup\$ Apr 25, 2016 at 19:52
  • 1
    \$\begingroup\$ A precision rectifier is what you are looking for, this will give you the absolute of the voltage input. \$\endgroup\$
    – uint128_t
    Apr 25, 2016 at 19:55
  • \$\begingroup\$ @uint128_t Please post this comment as answer and may be (please) with a potential op amp that might work. I will accept as answer. \$\endgroup\$
    – Denis
    Apr 25, 2016 at 19:59
  • 1
    \$\begingroup\$ The 'modulus' is the remainder after a division. What you're looking for is the 'absolute value' which, as uint128_t has already noted, is what a precision rectifier will give you. \$\endgroup\$
    – brhans
    Apr 25, 2016 at 20:04
  • \$\begingroup\$ @brhans Thank you. I have corrected my post accordingly. \$\endgroup\$
    – Denis
    Apr 25, 2016 at 20:06

1 Answer 1


To get the proper output for both positive and negative inputs, you need a full wave precision rectifier. Here is a workable schematic:

enter image description here

You don't need R4 and the resistor values can be increased for relatively low frequency. This particular circuit uses an OPA2211 but other op-amp types can be substituted.

The dual op-amp requires a dual supply (+/-) for this to work properly. Something like +/-10V should work well. You can divide down the output to stay within range of your ADC.

  • 1
    \$\begingroup\$ Nifty! I use precision rectifiers in an EMG lab, and have figured out empirically that I need a cap in that feedback loop for good function, but have never seen a doc that puts it in there or tells you why its there!! \$\endgroup\$ Apr 25, 2016 at 21:26
  • \$\begingroup\$ @scott Did you mean c7? \$\endgroup\$
    – Denis
    Apr 26, 2016 at 7:38
  • \$\begingroup\$ @Qwertylicious, yes \$\endgroup\$ Apr 26, 2016 at 11:03
  • 1
    \$\begingroup\$ @ScottSeidman - C7 is there to provide a high-frequency feedback path for U1A. Without it, changes on the output of U1A only appear at the input after the delay of U2A, which can be enough delay to cause oscillations (and even if that's not the case, may end up with significant ringing after input changes). Generally speaking, any time one has an op-amp in the feedback loop of another op-amp you want a capacitor there. \$\endgroup\$
    – TLW
    Jan 26, 2017 at 2:48

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.