Author Topic: Low Voltage Detection & Power Cut IC  (Read 9600 times)

0 Members and 3 Guests are viewing this topic.

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #25 on: September 02, 2019, 09:18:22 am »
N.B. a 2N7000 is *NOT* suitable unless  you run your supply to the sensor at >7V as its max. Vgs threshold voltage is 3V, so it wont reliably stay on with 5V on the gate and a 3.3V logic '1' signal on the channel, which only gives 1.7V Vgs.   You need one with a max threshold voltage <1.5V to guarantee a full logic '1' level at the sensor RX pin.  <1.8V  threshold will work with a possible slight reduction of the logic '1' level but still within spec.

I know BJT's well but not MOSFETS, so I'd like to clarify.  I can find parts with a "Vgs" spec as low as 2.5V and a "Vgs-thresh" spec as lows as 300mV, so am I right to assume that the "Vgs" spec is different than what you were talking about in that the "Vgs spec" is the absolute max voltage when measured across the Gate and Source?  Consider these 3 parts.

If the "Vgs spec" is the absolute max, then it would be prudent for me to choose the highest "Vgs spec" that can accommodate the lowest "Vgs-thresh" -- for example, these parts.

Lastly, I am seeing "Rds-ON" as high as 3.5-ohms in some of those parts I linked for you.  I would assume this should be a non-issue on light of my 9600bps data rate?

Many thanks.
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #26 on: September 02, 2019, 09:46:27 am »
If the power supply is 12..24V (and beefy enough) and you've got glitches in the 3.3V rail then that LM5008A regulator is not working as it should or you're pulling spikes of more than 350mA (isn't that its rated max current?).

Put a scope in the 3.3V rail, set the trigger to one shot, 2.8V falling edge and leave it there. If there's a glitch it'll catch it.
There is no glitching in the 3V rail, and currently on my bench test I am using a dedicated benchtop power supply set to 3.3V to ensure rock solid power.  But when I have been doing is creating my own glitch tests by yanking and reconnecting 3.3V power by hand to the board.  My PIC handles this fine, and while there is no damage to the sensor either, there are very rare occasions when it's memory gets wiped.  Imagine if you will someone who learns a dozen prints to this system and then finds them all erased one day!  Such is not insecure because I handle that in my PIC code, but being forced to re-learn all the prints again due to a glitch is something I must design around.  For that reason I contacted the manufacturer of the sensor and they told me that if the voltage dips to between 2.0v and 2.7v, then the memory could be wiped.  Clearly they were not talking about a "power off case," as such would drop the voltage to 0v (while passing through that 2.0v to 2.7v hazard land).  So I must assume they mean "if the voltage STAYS between 2.0v and 2.7v the memory will be wiped."  Regardless, they recommended I add a low voltage detection circuit that can kill power to the sensor completely, seeing I have no means to ground a RESET line on the sensor.  Add to that the fact I must put the sensor off my main board by 1.5m cable now, and you can see why I need to consider cutting wires and adding ESD protection, etc. as mentioned in my earlier post with schematic.

The fingerprints aren't normally deleted when I don't touch the 3.3v rail.  It's only when I deliberately introduce glitches by hand.
 

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #27 on: September 02, 2019, 10:00:07 am »
So if you have any new thoughts to share in light of this schematic, I am happy to hear them.

I'm going to respond in two parts.  The first is assuming you want to shut this down quickly once the voltage reaches a certain threshold:

This is how I would do it:

1) Use a P-channel Fet in the power line.   There are quite a few out there which will work.   The Advantage of a fet is that you're not going to get a lot of voltage drop.   I personally use a DMG2301L for these applications.   At 3.3V you should have less than 150mohm of resistance.   Tie this to a output pin on the PIC.   I'd recommend using a resistor from gate to source to keep the gate pulled high until your PIC pulls it low to turn on the device.

The 3.3V rail connects to S, the sensor connects to D, and the G connects to the output pin on the PIC, possibly through a gate resistor, although this is probably not required and will slow the transition down.   

2) On the PIC side, the PIC you selected has a comparator and a DAC and a FVR.    You can program the FVR to 1.024V, then connect the FVR output to the comparator (internal to the chip, not an external connection).     If you're concerned about the VCC of the PIC, you can use the DAC to divide it down and feed it into the other pin of the comparitor.    The output of the comparitor can then go to the FET I described above. 

If you are concerned about the VCC of the sensor itself, you can bring a sense wire back, maybe dividing it down and feed it into the PIC.  This way you can sense the voltage at the device.

The description above will automatically shut down power to the sensor.   It looks like the only other pin you have to worry about is TXD.   I'd set an interrupt on the comparator output as well, then in the ISR turn off the serial port and makes the pin goes either Tri-state or pull it down, whichever you feel is safest.   

There are other variations on this, but by just adding the Pchannel FET I described in the high side line and controlling the TXD line, you should be able to shut this down within a few microseconds.   If you're worried about sleep current, I think all of the above can run in sleep, and the comparitor input can wake the processor back up.    I haven't verified this last part with the datasheet on this exact part.

BUT..... The second part.

I'm confused why you're browning out at all.   I'd highly recommend what GeorgeOfTheJungle and others say...   You need to figure out why this is browning out, as you shouldn't have this happening at all.    One alternative might be to run 12V to near the sensor, and then step down to 3.3V there...   

If this is an issue with just poorly timed power-off (which might be the case), you might also want to consider adding a supercap or largish cap near the sensor, however this would interfere with the power shutoff I described above.

 
The following users thanked this post: JDW

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #28 on: September 02, 2019, 10:06:25 am »
There is no glitching in the 3V rail, and currently on my bench test I am using a dedicated benchtop power supply set to 3.3V to ensure rock solid power.  But when I have been doing is creating my own glitch tests by yanking and reconnecting 3.3V power by hand to the board.  My PIC handles this fine, and while there is no damage to the sensor either, there are very rare occasions when it's memory gets wiped. 

Are you absolutely certain that this isn't just a badly timed glitch?  I.E. while the sensor is for some reason writing to the flash?

Also, if you are manually connecting/disconnecting/connecting the 3.3V rail, you're probably causing all sorts of evil things on the rail just because a connection isn't instantaneous.    I can't tell if you mean physically yanking or being nicer.   
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #29 on: September 02, 2019, 10:12:22 am »
I'm confused why you're browning out at all.   I'd highly recommend what GeorgeOfTheJungle and others say...   You need to figure out why this is browning out, as you shouldn't have this happening at all.    One alternative might be to run 12V to near the sensor, and then step down to 3.3V there...   

If this is an issue with just poorly timed power-off (which might be the case), you might also want to consider adding a supercap or largish cap near the sensor, however this would interfere with the power shutoff I described above.

I mentioned that in my previous post.  As I mentioned in that post, there is no memory loss when I leave the 3.3V rail alone.  And even when I deliberately take the 3.3V output and tap it on/off to my breadboard, the memory is usually fine.  But on rare occasions doing that manual glitching of the 3.3v rail by hand will result in the sensor's flash memory being wiped.  The manufacturer told me two things about memory wiping:

1. It could happen if the voltage falls between 2.0v and 2.7v.
2. It could happen because there is code in the sensor (proprietary, they won't share details) that auto-wipes the memory if the sensor sensing it is being read.

#2 is as thick as mud, and it's hard for me to decipher it.  I asked if they could kill that code and give me a firmware update, but they said no.

But again, the memory only gets wiped rarely, and only when I am manually tapping the 3.3v power line into my board and yanking it out.  I want to simulate major voltage issues on the 3.3v line by doing that.  The chips survive it fine, it's just that the flash memory of the sensor (not my PIC, but the fingerprint sensor) gets wiped for reasons I've already mentioned.

Thank you for your other suggestions.  Using 3.3V goes against the advice of Ian M. who recommends I use 5.0v instead since I will have a 1.5m cable between my PIC board and the sensor, so I will need to ponder your suggestions along side his.

And no, it's not happening during a flash WRITE.  I know that.
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #30 on: September 02, 2019, 10:24:08 am »
This is what you want? https://electronics.stackexchange.com/questions/4967/circuit-to-protect-against-undervoltage

Quote
What is the simplest way to regulate the min DC voltage in a circuit? Is it possible to do with zener diodes?

Desired performance:

Input > 3.3 VDC     Output = Input
Input = 3.3 VDC     Output = Input
Input < 3.3 VDC     Output = 0.

I think you are suggesting that I kill power to everything including my PIC with that, but I cannot do that and here is why.

This fingerprint sensor will be used in a vehicle as a security device.  Think of it as an immobilizer.  If the fingerprint sensor dies or gets disconnected while PIC code is in Disarmed mode, the PIC must energize a normally-Open relay to allow engine starting (when it sees the CAN wake -- there's an analog wire in the car to detect this).  When the relay is not energized, the vehicle engine won't start.  The PIC controls that relay.  It won't kill the engine when it's already started.  It only prevents starting.  So if the power to the entire board goes down, the relay won't get energized and the vehicle cannot be started.  So I need to keep the PIC alive regardless of what happens to the sensor.  Of course, if the sensor dies while Armed, then it doesn't matter since Armed mode prevents starting anyway, and the fact the sensor is dead won't allow disarming, but for security reasons that is okay.

What I am doing is just trying to follow the fingerprint sensor manufacturer's advice in an attempt to eliminate any possibility of random fingerprint memory wipes.  And in my previous post, I mentioned the two things they told me that might cause an unexpected flash memory wipe (on the sensor side, not my PIC).

But like I said, this occurs rarely, and only when I manually glitch the 3.3V rail by hand.  I do that to simulate something bad going on in the car.  I need to know what will happen in that case.  And although my hardware survives it fine, sometimes the sensor memory gets wiped (rarely), and that is the main thing I am trying to resolve.  The second and SEPARATE matter is how to best cut power and protect the sensor over a 1.5m cable, which will have connectors and could get disconnected.  Conceivably, the wires could even get cut, which would induce a short.  ESD is also a concern.    So those are the 2 things I've been talking about:

1. Make sure the fingerprint sensor's voltage rail doesn't fall between 2.0v and 2.7V.
2. Make sure the PIC side and Sensor side are adequately protected in light of a 1.5m cable being used between them.

 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #31 on: September 02, 2019, 10:58:24 pm »
Ian.M,

 I would certainly appreciate your reply to the questions I asked you in Reply#27.

When it comes to MOSFETs, I’m still very much a student in learn mode.

Thank you.
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #32 on: September 03, 2019, 06:20:43 am »
I second the 5V supply option as best. You only need some resistors to interface the sensor's 3.3V UART to the 5V UART in the PIC.

While redesigning my switching power supply today for a 5.0V output, I began to wonder what the real advantage of using 5V is over using 3.3V if my Tx and Rx from the Fingerprint Sensor are sent across that 1.5m cable at a 3.3V voltage level.  The entire point of IanM.'s original suggestion to me of using 5V stemmed from the fact that there would be loses due to wire resistance and the connectors.  To keep the voltage at the fingerprint sensor's Vin as close to 3.3V as possible, IanM. suggested I use 5.0V power and then use an LDO (at the Fingerprint sensor board, not my PIC board) to drop Vcc to 3.3V.  But shouldn't that thinking apply to Tx and Rx lines too?  Tx & Rx are being sent across the same 1.5m length of cable, so any loss in voltage due to the cable would apply to Tx & Rx too.  But if I boost the Tx and Rx lines to 5v on the fingerprint sensor side, it's all getting a bit complex in a circuit I otherwise hoped to keep as simple as possible for the sake of board space and cost.

Therefore, I would appreciate hearing your thoughts on using 5V instead of 3.3V for Main power and Tx & Rx too.  If you think it's fine and dandy to keep Tx & Rx at 3.3V across that cable, then why not keep the main Voltage rail at 3.3V too?

Thanks.
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #33 on: September 03, 2019, 06:58:23 am »
A 1.5m long 3.3V power rail in a car doesn't sound like the best idea ever.

Do you say that because of noise that might be induced into the 1.5m long cable?  Or do you say that because of the possible voltage drop (which I doubt would be more than 100mV)?


That's why I'd prefer 5V. The sensor board's VIn accepts 3.3 .. 6V IIANM. TX and RX are ~ high impedance signals, you won't have much voltage drop there, if any.

Since I would need to add a 5v-to-3.3v LDO on the fingerprint sensor side, would it be preferred to do the same on the PIC side, using a 5v-to-3.3v LDO to power the PIC at 3.3V so that no conversion is required for Rx and Tx?  The reason I even ponder this is because the PIC will consume less current at 3.3V than 5.0V.

Thanks.
 

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #34 on: September 03, 2019, 07:07:41 am »
Therefore, I would appreciate hearing your thoughts on using 5V instead of 3.3V for Main power and Tx & Rx too.  If you think it's fine and dandy to keep Tx & Rx at 3.3V across that cable, then why not keep the main Voltage rail at 3.3V too?

The loss due to resistance in the wire is related to current.   E=I*R.   The higher the current, the higher the resistance, the more the voltage drop.

The current in a TX or RX line should be microamps typically, and the voltage drop on those lines shouldn't be easy to measure.   Even with a large resistance.

The current in the power line is going to be much higher, several orders of magnitude.  Possibly in short brief "surges"....

If the voltage normally at the sensor board is very close to 3.3V under normal operations, but you see brief spikes being lower, the simple solution is to add capacitance to the sensor board so that the capacitors provide the power during the demand surges causing the spikes.   I'd only consider moving to 5V if your average voltage at the board is too low due to voltage drop.

You also mentioned that the units will self-erase if they think you're trying to read out the data.   One of the common ways that people try to read out the data is to introduce a power glitch.   Google "power glitch attack".   

I think what is likely happening here is that the firmware on the device is detecting the power is rapidly glitching and is assuming an attack is in progress and is wiping the data in defense.   

If this is the case, then the solution should be fairly simple:

1) Add enough capacitance to the sensor board such that you never have a power droop under normal use.   Don't over do it, but make sure that it is sufficient and then some.   You may already have enough on the board.  You can figure this out with an oscilloscope monitoring the rail on the board during normal operation.

2) Introduce the circuit I described in to the PIC, and then program the PIC in such a way that if a glitch occurs, it powers off the device, and leaves it off for some reasonable amount of time has passed.   The PIC can also be set up to only power on the device after power is good for a certain amount of time, which will avoid a certain additional class of power-on glitches on the 3.3V rail.

You'll need to characterize or find out how long the rail should be off to prevent this from occuring.

 
The following users thanked this post: JDW

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #35 on: September 03, 2019, 07:30:21 am »
Thank you for your other suggestions.  Using 3.3V goes against the advice of Ian M. who recommends I use 5.0v instead since I will have a 1.5m cable between my PIC board and the sensor, so I will need to ponder your suggestions along side his.

Let's do some quick math:

Assuming 100mA @ 3.3V:

1.5m cable, let's assume it's 24AWG (tiny).  Looking up the ohms per foot, and calculating the resistance of this amount of wire, you find that the resistance is 0.128\$\Omega\$.

At 100mA, 0.128 Ohms.   E=IR.  0.1A times 0.128\$\Omega\$ = Voltage drop is then 0.0128V.   Yes, 1 hundredth of a volt.  You need to double it since it's a round trip thing, so I'll say 0.025V.

Let's assume it's 1A.   Then it's 1A * 0.128\$\Omega\$ , or 0.128V.   Or 0.25V. 

You're not going to get enough voltage drop over 1.5M of cable, assuming any reasonable wire gauge and any reasonable current, to matter.      If your current is closer to 1A than 0.1A then you'll just need a bit larger cable.   

If the device is normally 0.1A, with brief surges to 1A, that's where capacitance at the end of the cable comes in.  It averages the peak out.

Now, there are other reasons why 3.3V might not be a good idea, but that's more about signal integrity.   A car can be an electrically noisy environment, although the newest cars are much quieter than the old ones were mainly because of how many electronics are used in cars.   I'm not sure moving to 5V is going to gain you a lot in this department.   Depending on the specifics of the situation, a good shielded cable will likely be more useful.   If you find you have communication problems, then sometimes moving to a more robust signalling method can help, but that would probably mean moving to RS-422 or similar on both ends of the wire.

 
The following users thanked this post: JDW

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #36 on: September 03, 2019, 07:53:40 am »
The loss due to resistance in the wire is related to current.   E=I*R...  If the voltage normally at the sensor board is very close to 3.3V under normal operations, but you see brief spikes being lower, the simple solution is to add capacitance to the sensor board so that the capacitors provide the power during the demand surges causing the spikes.   I'd only consider moving to 5V if your average voltage at the board is too low due to voltage drop.... Add enough capacitance to the sensor board such that you never have a power droop under normal use.   Don't over do it, but make sure that it is sufficient and then some.   You may already have enough on the board.

I know what the wire resistance will be for the 1.5m cable, although contact resistance of the connectors at either end (which IanM. was considering) is something I have not considered yet.  But thank you for indicating that use of 3.3V isn't altogether a bad idea.  I like the 5V idea, but it adds a heck of a lot of complexity, cost and board space to the design.

The fingerprint sensor draws less than 200uA when sleeping, 48mA when awake but its LED off, and 76mA when it's awake with LED lit.  The datasheet says current could spike up to 130mA, but that would but the limit and only for short durations.  In my own measurements using a Fluke 8845A benchtop meter I don't see current spikes above 80mA.

I've measured the input capacitance at the Fingerprint sensor.  There are several ceramic caps in parallel, all yielding a mere 12uF total, which certainly isn't enough.

Using a shielded cable would be a good idea, but I also need to consider ease of mounting which a flat, thin cable would provide.  The wires should probably be 22AWG for the sake of durability, and certainly no thinner than 24AWG.  Adding a shield would make the cable thicker, which means it could not fit nicely in between panel plastics like a thinner cable.

2) Introduce the circuit I described in to the PIC, and then program the PIC in such a way that if a glitch occurs, it powers off the device, and leaves it off for some reasonable amount of time has passed.   The PIC can also be set up to only power on the device after power is good for a certain amount of time, which will avoid a certain additional class of power-on glitches on the 3.3V rail.

