Reading sine wave from LM741 and plotting in oscilloscpe

Hello everyone!

I have an Op Amp to increase the DC offset signal that's input to arduino. The DC is of 2V. So, I have been doing a digital-analog convertion of this signal, but I want to plot in external oscilloscope. How can I do that? Remeber that the sinal input in arduino is a sine wave with DC offset of 2V.

Follow my code:

const int analogPin = A0;
const int analogPout = 9;
int sensorValue = 0;
int outputValue = 0;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(analogPin);
outputValue = map(sensorValue, 0, 1023, 0, 255);
analogWrite(analogPout, outputValue);
}

Best regards

You do know analogWrite( ) produces A PWM signal ?

Yes! AnalogWrite is used to plot a PWM, however, this function only read integer values

Still don’t know what results you are expecting to see but this circuit can be used.

image

3.3v can be 5v


outputValue = map(sensorValue, 0, 1023, 0, 255);
Or use:
outputValue = sensorValue / 4;

analogWrite() does NOT output an analog voltage.

analogWrite() does generate a PWM signal

It is confusing that arduino folks named an PWM output "analogWrite()"

I think it should have been named pwmWrite().

This is my ckt in figure 1. Now, I'd like to input the sine wave from Op Amp in arduino and to do a ADC. After that, I want to export to external oscilloscope, not serial plotter.

imagem_2021-07-30_110833

Yellow sine wave is a op amp signal output and I'd like to input this signal in arduino to do ADC and export the sine wave to external oscilloscope to do the validation, in the other words, I want to know if I have the same signal from arduino in oscilloscope

The waveform below is a sine wave, your input, superimposed onto your PWM analogWrite output.

Am still confused what you are expecting.

The circuit in post #4 will remove the DC offset from your sine wave signal.

image

Does your Arduino have a Digital to Analog converter?

What does the "external" oscilloscope expect on its input:

  • analog voltage?
  • digital values?

If digital values how must the digital values look like?

We are talking about details. Please give an overview over your whole project.
in mimimum 70% of all cases knowing the whole thing offers completely different and much better working solutions.

here is an analogon that shall show what can happen if just ask for details:

Newbee: "I want to do better cutting please help me sharpening. "
Expert: Sure I can help you. What kind of cutting-tool are you using?
Newbee: a scissor.
Expert: OK take this sharpening tool
Newbee: Yea works great Next question How can I make it cut faster I need to finish faster.
expert: Motorised scissors.
newbee Yea works great though still not fast enough.

expert: Ok can you give an overview about what you are cutting.
newbee: the green of a football-arena.
expert: Oha! take a big mowing tractor with a seven boom spindel-mower and GPS-steering

In the beginning the newbee always just told details.
The expert was assuming the newbee knows that his basic approach is well suited.
which turns out to be very bad suited
that's the reason why it is always a good idea to give an overview and to explain what shall happen in the end.

So please describe what you want to do in the end with the digitised sinewave

best regards Stefan

The yellow sine wave is a signal op amp output with a DC offset of 2V. The purple sine wave is sine signal input. Now, I want to do a analog-digital converter of this signal and after that I want to visualize the same signal (op amp output) in a bench oscilloscope. I want to know if the op amp signal output is the same after to do a ADC of this signal. How can I prove that? Exporting a ADC signal from arduino to bench oscilloscope

You cannot with what you have.

The original sine wave is an analog signal. The output of the ADC is a digital measurement of many places on the sine wave. It is numbers only.

There are two methods to make such a comparison:

  1. Purchase a DAC (converts digital numbers back to analog) and plot its output.

  2. Output the digital numbers to a file, then plot it with a program like LibraCalc.

Thank you! I'll make what you speak today.

You mention LM741, are really using that. It is an old design and has many limitations. Like for instance if you use 5V power supply voltage, LM741 output can only go to around 2.5V-3V.

I recently through out my handful of µA741's in TO-5 metal cans :slight_smile: