Discussion:
[EE] Measuring current via a shunt, can it go below 0V?
Mario
2018-01-26 15:08:12 UTC
Permalink
Hello,
I'm playing with my SMPS step up (boost) design, where the controller is a PIC.

I thus have +12V power input, an inductor, a MOSFET, and a diode that charges a
high voltage capacitor, and a voltage divider before the diode, to monitor voltage
(via a first PIC ADC input) of the cap without actually discharging it continuously.

The gate of the MOSFET is connected to a +5V rail through a 1k resistor and I use
a PIC output in open drain configuration to ~quickly stop the MOSFET from conducting
(the opposite doesn't need to be ultrafast, as the SMPS will be always used in
discontinuos mode, thus current is zero whenever the MOSFET starts to conduct).
Switching frequency is pretty low.

While it's certainly not the most performant boost circuit, I like its simplicity
and low components count.

Now, I also need to monitor current (for which I have devoted a second ADC input),
and thus I have placed a shunt resistor between the source of the MOSFET and the
0V rail. I can be 100% sure that the voltage out of it will never exceed the PIC
ADC max input voltage, also due to insufficient input current from the power supply.
The shunt has also pretty low resistance so the voltage never reachs 0.5V (not much
resolution from the ADC, but enough to not want to add an OpAmp, as space on board
is very very limited).

Question is: should I put a series resistor between the PIC ADC input and the
shunt? Theoretically the voltage will never go below 0V and will never go above
0.5V (as explained above), but I fear some insidious aspects that maybe I haven't
been able to consider, maybe for some hard to grasp parasitic capacitance, etc..
could the shunt voltage go below 0V and thus fry my PIC ADC input pin unless I put
a series resistor? Is this series resistor necessary?

If it's totally useless, I don't want to put it, it's a matter of principle. :D

Thank you very much for augmenting my design knowledge and experience.

Kind regards,
Mario
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Brent Brown
2018-01-26 23:22:01 UTC
Permalink
Hi Mario,

I think my reply on PIC input protection will be relevant.

I'll just add that a simple diode across the shunt resistor can add a degree of
protection. A 1A or more silicon diode is relatively robust and cheap, and is a good
fit if the knee of the conduction curve is above your analog input range. If AC is
necessary, add another diode the other way. For higher voltages you might use
multiple diodes in series, but pretty soon a zener or TVS diode becomes a better
choice, then add series R to analog input and...
Post by Mario
Hello,
I'm playing with my SMPS step up (boost) design, where the controller is a PIC.
I thus have +12V power input, an inductor, a MOSFET, and a diode that charges a
high voltage capacitor, and a voltage divider before the diode, to monitor voltage
(via a first PIC ADC input) of the cap without actually discharging it continuously.
The gate of the MOSFET is connected to a +5V rail through a 1k resistor and I use
a PIC output in open drain configuration to ~quickly stop the MOSFET from conducting
(the opposite doesn't need to be ultrafast, as the SMPS will be always used in
discontinuos mode, thus current is zero whenever the MOSFET starts to conduct).
Switching frequency is pretty low.
While it's certainly not the most performant boost circuit, I like its simplicity
and low components count.
Now, I also need to monitor current (for which I have devoted a second ADC input),
and thus I have placed a shunt resistor between the source of the MOSFET and the
0V rail. I can be 100% sure that the voltage out of it will never exceed the PIC
ADC max input voltage, also due to insufficient input current from the power supply.
The shunt has also pretty low resistance so the voltage never reachs 0.5V (not much
resolution from the ADC, but enough to not want to add an OpAmp, as space on board
is very very limited).
Question is: should I put a series resistor between the PIC ADC input and the
shunt? Theoretically the voltage will never go below 0V and will never go above
0.5V (as explained above), but I fear some insidious aspects that maybe I haven't
been able to consider, maybe for some hard to grasp parasitic capacitance, etc..
could the shunt voltage go below 0V and thus fry my PIC ADC input pin unless I put
a series resistor? Is this series resistor necessary?
If it's totally useless, I don't want to put it, it's a matter of principle. :D
Thank you very much for augmenting my design knowledge and experience.
Kind regards,
Mario
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Mario
2018-01-27 16:41:32 UTC
Permalink
My question really wasn't about overloading a PIC input (I even specified it
won't happen, at least from the shunt normal operation) but if there could be
some "parasitic" or anyhow difficult to understand phenomena that will make
the shunt go negative. I'm thinking about overshoot, etc.. although theoretically
this should not happen.