I fully understand that my PIC has a Comparator, DAC and Vref=1.024v (which is stable for Vdd 2.5V and higher).  (My PIC also has internal Brown-out LO enabled, which keeps the PIC in RESET when Vdd falls below 2.35v~2.58v.) While I could indeed use an interrupt in conjunction with the Vref and Comparator, the fact is that I sometimes write to the high-endurance flash inside the PIC which takes 2.5ms-max during which time interrupts must be disabled.  That 2.5ms is probably short enough not to pose a problem, but using the TLV3012 GeorgeOfTheJungle proposed along with two 1% voltage-divider resistors and a P-MOSFET (DMG2301L, which you proposed) would be a bullet-proof external solution that would be faster than using the PIC.

So if I set aside the 5V idea and stick with 3.3V, I would need the following:

Low-voltage detection and power cut for external fingerprint sensor using TLV3012, DMG2301L, R1=1M-ohm(1%), R2=820k-ohm(1%) -- yielding a nominal trigger threshold of 2.76v and a worst-case threshold (1% resistor tolerance considered) of 2.73v, which is higher than the 2.70v mentioned by the sensor manufacturer.  My PIC can monitor the output of the op-amp in the TLV3012 to know which power to the fingerprint sensor is being switched OFF or ON.
Add capacitance on Fingerprint sensor side (to be decided).
Add ESD protection ICs, one IC for each side of the cable, for Rx & Tx.  (I would assume this is prudent.)
Additional short-circuit protection for possible cases where Vdd gets shorted to ground? (Could occur if someone took a pair of scissors and cut through the cable.)
Use N-MOSFETs to cut Rx & Tx at the same time Power is cut to the fingerprint sensor, as per IanM.  But I am still not clear on Vgs vs Vgs-thresh, so if anyone reading this could kindly steer my feeble brain in the right direction, I would appreciate it.  Toward that end, here is the content of Reply#27 which never got a response from anyone...

N.B. a 2N7000 is *NOT* suitable unless  you run your supply to the sensor at >7V as its max. Vgs threshold voltage is 3V, so it wont reliably stay on with 5V on the gate and a 3.3V logic '1' signal on the channel, which only gives 1.7V Vgs.   You need one with a max threshold voltage <1.5V to guarantee a full logic '1' level at the sensor RX pin.  <1.8V  threshold will work with a possible slight reduction of the logic '1' level but still within spec.

I know BJT's well but not MOSFETS, so I'd like to clarify.  I can find parts with a "Vgs" spec as low as 2.5V and a "Vgs-thresh" spec as lows as 300mV, so am I right to assume that the "Vgs" spec is different than what you were talking about in that the "Vgs spec" is the absolute max voltage when measured across the Gate and Source?  Consider these 3 parts.

If the "Vgs spec" is the absolute max, then it would be prudent for me to choose the highest "Vgs spec" that can accommodate the lowest "Vgs-thresh" -- for example, these parts.

Lastly, I am seeing "Rds-ON" as high as 3.5-ohms in some of those parts I linked for you.  I would assume this should be a non-issue on light of my 9600bps data rate?
« Last Edit: September 03, 2019, 07:56:43 am by JDW »
 

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #37 on: September 03, 2019, 10:06:03 am »
I fully understand that my PIC has a Comparator, DAC and Vref=1.024v (which is stable for Vdd 2.5V and higher).  (My PIC also has internal Brown-out LO enabled, which keeps the PIC in RESET when Vdd falls below 2.35v~2.58v.) While I could indeed use an interrupt in conjunction with the Vref and Comparator, the fact is that I sometimes write to the high-endurance flash inside the PIC which takes 2.5ms-max during which time interrupts must be disabled.  That 2.5ms is probably short enough not to pose a problem, but using the TLV3012 GeorgeOfTheJungle proposed along with two 1% voltage-divider resistors and a P-MOSFET (DMG2301L, which you proposed) would be a bullet-proof external solution that would be faster than using the PIC.

I think what you might be missing is that the Comparator is able to expose all of it's pins to the external world, and doesn't rely on the PIC CPU to operate.  It will operate whether interrupts are enabled or not.    So you effectively have a TLV3012 inside.  No need for an external part to get exactly the same functionality.

At initial power on, the PIC's comparator wouldn't be configured to be connected to the FET.   So the unit would stay off until ready.

Once your PIC has started, you enable the 1.024v reference, enable the comparator, and assign pins.  At this point forward the comparator works just like a TLV3012.   You use the same divider 1M and 820K, hooked up to the comparator input pin.   The output pin is just like the TLV3012 and hooked to the FET.   Once set up, it's just as fast as the TLV3012 (well, that's not true, the one in the PIC responds in 0.8uS max, vs the 12uS of the TLV3012 so the PIC is actually a lot faster).

The main advantage of this (other than the part savings) is that you can gain some software control as well.  If you find you have a glitching power supply on startup, you can then delay the power on for the device.   You can also force minimum off times after a drop.   

I also notice that the comparator can be configured in software to add some hysteresis which will prevent 'chattering' near the threshold.   I.E. once it shuts off, the voltage on the reference pin has to rise to 1.224V before the unit comes on automatically.   With a normal comparator, you'll find you have glitches as the voltage crosses the threshold unless you add feedback circuitry, this avoids that hassle.

The interrupt I suggested only comes into play if you also want to turn off the TX pin to avoid currents through the TX pin powering the remote device, which is a definite possibility.  Which you're already aware of:

Use N-MOSFETs to cut Rx & Tx at the same time Power is cut to the fingerprint sensor, as per IanM.  But I am still not clear on Vgs vs Vgs-thresh, so if anyone reading this could kindly steer my feeble brain in the right direction, I would appreciate it.  Toward that end, here is the content of Reply#27 which never got a response from anyone...

You probably don't need to cut the sensor TX/PIC RX line.   You're concerned about power from the PIC TX line being fed into an off sensor, and it powering up the device, not the other way around.

The software interrupt would probably work really well, well except when it is too slow.   Other options:

1) Use a NPN transistor with the base fed from the pic TX line with an appropriate series resistor, the emitter to ground, and a pullup from the collector to the switched Vcc for the sensor.   The size of the  pullup resistor combined with the cable capacitance will determine the maximum baud rate (smaller=faster).     You'll also need to set the pic to invert the TX line so the inversion done by the transistor is undone.    I've done this numerous times and it works well depending on the baud rate.   I think I'm running a 10K resistor at 19,200 with much worse cables than you have.   Note that since serial idles high, generally this isn't going to consume any meaningful current until there is data on the line.    You'll also want to make sure that the Vce(sat) is low enough to end up with a voltage below VIL on the sensor (the low voltage threshold) since the transistor can't pull the line down below Vce(sat). 

