Voltage divider design issue - Page 1
Forum section: electronics / projects

author: mitrynicolae
author_rank: Contributor
timestamp: September 04, 2018, 06:50:42 pm
content: Hello all,I have a design issue, but I cannot see the component that is wrong. Please check the attached files(also please note that the excel has multiple sheets), maybe you could figure out what I am missing here.Just as a brief explanation of what I am trying to achieve:R200 and R99 should act as a voltage divider, reducing the output voltage by ABOUT 1/10.D1 is placed to protect the Opamp in case the user connect the input voltage incorrectly.R90 and C51 should act as a low pass filterD30 should prevent the input voltage go above 5.1V in order to not damage the opampThe opamp is actually MCP6022 and it acts as a buffer, to isolate the input from the MCU (the output will either be read by an MCP3425 or dirrectly by Atmega 328 P microcontroller)On the output of the opamp I have placed another low pass filter followed by another 1kohm resistor (don't ask why, even me I don't know; maybe just for fun of placing components)Now if you examine the excel file you will notice the following:- on the first sheet there is the input value vs the MCU readed value (here is where the issue was noticed). As you can see instead of the lines being parallel or overlapping each other, they intersect which is clearly a bug. Further I started to trace the issue and I took another readings- on the second sheet represents some measurements between input and output of the OPAmp to check if the error is in the ADC or not. it proved not to be- the third measurement is between the input and the output of the opamp to check if the error was produced by the buffer. Normally it should not be the case since I am using a simple buffer but who knows. It proved that my theory was correct and the error was not produced by the buffer. The small discrepancies that can be observed I believe that they are either by the buffer drift or by incorrect measurements and since they are quite small I will ignore them.the forth measurement and the most edifying was between input and OPAmp input. This concluded that the issue is produced on this stage and although I only use simple component I cannot see the component that can generate this kind of error.Please note that on the input normally I should read only DC voltage since this sub circuit is part of a greater circuit that at the end it should be a battery charger regulator.Also please note that the PCB is already made so changing the design at this stage is a little bit late and for me it will be only to gain more knowledge in electronics.Now the questions are:1. Where is the issueeeeee.....2. If somehow I would create another version of the PCB (although most likely not) how would you design this stage for an optimal output? (Reject AC as much as possible, protect the input and output components from "THE STUPID" obtain the most accurate outputs based on input and so on).

author: Kleinstein
author_rank: Super Contributor
timestamp: September 04, 2018, 09:02:14 pm
content: The diode D1 is doing no good. It adds to the voltage of the divider. So it is best to use a 0 Ohms resistor instead.With the 2.2 M resistor there is little chance to damage. Chances are the circuit would even survive connecting it directly to mains - though the voltage rating of the 2 M resistor could be the limiting factor.I don't seen a reason for the Pot, unless one really needs to adjust the divider ratio. With the high impedance divider R90 has essentially no effect, but at least it does no hurt.The OPs input has protective diodes inside, that are powerful enough. So no need for D30. Leakage from D30 could be a problem, as that circuit part is rather high impedance. So it's better to leave out D30. The filter with C51 is really slow - the relevant resistance is R99 in series with R90, not just R90. So likely C51 should be reduced in value by maybe a factor of 20.For the output filter, I have not checked if the MCP3425 is happy with the filter. It may have a slight negative effect on linearity.

author: mitrynicolae
author_rank: Contributor
timestamp: September 05, 2018, 05:46:31 am
content: I can understand how D1 will add to the voltage divider, but I cannot understand how replacing it with a 0-ohm resistor will prevent the user from accidentally reversing the input wires. From my knowledge, if the input of the Opamp is lower than the V- (-some offset voltage) of the supply then the opamp will not like that. On the other hand, you stated that I can safely remove the D30 due to internal opamp diodes. But again from my testings, if the input voltage is greater than V+ then that voltage is output by the opamp. Yes in my tests the opamp survived, but the logical components after the opamp most likely will not like that voltage. What I forgot to say is that VCC from the design is actually 5V and the V- of the opamp is connected to the ground, making it a single powered supply buffer. The potentiometer was added for fine tuning the voltage divider. Even if the resistors have 1% accuracy you can imagine that they are not perfect and some adjustments have to be made."So likely C51 should be reduced in value by maybe a factor of 20." By this do you mean having a 50 nF capacitor instead of the actual value? This is again something I don't understand. I was supposing a greater value will decrease the cut off frequency and will reject more AC.Thank you for your time.

author: Kleinstein
author_rank: Super Contributor
timestamp: September 05, 2018, 06:04:32 am
content: The OP has internal diode that can protect the input from a wrong voltage, as long as the current is less than 2 mA. In this case the OP will output a voltage close to the limt, but that is OK and the parts behind should be able to cope with this.D1 would not help against reverse polarity anyway.One can keep C51 at 1 µF, but the response would be very slow. The usually better way to filter out unwanted AC it to use a kind of digital filtering, like averaging over a multiple of 20 ms. Thus gives a rather good suppression of 50 Hz, 100 Hz and so on without an excessive long settling time.

author: mitrynicolae
author_rank: Contributor
timestamp: September 05, 2018, 08:34:10 am
content: Regarding the C1, you are correct. It's my fault. I didn't understand why to change it since on the "previous version" it worked fine. But on the previous version, I had 100kohm for R200, a 4.7kohm for R99 and a 10k potentiometer. I supposed that increasing the values will solve this issue (apparently not). I don't want to perform the filter digitally, for two reasons: 1. multiple reads of ADC which will load the MCU and/or the I2C line, depending on the ADC used (internal/external). 2. a similar circuit is used for driving the output opamps. The charger regulator is designed to work without MCU, if for any reason it fails. I only remove it, set some jumpers on the board, adjust some potentiometers and at last I should have a steady 14.4 volts on the output.On the other hand, I don't understand why D1 would not help against reverse polarity?

author: tecman
author_rank: Frequent Contributor
timestamp: September 05, 2018, 02:15:55 pm
content: Another concern is that the input resistor of 2.2 meg is high enough that leakage current through the zener or cap can effect the divider. Also look at the opamp input bias current as a factor as well.paul

author: Kleinstein
author_rank: Super Contributor
timestamp: September 05, 2018, 05:29:04 pm
content: To have a diode like D1 help with reverse polarity, it would have to be in series with the 2.2 M.If mains relative noise is a problem, than multiple sampling is definitely the way to go. It does not need that many samples. Something like 4 samples with 5 ms spacing allready would be a big step forward. For the MCP3425 it would be 3 samples at 15 SPS to get close to good 50 Hz suppression. It is otherwise more suitable for 60 Hz regions.

author: mitrynicolae
author_rank: Contributor
timestamp: September 05, 2018, 06:43:42 pm
content: Hello all,I have good news, for me. Thanks to Kleinstein I found the issue. Indeed the D1 produces the output error. I have remove it and shunt the pads, recalibrated the MCU and everything works like a charm. Now I still have three questions:1. Why moving the D1 in series with R200 will make any difference?2. Could you suggest any diode (of any kind) that can protect the circuit of reverse voltage? (if possible the diode should be available on this site:https://www.tme.eu/ro/katalog/semiconductorii_112140/#id_category=112141&page=1&s_field=artykul&s_order=ASC3. How about moving D1 in parallel with D30?Btw I really need the reverse protection diode. I have just reversed the inputs with the D1 shunted only for testing and instantly the magic smoke appeared. I haven't managed to get the component that smoked because I have disconnected the input and fortunately I have saved the board.Do you have any idea what could have heated?Do you believe that a led will do any better for this protection or a Schottky diode?

author: Kleinstein
author_rank: Super Contributor
timestamp: September 05, 2018, 08:21:48 pm
content: For the reverse polarity protection, there should normally be no problem without an extra diode. It could be a problem however if the voltage to be measured has a separate connection to the circuit. So it really depends on details. A diode in series with R200 would prevent a reverse current through the divider. However there would be a drop at the input voltage. So U_out would be 1/10 *(Uin-U_diode). A suitable diode could be 1N4007 - though it is not really accurate.If really paranoid with protection, one could used diodes directly at the divider. This would limit the current that might flow to the OP to something like 0.5 V / 10 K = 50 µA , well below the 2 mA limit of the MCP6021. Suitable diodes might be BAV199 low leakage diodes (2 in a case).