This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LM4051-N: Using LM4051-N as a source for a level shifting circuit, but i get non-linear error in output

Part Number: LM4051-N
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.

  • Hello,

    What are you measuring as the output voltage of the LM4051? With a 200 and 270 ohm resistor the output should be around 2.466V.

    This might cause an offset compared to the simulation. Can you share your op amp schematic and are you making the measurements at the output of the op amp or at the output of the voltage divider with the op amp disconnected? If you are measuring at the output of the op amp, as the input voltage gets closer to the supply rails it could cause the output to become non linear.

    Best,

    Walter

  • The LM4051 has a R1 of 200 and a R2 of 207, the Vref is 1.19V so 1.19 * [(207 / 200) + 1] = 2.42165V, this is 11.65mV above the simulation, i did not notice that so lets note this down for now.

    Now the measurements i took for the plot where with the op-amp disconnected, if i connect the op-amp i do in fact read a higher voltage but when i connect the ADC it is always giving me the correct readings anyway, so the ADC agrees with my multimeter, i never understood how can i be reading a higher voltage from the op-amp but the ADC gets the reading right, i just left the op-amp alone because i dont have a big understanding of them.

    So with the op-amp disconnected, i get that non-linear graph of error, with the op-amp connected, i get the same graph.

    The op-amp has a 0.1uF decoupling capacitor as does the ADC, the LM4051 does not have one though. Since you mentioned the rail to rail feature i did change the power supply power to be accurate to the real circuit i use.



  • Hi,

    There could be self heating in the resistors causing non linearity in the voltage divider. Can you try using smaller resistors in the voltage divider such as 2k and 10k or 200 and 1K. If a lower resistance does not have an effect you can try increasing the resistance as the LM4051 output voltage will slightly change with load current. Less current through the voltage divider will minimize this effect.

    thanks,

    Walter 

  • Hi Walter i still have not tried your suggesting because im focusing on another aspect of my project, but im getting back to this today, i wanted to ask though if my choice of a shunt voltage was a bad choice to begin with? I basically draw no current from it and the voltage seemed stable enough so i took my chances but being an unexperienced fella i still have it in the back of my mind all the time that maybe iv made a wrong choice. Thank you for trying to help me.

  • Hello,

    The LM4051 should be fine to use. I did not have an LM4051 to test but I used an LM4041 which has the same functionality at a slightly lower spec. I used 0.1% resistors for the 20k and 100k voltage divider. Instead of a simulation I measured the exact output voltage of the LM4041 and the exact resistances of the 20K and 100K resistors and calculated the expected output voltages using the resistor divider formula with an offset. Vout = V(LM4041) +(Vin-V(LM4041))*(20000/100000+20000)

    I used a DC power supply as the input voltage and measured the input and output voltage with 6.5 digit multimeters to make sure it was accurate.

    The percent error is a constant 0.16% across the input range which is fairly negligible.

    The error plot is linear and the largest error I measured was only 6.7mV which is far lower than your largest measured error of 65mV. 

    It is strange you are seeing so much variation. It might be an issue with your measurement equipment or the resistors are at the far end of their tolerance rating. Unless you hand select resistors there will be a few % error from the simulation. 

    Thanks,

    Walter

  • Walter, your will to try my circuit on your own time has been greatly appreciated!! It gave me the courage and trust i needed to continue digging and i found the issue, it is the 4051 it self, something must be off with it because i tried providing the DC voltage needed for the level shift with 2 other basic DC supplies and i indeed got plots similar to yours, indicating in my eyes at least that the 4051 is acting up and not the resistors.

    My circuit is on a breadboard and iv burned at least one of every chip im using, totaling 6 loses, costly mistakes and time consuming mistakes, i cannot trust this circuit on the breadboard anymore but it has no use now because i can move on to a PCB, with your help i am now satisfied that this circuit will work reliably on a PCB and fresh ICs.

    I will wait 2 days to mark this post "Resolved" just in case you want to add anything, i thank you very much one more time.

  • I hope you have success with your project! If you have any more issues please let me know.

    Thanks,

    Walter