2) Replace the NPN transistor with a N channel fet.  This would avoid the potential Vce(sat) issue, but only with a correct FET selection (see below).  The Rds(on) will need to be low enough such that the voltage divider created by the pullup resistor and Rds(on) doesn't introduce the same VIL issue.

3) Use a tri-state buffer gate.   These are available around ten cents US in reasonable quantities.   After some digging, I found the SN74LVC1G240 which has a active-low output enable which matches the polarity of the output of the comparator when driving a P-Channel FET.   There are also active-high output enables.     You'd power these from the same VCC as the PIC, and then tie the OE pin to either the output of the comparator, or the switched HV rail depending on the OE polarity.    This would effectively turn off the TX pin when the power goes off.    Note that the SN74LVC1G240 I mentioned has an inverting gate, so you'd need to invert the TX pin on the PIC like the above solution.   Some of the others don't invert, but the ones I found don't have an active-low OE pin, and I think I'd want to tie this to the output of the comparator so that this pin shuts off as quickly as possible instead of starting after the PCH fet turns off.

4) A probably non-option:  Use a fet as a 'true switch' in the dataline.   I can't get my head around how this would work reliably in the signal line without a lot more circuitry.  I'll explain below.

But first to help you with the FET questions:

If you look at Figure 2 in the 2n7000 datasheet at https://www.onsemi.com/pub/Collateral/2N7000-D.PDF, you'll find a chart which shows the drain current at a certain gate voltage.

If you look at this chart, you will find that in order to reliably get 200mA through the device you'll need at least 4V of Vgs, which is the voltage between gate and source.     This is more than 3.3V.   If you look at 3V, you'll find that the mA is pretty close to zero...  so it really isn't all that functional at 3V.   Vgs(th) is the point where the fet is just starting to turn on, not the point where it is fully on.

Compare figure 2 at the DMG2310L datasheet at https://www.diodes.com/assets/Datasheets/DMG2301L.pdf .  Note at 3V you can actually push 10A through it.   The Vgs(th) of this part is down around 1V, and you'll note that the Id at this level is also close to zero.

Another chart of interest in the DMG datasheet is figure 4.  This is Vgs voltage vs on-resistance.   You'll notice that the resistance doesn't really start dropping until somewhere just below 2V.  At 3V, it's pretty close to as good as it can get, and any additional voltage isn't really all that helpful.   So this Fet is really useful only above 2V with 3V or over being ideal.

In option #2 above, I said that you'd need a N channel FET.  I just did a quick search, it looks like a FDV301 would probably work - in fact the Fairchild datasheet shows this very application.   There are others, that's just the first one I found.   I typically don't use N channel fets since I'd typically need a higher Vds, and at the voltages I use, NPNs are much more widely available and less expensive.

A quick hint:   The spec which is usually listed in the part summary which will quickly tell you if you should look further is a line which will be something like:

Rds(on) = 5\$\Omega\$ @ Vgs = 2.7V.

This says the transistor will have a resistance of 5 ohms at 2.7V.   If you don't see a reasonable value below the voltage of operation, look on.

One other note before I move on:   There is one area where Vgs(th) is important - that is to turn *off* the device.   If you have a very very very low Vgs(th) being driven by something which can't get Vgs lower than the number shown, you won't be able to turn off the device.

There are other interesting characteristics, but those are probably the biggest ones to watch for.

Now, back to option #4:

So, let's assume you put a fet in the data line as a switch.  I.E.  you break your dataline, and insert the fet into the dataline with G and D attached to the two sides of the 'break'.    With a N channel FET, to turn the FET on you would have to raise the gate above the voltage S terminal by the voltage described above.    So in your 3.3V data line, you'd need something like 7 volts on the Gate terminal to turn on the data line when the data line is high (since you start with 3.3V, then need 3V more or so).

With a P channel FET, you need to have the gate voltage below the S terminal by the appropriate voltage described above.  This is why the specs in a P-channel datasheet are almost all negative.   So for high voltages on your data line @ 3.3V, this is easy, you just yank the gate to zero and you get -3.3V.  But now, what about low...   Well, at 0V on the data line, your 0V gate voltage isn't going to be low enough to turn the FET on, which will result in a floating dataline.   To fix this you'd have to have the gate voltage be below zero.

I'm sure there might be tricks to make this work with a FET inline as a switch, without a lot of level shifting of the Gate, etc., but I find options 1,2, and 3 above to be a lot more straightforward.
 
The following users thanked this post: JDW

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #38 on: September 03, 2019, 10:12:59 am »
If the voltage regulator on the board is a switching one, the figures @5V should be about the same. If it's an LDO they'll worsen and won't be any advantage in moving to 5V.

The Fingerprint sensor board has a Holtek 5301 LDO that outputs 3.0V to power the ARM processor and Winbond Flash chip:

https://www.eevblog.com/forum/projects/low-voltage-detection-power-cut-ic/?action=dlattach;attach=820047;image

Thank you for the capacitor calculations.  I found those details very helpful.

I think what you might be missing is that the Comparator is able to expose all of it's pins to the external world, and doesn't rely on the PIC CPU to operate.  It will operate whether interrupts are enabled or not.    So you effectively have a TLV3012 inside...

Oh, my...  You're right.  Beautiful observation!

I am humbled by the time spent on the rest of your amazing post.  I need time for my fleshly CPU to process it all.  :-)  But you have put me squarely on the right track.  I will proceed with my original plan to use 3.3V across the cable.

THANK YOU!
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: Low Voltage Detection & Power Cut IC
« Reply #39 on: September 03, 2019, 11:06:09 am »
Re: O.P's reply #27

The problem with component distributor parametric searches is usually they employ web developers to build them who don't have even half a clue about hands-on electronics, and the result is signed off on by a MBA who's probably never picked up a hot soldering iron.   For most device parameters, for them to be meaningful you need to store both a minimum and a maximum value.  Exceptions are specific maximum limit parameters which don't have a meaningful minimum.

