Author Topic: MCU adc circuit protection  (Read 2325 times)

0 Members and 1 Guest are viewing this topic.

Offline hsn93Topic starter

  • Regular Contributor
  • *
  • Posts: 114
  • Country: bh
MCU adc circuit protection
« on: May 23, 2018, 08:00:42 am »
Hello, im having three questions

I'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 this



is 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 ?



Datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-D21-Family-Datasheet-DS40001882B.pdf
« Last Edit: May 23, 2018, 08:08:25 am by hsn93 »
-------------------------------------
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11234
  • Country: us
    • Personal site
Re: MCU adc circuit protection
« Reply #1 on: May 23, 2018, 03:02:44 pm »
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.
« Last Edit: May 23, 2018, 03:06:55 pm by ataradov »
Alex
 
The following users thanked this post: hsn93

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16604
  • Country: us
  • DavidH
Re: MCU adc circuit protection
« Reply #2 on: May 23, 2018, 08:00:12 pm »
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.

 
The following users thanked this post: hsn93

Offline JS

  • Frequent Contributor
  • **
  • Posts: 947
  • Country: ar
Re: MCU adc circuit protection
« Reply #3 on: May 23, 2018, 09:49:38 pm »
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
If I don't know how it works, I prefer not to turn it on.
 
The following users thanked this post: hsn93

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16604
  • Country: us
  • DavidH
Re: MCU adc circuit protection
« Reply #4 on: May 23, 2018, 10:29:25 pm »
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.
 

Offline JS

  • Frequent Contributor
  • **
  • Posts: 947
  • Country: ar
Re: MCU adc circuit protection
« Reply #5 on: May 23, 2018, 10:34:54 pm »
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
If I don't know how it works, I prefer not to turn it on.
 

Offline hsn93Topic starter

  • Regular Contributor
  • *
  • Posts: 114
  • Country: bh
Re: MCU adc circuit protection
« Reply #6 on: May 24, 2018, 07:54:26 am »
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 into

 
1. 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...

----------------------------------------------------------

Quote
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.

to 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?


----------------------------------------------------------

Quote
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.

would 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 exist  :-DD


is that correct? i really got all these questions in my mind and i think i would im learning a lot by knowing their answers


----------------------------------------------------------
Quote
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)

thank you i will research about it..
« Last Edit: May 24, 2018, 09:30:46 am by hsn93 »
-------------------------------------
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11234
  • Country: us
    • Personal site
Re: MCU adc circuit protection
« Reply #7 on: May 24, 2018, 05:39:45 pm »
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.

but i can see ASF framework have these options so it would be somthing like this:
Correct.

Alex
 
The following users thanked this post: hsn93


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf