Other Parts Discussed in Thread: OPA387, , ADS1114
I am level shifting a signal from a scale of -12V to +12V down to 0V to 4V, im using a voltage divider that divides /6 and then i shift the whole signal using the LM4051-N (GRADE A). The output of the LM4051-N is fed into a OPA387 op-amp and then the output of that goes to a ADS1114 ADC. The issue i am having is that the simulated output voltage of this arrangement does not match the real output voltage, mind you the errors are 1 to 10mV at worse, but that multiplied down the line brings out errors in the ADC readings as big as 300mV. I took some measurements of the output voltage while i was changing the input signal in increments of 0.5V, so from -11V up to +11V we get more than 40 samples, which i plotted both from the simulation and the real circuit :
This is the output of the circuit in the simulation, it may look linear but its not really, subtracting two side by side readings does not always give the same result.
This is the output of the circuit i made in real life.
And this is the subtraction of the simulated outputs and the real life outputs. The real life circuit seems to always lack a few mV comparing to the simulated output voltage, that is the error im trying to eliminate OR get it to be linear and not this random shaped nightmare. I am adding the graph just for depiction that the error is seemingly random, if you subtract the error from the simulated output voltage, you get the voltage im reading from my real circuit.
Iv measured between different days and this variance stays the same, so the error at least is constant, the same input always results in the same output.
Some extra details, iv measured while there is a load connected and with no load connected, that made no difference and i also have tried 2 different power supplies acting as voltage signals, again i saw no change. The voltage divider resistors are of 0.5% tolerance.
What could be the issue with my circuit and if nothing can fix it in hardware, what can be done in software?
Following are the simulation circuit and how i have my circuit connected on my breadboard, RED area is for setting up the voltage (2.41V) i need from the LM4051 to shift the input signal, and BLUE area is the actual signal input and level shift area.