e.g for a BJT, for its large signal gain hFE, lets say 100 to 400, the database would need a field for each limit.  OTOH for IC(max), you only have a single value, lets say 600mA.

Therefore if the parametric search doesn't offer you two columns min. and max. for all such parameters and let you make multiple (and ranged) selections in each its borked and once you've got some possibles, you'll have to do a lot of extra work checking datasheets to confirm the actual limits are suitable.

It looks like Mouser's MOSFET 'Vgs - Gate-Source Voltage' parameter is just a nominal working voltage, i.e. the device will turn on in a usable fashion with that much voltage on the gate (relative to the source).   It isn't the max voltage you can put on the gate without risking device destruction by gate oxide breakdown, it isn't the threshold voltage (which they have as a separate parameter, but don't have separate min. and max. limit columns for), and certainly isn't the gate voltage needed to pass a particular current.  If you select 5V and 4.5V for Vgs, you'll get *MOST* of their 5V logic level drive capable MOSFETS, but that's no help whatsoever if you need 3.3V drive capable ones.  To find them follow my Vcc/2 rule of thumb and look for Vgs_th in the range 1.65V to 1V: https://mou.sr/32tazAp  You don't want too low a minimum as you don't want to risk the MOSFET turning on with a little stray voltage on the gate.  You will have to check datasheets before ordering to confirm parameter limits.

Most regular MOSFETs have an abs. max. Vgs rating (gate oxide breakdown safety limit) of around 20V.  Some low voltage MOSFETs have a abs. max. Vgs rating of only 8V.   Typical gate drive (Vgs) in practical applications is often between 50% and 75% of the abs. max Vgs rating.

For the sensor RX line cutoff circuit I proposed, with the gate tied to 5V, Vgs would be 1.7V with a logic '1' on the line.  For the MOSFET to stay on, max. Vgs(threshold) would need to be <1.7V  You only get away with working right down to the threshold voltage because a CMOS logic input draws negligible current.  If you have  3.3V sensor Vcc, andyou want to use the MOSFET to block voltage on sensor RX when off,  it isn't going to work without a pullup and will need a very low threshold MOSFET, certainly below 2V and preferably below 1V so it isn't relying on the pullup to 3.3V for the majority of the risetime.

I *REALLY* don't recommend that.  Better to bite the bullet, pay the extra and add a 74LVC1T45 buffer in the sensor RX line with VCCB from before your sensor power switch P-MOSFET, VCCA from after it and DIR tied to Gnd to make it one way , B(in) to A(out), to guarantee there's no current into sensor RX with the sensor Vcc off.

N.B. if you add two extra wires to the sensor cable to bring far end Vcc and far end Gnd back to the main unit, and use a regulator with enable and a feedback pin for the sensor Vcc supply in the base unit, you can remote regulate it to 3.3V AT THE SENSOR , and put everything required for the sensor interface with power monitoring and switching, including the sensor Vcc monitoring, except for the sensor ESD protection and extra bulk decoupling cap decoupling cap, in the main unit.   There are a couple of other tricks to it needed for reliability e.g. at the main unit end fit a silicon diode between Vcc out and Vcc feedback so it doesn't blow the sensor with gross overvoltage if the feedback wire comes loose, and a few hundred ohms resistor between  Gnd out and Gnd feedback for the same reason.
« Last Edit: September 03, 2019, 11:16:48 am by Ian.M »
 

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #40 on: September 03, 2019, 12:00:23 pm »

I think what you might be missing is that the Comparator is able to expose all of it's pins to the external world, and doesn't rely on the PIC CPU to operate.  It will operate whether interrupts are enabled or not.    So you effectively have a TLV3012 inside...

Oh, my...  You're right.  Beautiful observation!

The 8 bit PICs are going toward "Core Independent Peripherals", where you are able to do a lot of things without involving the processor.    For instance, I just realized that I missed one more thing about the PIC you selected which would be useful for your application, it was on the second page so I didn't realize this had it...

This has 4 copies the CLC peripheral.  Which you can configure in many ways including a set/reset latch.    If instead of "wiring" the output of the comparator directly to the FET you instead configure it to first go through a CLC peripheral set up as a set/reset latch (internal to the chip), you can then configure the CLC+comparator such that if the voltage drops out, the latch gets set (or reset, whichever is more convienient).   This would immediately turn off the FET (which is hooked to the output of the CLC now).  Then it won't re-start without you (through software) resetting the latch.   So you could enforce a minimum off-time after a brownout.   Again, this is without processor control.

You can also set the UART TX_out to go through CLC #3.  As a result, you can set up CLC3 as a simple AND gate which will AND the TX_out and the status of the 'power control' CLC such that output of CLC3 acts as your normal TX pin from your UART when the power is on to the sensor, or forced low always when the power is off.   This eliminates all of the issues with the TX pin as well since 'forced low' is the same as 'off' as far as powering the far end accidentally goes.   And again, without processor involvement.

So the builtin stuff in the PIC, without using any CPU other than to set things up (and possibly reset it if it browns out) can eliminate both the external comparator and all of the stuff related to disconnecting the TX pin.

BTW the CLC is pretty easy to configure using the built-in tool in MCC.    There are online tutorials as well.

One other thing:    Step 12 on the DAC is pretty close to the threshold you were looking at for the comparator input.  2.73/32*12 =1.023V.  So, if you use the DAC as the divider instead of the external resistors, you can eliminate those as well.     If you run the FVR at 2.048V instead, you can then use step 24.  2.73/32*24 = 2.047.   Step 25 would end up being 2.62, and Step 22 would end up being 2.979 as a threshold.     You can pull the DAC reference from either Vcc or from the external Vref pin, which could be used as a remote sense if you have a spare cable pin to hook Vref up to the far end's Vcc (assuming you're not otherwise using Vref).   I haven't done tolerances, etc. on these so they might need to be adjusted.


 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #41 on: September 04, 2019, 07:57:04 am »
...the Comparator is able to expose all of it's pins to the external world, and doesn't rely on the PIC CPU to operate.  It will operate whether interrupts are enabled or not.    So you effectively have a TLV3012 inside.  No need for an external part to get exactly the same functionality.

At initial power on, the PIC's comparator wouldn't be configured to be connected to the FET.   So the unit would stay off until ready.

Once your PIC has started, you enable the 1.024v reference, enable the comparator, and assign pins.  At this point forward the comparator works just like a TLV3012.   You use the same divider 1M and 820K, hooked up to the comparator input pin.   The output pin is just like the TLV3012 and hooked to the FET.   Once set up, it's just as fast as the TLV3012 (well, that's not true, the one in the PIC responds in 0.8uS max, vs the 12uS of the TLV3012 so the PIC is actually a lot faster).

The main advantage of this (other than the part savings) is that you can gain some software control as well.  If you find you have a glitching power supply on startup, you can then delay the power on for the device.   You can also force minimum off times after a drop.   

I also notice that the comparator can be configured in software to add some hysteresis which will prevent 'chattering' near the threshold.   I.E. once it shuts off, the voltage on the reference pin has to rise to 1.224V before the unit comes on automatically.   With a normal comparator, you'll find you have glitches as the voltage crosses the threshold unless you add feedback circuitry, this avoids that hassle.

Once again, thank you for the advice.  I finished a preliminary test with my dual-resistor voltage divider on C1IN3- (RC3, Pin-7) and comparator output on C1OUT (RA2, pin 17). I needed to decrease the 820k to put the trigger threshold closer to 2.8v, ending up with a 1M-ohm and 560k-ohm divider (1% tolerance). 

