Protecting PIC24FV input pins from excessive voltage

Thread Starter

Robin66

Joined Jan 5, 2016
275
Hi Circuiteers.

I want to measure a low impedance voltage source using the ADC when the source is in the ~1V range. However it can also go up to ~50V so I need to protect the PIC. Would a ~100k resistor suffice? This would limit the current to ~0.5mA at 50V but will PIC24FV tolerate this? The datasheet specifies the limit in voltage space ie. Vdd+0.3V, rather than current space.

I'm not worried about a little imprecision due to the leakage current through the large resistor. The RC with the 30pF ADC input cap will be 3us, which is also ok for my application. I just want to avoid using a potential divider or a zener diode to gnd or a schottky to Vdd.
 

OBW0549

Joined Mar 2, 2015
3,566
Would a ~100k resistor suffice? This would limit the current to ~0.5mA at 50V but will PIC24FV tolerate this?
I have a difficult time believing the PIC24FV (or any other chip, for that matter) would be bothered by 500 μA of forced input current, unless the input pin lacks an internal overvoltage protection network. I should think you'd be safe.

I'm not worried about a little imprecision due to the leakage current through the large resistor. The RC with the 30pF ADC input cap will be 3us, which is also ok for my application.
One other factor to consider, is that driving the ADC from a 100 kΩ source impedance is going to make the input very susceptible to coupled interference. I don't know how noisy your PIC's environment is, but it's worth considering.
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
It specifies 1k as the recommended impedance for 12bit resolution. I'm using 10bit and accuracy isn't critical, but 100k may be pushing it a bit. I'm sure 10k would be fine, but then that'd be 5mA @ 50V which might then damage the input circuitry
 

OBW0549

Joined Mar 2, 2015
3,566
It specifies 1k as the recommended impedance for 12bit resolution. I'm using 10bit and accuracy isn't critical, but 100k may be pushing it a bit. I'm sure 10k would be fine, but then that'd be 5mA @ 50V which might then damage the input circuitry
The chip's data sheet should specify how much forced input current its various pins can handle safely, either in the chapter covering the ADC or in the Electrical Characteristics section.
 

Sensacell

Joined Jun 19, 2012
3,420
Use two 5k resistors in series with a diode clamp to Vdd in the middle.

Only 2 extra parts, most of the fault current will flow via the diode, not the input.
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
Use two 5k resistors in series with a diode clamp to Vdd in the middle.

Only 2 extra parts, most of the fault current will flow via the diode, not the input.
Yep I take your point. I need this for 3 inputs so it'll be 9 components in total and more complex board layout, but for noise immunity I think I'll have to take this approach
 

OBW0549

Joined Mar 2, 2015
3,566
yes I expected to find this but couldn't

http://ww1.microchip.com/downloads/en/DeviceDoc/39995d.pdf

Limits are described in voltage terms, Vdd+0.3V
I'm surprised they don't specify that. My instincts tell me that 5 mA should be safe, but they also tell me "be careful, this is approaching dangerous territory." Better to be safe than sorry.

Yep I take your point. I need this for 3 inputs so it'll be 9 components in total and more complex board layout, but for noise immunity I think I'll have to take this approach
The "two resistors + diode" scheme would be my preferred approach, too. (Whatever you do, don't be tempted into using a single resistor plus a 5.1V Zener diode between input pin and ground; low-voltage Zeners tend to have a soft "knee" and can conduct significantly well below their rated Zener voltage, leading to DC errors. I got bit by that, once.)
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
I'm surprised they don't specify that. My instincts tell me that 5 mA should be safe, but they also tell me "be careful, this is approaching dangerous territory." Better to be safe than sorry.
I've just had an epiphany. When I'm not measuring the input voltage I can config the pin as an output and set it low. 5mA is now not a problem at all. So I can protect my PIC inputs in software, keep the component count low, and just use a 10k resistor. Actually I could go down to 2k
 

OBW0549

Joined Mar 2, 2015
3,566
I've just had an epiphany. When I'm not measuring the input voltage I can config the pin as an output and set it low. 5mA is now not a problem at all. So I can protect my PIC inputs in software, keep the component count low, and just use a 10k resistor. Actually I could go down to 2k
But what if your input happens to be at 50V when you are measuring the input? I don't see how you're protected during the measurement period-- only when you're not measuring.
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
But what if your input happens to be at 50V when you are measuring the input? I don't see how you're protected during the measurement period-- only when you're not measuring.
I know that this won't happen. This is for a BLDC motor start up and I have some spare pins on my PIC and have some problems with low speed operation. I'm going to use 3 spare pins for low speed operation and then switch over to the existing potential dividers when the back emf is a few volts.
 

ErnieM

Joined Apr 24, 2011
8,377
Sorry I'm both late to the dance with in complete information but Microchip has an appointment note about using the ESD diodes as clamps and they specifically say do not do this for analog inputs.

Reason being the analog switching FETs get into strange modes of operation when you overdrive an analog input into the diode.

Sorry no link available from me.
 

dendad

Joined Feb 20, 2016
4,451
It is better to make so it Can't happen, rather than won't. Make your inputs as bullet proof as you can. Using software to protect things is really a shaky thing to do because most of the time you are trying to protect from software glitches. Like I did with a BLDC with software current limit. Quite a few blown boards later and I found the initialization was not written correctly so the 3 phase "H" bridges very briefly turned top and bottom on together. Now it has a hardware gross over current addition, and the software current limit for normal running.
A few extra bits is well worth it!

Yes, as above, if you overdrive the PIC's ESD diodes at the least it will bleed over to other channels and muck up the readings.
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
Thanks @ErnieM, I won't rely on the ESD diodes for clamps.

@dendad coincidentally I've just had similar issues with overcurrent scenarios. I ended up fixing the software bugs and adding a SMD fuse to avoid blowing the pcb tracks. How have you implemented hardware protection? Shutdown when the voltage across a 0.1ohm series resistor reaches a preset level?
 

dendad

Joined Feb 20, 2016
4,451
I used the second half of the current sense dual op amp as a comparator and had its o/p pulling the FET gate signals low via diodes. Not the best but worked as a retrofit. Added series resistors from the processor to the FET gates limited the processor port current. This was set higher that the normal operating current that is controlled by the dsPIC itself.
 
Top