Anybody that can elaborate on it please?
Post by Mario
Hello,
I'm playing with my SMPS step up (boost) design, where the controller is a PIC.
I thus have +12V power input, an inductor, a MOSFET, and a diode that charges a
high voltage capacitor, and a voltage divider before the diode, to
monitor voltage
(via a first PIC ADC input) of the cap without actually discharging it
continuously.
The gate of the MOSFET is connected to a +5V rail through a 1k
resistor and I use
a PIC output in open drain configuration to ~quickly stop the MOSFET
from conducting
(the opposite doesn't need to be ultrafast, as the SMPS will be always used in
discontinuos mode, thus current is zero whenever the MOSFET starts to conduct).
Switching frequency is pretty low.
While it's certainly not the most performant boost circuit, I like its
simplicity
and low components count.
Now, I also need to monitor current (for which I have devoted a second
ADC input),
and thus I have placed a shunt resistor between the source of the
MOSFET and the
0V rail. I can be 100% sure that the voltage out of it will never
exceed the PIC
ADC max input voltage, also due to insufficient input current from the
power supply.
The shunt has also pretty low resistance so the voltage never reachs
0.5V (not much
resolution from the ADC, but enough to not want to add an OpAmp, as
space on board
is very very limited).
Question is: should I put a series resistor between the PIC ADC input and the
shunt? Theoretically the voltage will never go below 0V and will never go above
0.5V (as explained above), but I fear some insidious aspects that
maybe I haven't
been able to consider, maybe for some hard to grasp parasitic
capacitance, etc..
could the shunt voltage go below 0V and thus fry my PIC ADC input pin
unless I put
a series resistor? Is this series resistor necessary?
If it's totally useless, I don't want to put it, it's a matter of principle. :D
Thank you very much for augmenting my design knowledge and experience.
Kind regards,
Mario
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Mario
2018-01-29 11:32:27 UTC
Permalink
Oh well, I found myself one case when the voltage at the shunt can go negative:
after the MOSFET is turned OFF and the zener stops conducting as well, the body
diode of the MOSFET (or the zener itself, depends if it's connected to the source
of the MOSFET instead of to the ground, and I prefer the former solution as it
lets me monitor current also during the decay phase) then there won't be anything
to absorb the (small) remaining energy of the coil, but the parasitic capacitance,
resistance, etc.. and the circuit will thus exhibit ringing, which can indeed go
negative, if the Q is high.

So, in answer to my own question, a resistor is really needed to protect the PIC
ADC input.

Cheers,
Mario
Post by Mario
My question really wasn't about overloading a PIC input (I even specified it
won't happen, at least from the shunt normal operation) but if there could be
some "parasitic" or anyhow difficult to understand phenomena that will make
the shunt go negative. I'm thinking about overshoot, etc.. although theoretically
this should not happen.
Anybody that can elaborate on it please?
Post by Mario
Hello,
I'm playing with my SMPS step up (boost) design, where the controller
is a PIC.
Post by Mario
I thus have +12V power input, an inductor, a MOSFET, and a diode that
charges a
Post by Mario
high voltage capacitor, and a voltage divider before the diode, to
monitor voltage
(via a first PIC ADC input) of the cap without actually discharging it
continuously.
The gate of the MOSFET is connected to a +5V rail through a 1k
resistor and I use
a PIC output in open drain configuration to ~quickly stop the MOSFET
from conducting
(the opposite doesn't need to be ultrafast, as the SMPS will be always used in
discontinuos mode, thus current is zero whenever the MOSFET starts to
conduct).
Post by Mario
Switching frequency is pretty low.
While it's certainly not the most performant boost circuit, I like its
simplicity
and low components count.
Now, I also need to monitor current (for which I have devoted a second
ADC input),
and thus I have placed a shunt resistor between the source of the
MOSFET and the
0V rail. I can be 100% sure that the voltage out of it will never
exceed the PIC
ADC max input voltage, also due to insufficient input current from the
power supply.
The shunt has also pretty low resistance so the voltage never reachs
0.5V (not much
resolution from the ADC, but enough to not want to add an OpAmp, as
space on board
is very very limited).
Question is: should I put a series resistor between the PIC ADC input and the
shunt? Theoretically the voltage will never go below 0V and will
never go above
Post by Mario
0.5V (as explained above), but I fear some insidious aspects that
maybe I haven't
been able to consider, maybe for some hard to grasp parasitic
capacitance, etc..
could the shunt voltage go below 0V and thus fry my PIC ADC input pin
unless I put
a series resistor? Is this series resistor necessary?
If it's totally useless, I don't want to put it, it's a matter of
principle. :D
Post by Mario
Thank you very much for augmenting my design knowledge and experience.
Kind regards,
Mario
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Loading...