The PIC's onboard comparator isn't quite the same as an external device like the TLV3012 insofar as BOREN (the PIC's built-in brown-out RESET) shuts down the comparator when the PIC's Vcc drops too low.  But with BOREN set to the LOW threshold, the PIC won't reset until about 2.44V (typical) which is lower than the Comparator's threshold of about 2.8V, so the Comparator will work without BOR interfering.

The problem is that even with Hysteresis enabled, there's still chattering like mad.  It's far worse with Hysteresis disabled -- I tested that case too.  But it's still bad with it enabled, as shown in the video I made here (turn up the volume to hear my audio commentary):

https://youtu.be/cVNaPSZ4-eA

I would appreciate hearing your thoughts in light of what you see in my video.

NOTE: IanM., I thank you for your reply.
 

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #42 on: September 04, 2019, 10:03:21 am »
That's line noise, it's flipping @60Hz.

If you watch my video closely as I move the voltage both up and down, you will see chatter at many different frequencies, not just 60Hz.

The point here is that if I use a P-MOSFET activated by the Comparator's output -- which moves up and down exactly as you see on my scope -- the sensor will power up and down accordingly, thereby triggering its software security measure which deliberately wipes all saved fingerprints from its Flash memory chip. 

The entire point of even checking voltage is to ensure the sensor's Vin doesn't fall between 2.0v and 2.7v.  So a chattering solution isn't a good solution at all, I'm sure you will agree.  So what I am trying to figure out is if there is a way to eliminate this chatter to have a clean break.  When the voltage falls below the threshold, we get a solid HI.  And when the voltage rises back, we get a solid LO.  We should get those states without the chatter.
 

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #43 on: September 04, 2019, 10:09:39 am »
The point here is that if I use a P-MOSFET activated by the Comparator's output -- which moves up and down exactly as you see on my scope -- the sensor will power up and down accordingly, thereby triggering its software security measure which deliberately wipes all saved fingerprints from its Flash memory chip. 

The entire point of even checking voltage is to ensure the sensor's Vin doesn't fall between 2.0v and 2.7v.  So a chattering solution isn't a good solution at all, I'm sure you will agree.  So what I am trying to figure out is if there is a way to eliminate this chatter to have a clean break.  When the voltage falls below the threshold, we get a solid HI.  And when the voltage rises back, we get a solid LO.  We should get those states without the chatter.

See my second reply last night.

Adding a CLC as I described with Set/reset will solve your problem.   The first trigger of the comparator will turn off the power until you turn it back on, eliminating chatter.   How you determine when you turn it on is up to you.   A timeout might make sense.   Combining it with monitoring the output of the comparator separate from the CLC might be useful as well (i.e. if you go through the loop for a certain number of cycles without seeing the comparator toggle then you assume power is stable).   You could also do this last part with a CCP peripheral where you get a timestamp of when the comparator toggled last.
 
The following users thanked this post: JDW

Offline forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Low Voltage Detection & Power Cut IC
« Reply #44 on: September 04, 2019, 10:13:24 am »
Once again, thank you for the advice.  I finished a preliminary test with my dual-resistor voltage divider on C1IN3- (RC3, Pin-7) and comparator output on C1OUT (RA2, pin 17). I needed to decrease the 820k to put the trigger threshold closer to 2.8v, ending up with a 1M-ohm and 560k-ohm divider (1% tolerance). 

Try dropping the divider down by a couple decades.   10K and 5.6K.  You may find you have to re-adjust the divider.
 
The following users thanked this post: JDW

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: Low Voltage Detection & Power Cut IC
« Reply #45 on: September 04, 2019, 10:34:34 am »
I did recommend a screened cable many posts back.   Nobody wants a car you cant start if you parked under a power line or too close to a high power radio transmitting station.

However it does seem over-sensitive to ambient EMI.  What's the actual circuit, both schematic and photos of the layout, zoomed in on the board, and also zoomed right out showing how the leads to all your test gear are routed. 

Also what's your bench lighting?  If its low voltage please give specific details of its transformer or PSU.  It's quite common nowadays for cheaper lighting (and some badly designed expensive stuff) to radiate excessive EMI.   The only types of lighting (apart from actual flames, chemlights etc.) that you can be reasonably confident *WONT* radiate EMI, is non-dimmed incandescents (but not low voltage with a switching PSU), fluorescents with line frequency magnetic ballasts and low voltage DC LEDs with a linear power supply (or battery) and linear LED current control.  Unfortunately incandescents are being phased out in many countries and magnetic ballasts for fluorescents are becoming difficult to find.  If you've got low EMI bench lighting don't throw it out if you upgrade to modern lighting, as you may need to go back to it when testing sensitive circuits!

1Meg||560K=359K, which is quite a high impedance and may be making it excessively sensitive to noise.  As Forrestc just suggested, try reducing the resistor values an order of magnitude or two.  You may well need an external feedback resistor to get enough hysteresis.

Forestc has pointed out how the PIC's various peripheral modules can be used to help de-glitch the sensor low voltage lockout signal.  However IMHO its important to first get the signal as clean as possible, otherwise you risk designing a circuit that works on the bench, but is the weak link, failing in the field due to localised high EMI, that is not strong enough to disable an unmodified vehicle.
« Last Edit: September 05, 2019, 02:15:48 am by Ian.M »
 
The following users thanked this post: JDW

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #46 on: September 05, 2019, 12:36:31 am »
IanM. & forrestc,

My humble and sincere thanks for kind help and advice you gentlemen are providing.  I made a new video this morning showing my room lighting for Ian.  The same video shows the result of using a smaller 10k & 5.6k resistor divider (with PIC Hysteresis ON):

https://youtu.be/5Xk1dtJ5m4Y

Circuit is on a breadboard using discrete components because it's still in the early design stage.

I am now about to try the CLC suggestion to see if I can program my PIC satisfactorily to address the chatter, ensuring that the fingerprint sensor is never toggled ON & OFF repeatedly by a slow decrease in voltage across the chattering voltage range.  I will report back on that after I've coded and tested.

Thanks.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: Low Voltage Detection & Power Cut IC
« Reply #47 on: September 05, 2019, 02:55:46 am »
Your circular fluorescent probably has a magnetic ballast and therefore would be low EMI.  The give-away clue is the presence of a gas discharge/bimetallic strip starter, as they are usually associated with magnetic ballasts as most electronic ballasts have integrated starter circuits.  I haven't got a clue whether or not the fluorescent strip lighting has HF electronic ballasts.  If it has the characteristic flickering startup of a gas discharge/bimetallic strip starter, (or you can find one on each strip), probably not.   Otherwise check the label and see if you can Google its specs.  Most manufacturers are proud enough of their energy efficient electronic ballasts to boast of them in the specs.

Still no photo of your breadboard or of the experiment setup on your bench.  >:(  Without seeing the actual circuit its very difficult to comment usefully on noise issues.

From the soundtrack of your video I get the impression you have two DMMs with long UNSHIELDED leads connected direct to your PIC's comparator pins.   Those leads will be acting as antennae and picking up EMI and taking it right to where you don't want it.  Try isolating the meter leads from the pins with 100K resistors (which will only cause a 1% readout error on a 10Meg input impedance DMM), and at the meter end of the resistor adding 100nF to ground to reduce any EMI the leads picked up.  Also, reduce the loop area available to pick up H-field EMI by twisting the leads together - 5 to 10 turns per meter is plenty, it just needs to keep the positive and negative leads together for as much of their length as is practical.
 
The following users thanked this post: JDW

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #48 on: September 05, 2019, 03:22:06 am »
Ian, thank you for sharing your thoughts on room lighting and noise.  I actually discovered my stupidity about an hour ago with regard to my Fluke 8845A's RED unshielded wire being the source of induced noise into my voltage divider resistors.  When I removed that red probe wire, all the chatter you saw in my videos vanished.  Not a single blip across the voltage threshold from low to high.  But I think the experience was good in that it is a reminded that if noise is present, chatter could still occur even with the PIC's Hysteresis turned ON.  And for that reason, I still need to code the CLC as a preventative measure.

For now, I've connected up a PNP and NPN in place of the FETs we've been talking about, since I don't have any FETs in my parts stock.  I split my Tx line (Tx from my PIC, Rx at the sensor end) across E-C of an NPN BJT (to make it switchable), with 10k base resistor of that NPN tied to the collector of my PNP (2SB772).  The base of my PNP connects to a 560-ohm resistor which connects to the Comparator Output of my PIC (the same Output pin I was probing on my scope).  So basically for a rough test I am using the PNP to power the fingerprint sensor and cut the Tx line too.  In my testing thus far it actually works and I only measured a scant 1mV voltage drop across the PNP to the output.  For testing, I've got a Power Supply that triggers the fingerprint sensor's flash memory wipe code every time I kill power and start power to that Power Supply.  But with the NPN and PNP attached, the memory no longer gets wiped at all.  And again, what all this is doing is ensuring that the sensor's power gets cut when the voltage drops below 2.8v and keeps it cut all the way down to zero.  So far, it's working even with my PIC's brown-out circuit enabled (LO setting).

Of course the PNP base resistor requires a few milliamps of current which isn't desirable, so it's best to use a P-MOSFET instead.  But again, for this rough test, the goal I set out to achieve (preventing flash memory wipes) seems to be working well.  I will create a schematic that graphically explains what I just said later today.

Thanks again for your kind help thus far!
 
The following users thanked this post: Ian.M

Offline JDWTopic starter

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Low Voltage Detection & Power Cut IC
« Reply #49 on: September 06, 2019, 03:00:42 am »
Apologies for my delayed reply.  Below is the simplified schematic of what I am testing on a breadboard -- "simplified" in that it leaves off my 3V relay, LEDs and other less relevant devices for greater clarity.

827982-0

I don't have any MOSFETS in my parts stock, so I breadboard-tested with a PNP.  The PNP works great to kill power to the F.Sensor when Vdd dips below 2.81v, but the PNP's base resistor results allows a continuous 4.2mA current flow as long as the Base is LOW (fed by the Comparator1 OUT), which is most of the time.  If using a P-MOSFET will eliminate that 4.2mA then I should use a FET instead.

Using an NPN to break Tx in the manner shown in the schematic actually works, and signal integrity looks fine on the scope, but I am unsure if that's a sound approach -- it is a bit different than what forrestc recommended in (1) of his earlier post.

My switching power supply has internal protection against the output (3.3v@250mA) being shorted to ground, so I think the PNP's collector (which powers the F.Sensor) should be OK as shown on the schematic.  Leaving Ground as a straight-through connection between boards is probably okay as well for the same reason.  And the 3 signal wires have basic diode ESD protection with resistor as shown (for the PIC side circuit board).

I've not had time to do the CLC or the PIC internal voltage division (to eliminate R1 & R2) that forrestc suggested, but I intend to do that soon and will report back at that time.

Thanks to IanM. and forrestc for your kind help to date.
« Last Edit: September 06, 2019, 05:58:57 am by JDW »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf