MCU adc circuit protection - Page 1
Forum section: electronics / beginners

author: hsn93
author_rank: Regular Contributor
timestamp: May 23, 2018, 08:00:42 am
content: Hello, im having three questionsI'm putting the information here that im not sure of so (if i said anything that is not correct please correct me) ..i was looking to protect ADC of a microcontroller..1. circuit:i'm using industrial 1-5v sensor ... and looking into different solutions on the internet i came up with thisis this good ? can it be done better?2. current limit:the resistors (R2 top + R1) -> 560 ohm within the mcu characteristics according to this :should i increase them to 2000 or something (would be more protected) ??3. range?Rbt (1K) to convert (1-5v) to (0.64-3.21v)what is the "GAIN[0 to -vref]" what is the adc range here ?Datasheethttp://ww1.microchip.com/downloads/en/DeviceDoc/SAM-D21-Family-Datasheet-DS40001882B.pdf

author: ataradov
author_rank: Super Contributor
timestamp: May 23, 2018, 03:02:44 pm
content: 1. Put diodes on the 3.3 V side and just do 2 resistor voltage divider. If this is an industrial application, you may need to do more analog filtering to get rid of the noise.2. Maximum reference voltage is Vref = Vddana - 0.6V (3.3 - 0.6 = 2.7 V). ADC conversion rage is 0V to Vref, for the signal after it passed the analog gain stage. No idea why there is "-" in there.So you need to further divide your voltage so the maximum is 2.7 V and set the gain to 1. Note that you need to feed that reference level to to VREFA.A more convenient way is to use REFSEL = INTVCC1 (1/2 Vddana) and have your signal maximum to be 3.3 V. Then you set gain to 1/2. This way you don't need a separate reference ,just make sure your Vddana is a reasonably clean supply. And you can have full 0 - 3.3 V signal mapped into full ADC scale.l I personally prefer this variant.

author: David Hess
author_rank: Super Contributor
timestamp: May 23, 2018, 08:00:12 pm
content: I agree with ataradov; put the shunt protection diodes on the 3.3 volt side and combine the input resistor with the voltage divider.Raise the impedance of the voltage divider as far as possible consistent with the input leakage of the ADC and accuracy requirements. Add a filter capacitor across the ADC input consistent with the bandwidth requirements to limit noise.If the impedance of the resistive divider cannot be make large enough to protect the ADC, then add a high impedance input buffer to drive the ADC.

author: JS
author_rank: Frequent Contributor
timestamp: May 23, 2018, 09:49:38 pm
content: Sorry to contradict you guys, you don't need the diodes to be connected to 3.3V but you do need a 3.3V zener (instead of the 5V connection). Even if you connect the diodes to the 3.3V rail the zener should be there to prevent excessing input current to elevate the rail voltage, or your µC would be feeding itself from the external source rather than the supplied current source, this could bring all sort of issues, like magic smoke escaping from the MCU or the PSU.JS

author: David Hess
author_rank: Super Contributor
timestamp: May 23, 2018, 10:29:25 pm
content: It is not really a contradiction and there are a couple of ways to arrange the shunt protection. Diodes are usually sufficient but a zener diode is better depending on the details. Better than either is one or a pair of bipolar transistors with suitable bias networks.

author: JS
author_rank: Frequent Contributor
timestamp: May 23, 2018, 10:34:54 pm
content: yes, another option, a really good one when space is premium, is to use TVS ICs, a bit expensive for some applications but usually not a problem in industrial applications. (I do that for living)JS

author: hsn93
author_rank: Regular Contributor
timestamp: May 24, 2018, 07:54:26 am
content: thank you everybody for the valued replies ..but i want to explain my initial thought just to put the ideas that came in my mind and to get feedback from you i would correct them and learn a lot ...+ i really look into1. why i put the diode in 5v rail:i really didn't want to play with the 3v3 or introduce noise or increase its voltage for the microcontroller .. is that correct ?+i thought that its always better to have the clamping of surge voltages at beginning or as close as possible to the input of your circuit in the PCB layout ?but now after your suggestion i can see that im actually clamping (5 + Vf) after the voltage drop on the 500ohm which means that the ADC of MCU will have more than 5v on its input.... really bad...----------------------------------------------------------Quoteto be honest i didnt go to that level in microcontroller, i played with arduino and mbed before which is really high level "you basicly dont know what is going on in the backscene" .. and now, im playing with 32-bit mcu ..but i can see ASF framework have these options so it would be somthing like this:right?----------------------------------------------------------Quotewould it be better to have 5v zener on input without resistor and then the voltage divider ? or voltage divider then zener ? or it really doesn't matter (i guess it does because the voltage divider would protect the zener?)but would that limit the design parameters because zener has dynamic internal resistance which has range that you have to be in ? so now the voltage divider selection is depending on:- maximum input impedence of (adc)- minimum output impedence of (sensor)- zener dynamic internal resistor range? << if that even existis that correct? i really got all these questions in my mind and i think i would im learning a lot by knowing their answers----------------------------------------------------------Quotethank you i will research about it..

author: ataradov
author_rank: Super Contributor
timestamp: May 24, 2018, 05:39:45 pm
content: You are protecting the MCU, so put the protection in front of the MCU. Ultimately it does not matter that much. It is just cleaner, IMO.Quote from: hsn93 on May 24, 2018, 07:54:26 amCorrect.