Modifying Arduino DUE DAC Voltage Output to 0-5V

Hello there,

I want to start by saying I'm not too familiar with electrical engineering and hardware designing but I've been trying my hand at using an OP-Amp by the name LM358 to amplify the voltage output of my Arduino DUE's DAC ports (that have a known voltage output of 0.55V-2.75V) to instead have a max output of 5V. I've attached what I've been able to do on LTspice to this topic but I've run into an issue with my signal output (as you can see in the image).

I believe I've hit a wall here as I'm not sure where to go next. I believe my resistance combinations are correct as I found online that for a 0-5 volts range (which I actually only technically need the max voltage to be 5V), the gain is G= 5/2.2 = 2.27 =R2/R1, with R1 = 100k, R2 = 226k.

Please let me know if you believe I've made a mistake in my circuitry or perhaps my resistance combination is not as accurate as I thought.

Thank you so much for you time and help on this.

I appreciate and advice to point me in the right direction,

Jesse

Know that resistors have toleranses. They can be 1, 2, 5 or even 10% wrong.
I suggest replaising the two amplifying resistors with a 10k to 47k multiturn trimpot.
To adjust it, use DMM.

Note that LM358 is not a rail-to-rail output opamp. So the output will never be more than 3.5V with a power supply of 5V.
You can use another opamp (rail-to-rail output), or use a higher supply for it, if available.

This is not true because this opamp is not rail-to-rail.

To have 5 volts at the output according to the datasheet its power supply must be at least 7 volts.
If I understood you correctly.

You are not correctly simulating the DAC output.
The DAC output goes from 0.5V to 2.75V (as mentioned in your original post).

However in your simulation you have a sinewave generator that outputs a voltage between -2V and +2V.

You need to reduce the amplitude of the sinewave, and add an offset, so that the input to your op amp circuit does not go outside the range 0.5V to 2.75V.

If you want a rail to rail opamp in DIP package, you can check this one: MCP6022. It's rail to rail inputs and output, and works with power supply from 2.5V to 5.5V.

For the simulation, in LTSpice you can choose the UniversalOpamp2 and set Rail=0, to be rail to rail. And as other commented you have to adjust the input signal to go from 0.5V to 2.75V. I suppose that amplitude 2.25V and DC offset +2.25/2 V

Thank you all for such great help!

I've taken into account everything that's been recommended and I really appreciate all the guidance.

Addressing first the tip from @Railroader, the version of LTspice I'm working with is 24.0.12.0 and after looking online it appears I can't find anything on constructing a multiturn trimpot to simulate first. Would you have any advice or ideas on how to go about constructing that? I'm interested to see if adjusting the amplifying resistors will cure the problem.

On another note, as you can see in the image provided, I've changed the Op-Amp as recommended so that it now has a rail of 0 and is now apparently a rail-to-rail output. I'm not sure if I have a higher supply of power available but I can consult with my colleague on this project in regards to that. As of now though I'm just gonna say I don't have a higher power supply available, is there a work around for that as I'm just purely trying to make an LTspice simulation for now. I suppose we will build the designed circuitry if it works so maybe we could also add a higher power supply in that stage. Is there a way to simulate this on LTspice by the way?

The adjusted signal still seems to be a bit off but better after adjusting the offset and amplitude accordingly. Is there any other guidance to go from here that y'all might recommend?

Thank you again for all you time and help on this,

Jesse R.

It's much easier if you use two opamps, one to remove the offset and one to do the gain.
Then it will come out perfect

For simulation, use any pot.

Okay, thank you @Railroader.

Using 2 Op-Amps? That is interesting, I didn’t think about that @jim-p

Would there be any online sources that I could read through a follow to give me some direction on how to construct such a simulated circuits on LTspice?

I’m not very familiar or experienced in this field of electronics or electrical engineering.

Thank you a lot for the advice,

Jesse

Google " Op amps for everyone".
It's an old app note from TI and it explains a lot of the basics of opamp design

It's a free download, not the book that some sell

Try this way:

As you probably will have 2 opamps in the package, as Jim said, you can use the first one to substract 0.55V to the signal and the second one to amplify.
Or the first one to buffer the output of the voltage divider that produces the 0.55V.