0
\$\begingroup\$

Right now I am testing an MCP6004 Op-amp IC. A sensor in my main circuit going to give me a signal in the range 0-0.5 V max. So, I want to amplify this in the 0-5V range so that my Arduino reads it accurately.

Now I want to test my op-amp, Arduino measurement accuracy, etc. so I did a trial test.

In this, I generated a low voltage test signal (generated from Arduino PWM) reading 0.5 V. The op-amp receives this signal and amplifies this in the 0-5V range so that my Arduino able to measure this signal.

The voltage gain circuit I have used is:

enter image description here

Case1:

  • R1 = 90k, R2 = 220
  • IC supply: Vdd = 4.97 V
  • Output: Vin = 0.5 V, Vop = 3.54 V

Scope: blue is input, yellow is output

enter image description here

Case2:

  • R1 = 90k, R2 = 10k
  • IC supply: Vdd = 4.97 V
  • Output: Vin = 0.5 V, Vop = 0.56 V

Scope: blue is input, yellow is output

enter image description here

My basic questions:

  1. My actual voltage is totally different and very little compared to the theoretical gain.
  2. Am I measuring the output signal correctly? That is, taking the average value?
  3. How do I measure such a signal in the Arduino? I mean, it is a PWM signal and we need to consider the signal frequency. I did 100 samples average approach, and as expected, it gives way different value.
  4. Am I doing something wrong?

Update: based on below-accepted answer, Case3:

  • R1 = 100k, R2 = 10k
  • IC supply: Vdd = 4.97 V
  • Output: Vin = constant 0.2 V from a potention bridge, Vop = 2.72 V enter image description here
\$\endgroup\$
2
  • \$\begingroup\$ This is my first ever question. I did not expect that the electronics StackExchange is this fast and highly reliable. I really appreciate @JRE for your quick response to my questions and for helping me realize the mistake I was doing. This is awesome. \$\endgroup\$ – Mainland Apr 18 at 15:55
  • \$\begingroup\$ @Andy aka you are tagged to my above comment. \$\endgroup\$ – Mainland Apr 18 at 15:56
2
\$\begingroup\$

The Arduino doesn't have analog outputs. It has digital outputs with pulse width modulation that it calls "analog outputs."

Your analog 0.5V signal isn't really 0.5V.

The first image shows it clearly:

enter image description here

You said the blue trace is the input to the MCP6004. That blue trace is just a series of 5V pulses - if that scope is set to 2V per division.

To test your circuit, you need to filter the pulses to be a better approximation of DC.

To do that, you need a low pass filter to smooth the fast pulses into a DC signal.

schematic

simulate this circuit – Schematic created using CircuitLab

That simple low pass filter will convert the pulses to a (slightly wiggly) DC. It has a cut off frequency of about 3Hz, so it will take a couple of seconds to "zero in" on the true DC result.

  1. Attach that filter between the Arduino "analog output" and the MCP6004 input.
  2. Let the circuit run for a few seconds.
  3. Check the input to the MCP6004 with the oscilloscope - it should show a fairly stable DC instead of the pulses. Change the "analog out" PWM value to correct the output voltage if you need to.
  4. Check the output of the MCP6004 and see if it properly amplifies the input voltage.

You can't use averaging in the Arduino to get the DC value because the amplifier has to work with the peak voltage value in the pulse train. It tries to amplify the 5V peak, but it only has a 5V supply - the pulses come out of the MCP6004 as pretty much just a distorted version of what went in.

You have to make a real DC out of the pulses. The MCP6004 can then properly amplify that signal, and you can measure it with the Arduino.

Build the filter. Take a look at its output, then compare that with the pulses from the Arduino. A pulsed signal is not an analog signal, though it can be converted into one.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Thank you for your valuable input. Yes! your answer made me realize that I am feeding PWM signal mimicking the sensor output, actually, it is not. Now I made a change. I already have a 5V input. I used a potentio bridge to get 0.24 V constant output. Now I have used this as a test signal. The output signal now is more trustable and it is 2.72 V. \$\endgroup\$ – Mainland Apr 18 at 15:43
  • \$\begingroup\$ This is my first ever question. I did not expect that the electronics StackExchange is this fast and highly reliable. I really appreciate your quick response to my question and for helping me realize the mistake I was doing. This is awesome. \$\endgroup\$ – Mainland Apr 18 at 15:56
  • \$\begingroup\$ When I read your answer again I noticed you mentioning circuit lab online s/w, I heard it the first time here. This is really good and seems less complex than LTspice. Your comments? \$\endgroup\$ – Mainland Apr 19 at 15:01
  • 1
    \$\begingroup\$ @Mainland: CircuitLab is simpler than LTspice, and it is built into the site here. That makes it easy to use in questions and answers. It is very limited, though, so it isn't a replacement for LTspice or other simulators. \$\endgroup\$ – JRE Apr 19 at 15:08
1
\$\begingroup\$

According to your oscilloscope you are feeding the input with over 5 volts p-p: -

enter image description here

If you have a gain of ten then clearly, the op-amp output is going to limit hard against the positive power rail and all bets are off.

4. Am I doing something wrong?

It certainly looks that way.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you for your valuable input. Yes! your answer made me realize that I am feeding PWM signal mimicking the sensor output, actually, it is not. Now I noticed it is more than 5 V that op-amp can actually take. Now I made a change. I already have a 5V input. I used a potentio bridge to get 0.24 V constant output. Now I have used this as a test signal. The output signal now is more trustable and it is 2.72 V \$\endgroup\$ – Mainland Apr 18 at 15:44
  • \$\begingroup\$ This is my first ever question. I did not expect that the electronics StackExchange is this fast and highly reliable. I really appreciate your quick response to my question and for helping me realize the mistake I was doing. This is awesome. \$\endgroup\$ – Mainland Apr 18 at 15:56
  • 1
    \$\begingroup\$ With that attitude we might allow you to ask more questions ;) \$\endgroup\$ – Andy aka Apr 18 at 17:10

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.