Electronics > Projects, Designs, and Technical Stuff
Low Voltage Detection & Power Cut IC
Ian.M:
Hmm. I'd respond to power glitching by wiping a series of flag locations and for each one wiped, doubling the delay after Vcc becomes stable within its valid range before responding to any commands or fingerprints. It only takes an initial 10 second lockout and by the 16th glitch attempt they'll have to wait a week before they can try again. Reset the flag locations on command only if power is stable and the master fingerprint is used for authentication.
JDW:
--- Quote from: Ian.M on September 06, 2019, 10:15:48 am ---Without seeing the sensor datasheet we cant know if 1.6mA is potentially harmful.
--- End quote ---
Here is the datasheet.
Here is the Programming Guide.
Here is a marked-up photo I took of the bottom PCB of the sensor (the top is just the sensor itself with some ceramic caps and connectors at either end).
As mentioned in my previous post, my earlier mention of 75mA current consumption was in error. For some reason my uCurrent Gold was giving me that value on my Fluke 116 DMM, but when I later tested with my benchtop Fluke 8845A, I measured a solid 100mA flowing to the sensor at 3.3V when the sensor was powered on and its LED lit. So let's please forget the 75mA number and use the correct 100mA value going forward. Also note that the datasheet mentions 130mA, which I assume are peak current because I could not measure anything above 105mA during a lot of testing with my Fluke 8845A.
The manufacturer finally answered my question to them about the two 5-pin components marked "A2RC" in my photo by saying they are both LDO's used in a proprietary way they cannot disclose, which assume means they are somehow involved in the flash memory anti-tampering auto-wipe security feature. (That means there are a total of 3 LDOs on this fingerprint sensor -- U3, U4 & U5.) When I cited some Vin voltage-range specs from the Holtek "02A-4" MCU datasheet, the manufacturer replied that MCU was customized by Holtek for them, but they would not disclose how. They emphasized that the Holtek 02A-4 MCU needs 3.3V and that I should not operate it within the 2.0v to 2.7v danger zone, nor should it ever be fed 5.0V. This is an important detail since the UART side Vin connector can accept voltages up to 6.0V.
Using continuity-check while probing the bottom of the fingerprint sensor PCB, I found that the 5V pad on the "UART side" shown in the photo leads straight to the Holtek 5301 3.0V regulator on the TOUCH IC side, which in turn powers the ARM processor and the Winbond Flash IC. However, Vin for the Holtek 02A-4 MCU comes straight in (unprotected, but with some ceramic decoupling capacitors) from the connector atop the TOUCH IC side. And again, according to the manufacturer, Vin for that 02A-4 MCU must be 3.3v. They refused to disclose a range of input voltages for it, but I tested that it works fine at Vin will down into the 2.0v to 2.7v danger zone.
The connector on the TOUCH IC side can be left alone and unpowered (i.e., when not connected, the Holtek 02A-4 MCU would be completely powered off). But when the 02A-5 MCU is powered (it draws less than 60uA even when powered) the connector on the TOUCH IC side provides an output from a leg on that Holtek 02A-4 MCU which becomes HI for as long as a finger is touching the metal frame that surrounds the optical fingerprint sensor. When you remove your finger, that output goes LO. You can of course issue UART commands to the sensor to ask it if a finger is pressed, but they provide this other way to get that info which is faster and provides that info even when the fingerprint sensor is in sleep mode.
Ground for the Holtek 02A-4 MCU is straight through to the UART side connector, so to use the TOUCH IC connector means one only needs to connect Vin (which must be 3.3v) and then one can use the Finger Detect Output, which again comes straight off the I/O pin o the 02A-5 MCU. The manufacturer confirmed that so long as the UART side connector's Vin is a nominal 3.3V, I can safely connect the TOUCH IC side's Vin to the UART side Vin, powering them both at the same time. And since the TOUCH IC side draws so little current, it's fine to keep it powered all the time. And that is why you see it connected in such a way on my simplified schematic.
Ground for the Holtek 02A-4 MCU is straight through to the UART side connector, so to use the TOUCH IC connector means one only needs to connect Vin (which must be 3.3v) and then one can use the Finger Detect Output, which again comes straight off the I/O pin o the 02A-5 MCU. The manufacturer confirmed that so long as the UART side connector's Vin is a nominal 3.3V, I can safely connect the TOUCH IC side's Vin to the UART side Vin, powering them both at the same time. And since the TOUCH IC side draws so little current, it's fine to keep it powered all the time. And that is why you see it connected in such a way on my simplified schematic.
By the way, if you watched the unlisted videos I posted on YouTube, you will spot the benchtop power supply I used during testing. That power supply normally triggers the auto-memory wipe of the fingerprint sensor nearly every time I switch it off and then on again. But after I added the low voltage detection and power cut via PNP & NPN you saw in my schematic, the auto-wipe doesn't occur anymore -- not even when I deliberately glitch-test on my breadboard. I've tested this power supply via OFF/ON almost 100 times, so I can say that with a certainty. I don't see any glitching when I probe the output of that power supply while connected to my breadboard. The only thing I see is that it someone slowly ramps up voltage from 0v to 3.3v, which is no doubt an intentional soft start inside that power supply. So perhaps the fingerprint sensor manufacturer has setup their circuit and software to look for a certain voltage ramp? They made it clear I should not power it with 2.0v to 2.7V, but they didn't specify how long it could be in that voltage range before the auto-wipe occurs.
I have also been testing at my computer using this USB-to-3.3V interface and I almost never experienced auto-wipe no matter how many times I yanked out and inserted the USB connector. Regardless, the PNP & NPN circuit shown in my most recent schematic has, in my testing thus far, eliminated the auto-wipe problem.
RIKRIK:
What a bus driver or tristate buffer?. However you would need a opamp as a voltage comparator to turn it on and off.
JDW:
--- Quote from: forrestc on September 03, 2019, 10:06:03 am ---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:
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.
--- End quote ---
I found the following two 3-state unidirectional non-inverting buffers with active-low enable and internal ESD protection:
NC7SZ125P5X - ESD Human Body Model Protection: 4000V max, Operating Temp: +85°C max
NL17SH125P5T5G - ESD Human Body Model Protection: >3000V max, Operating Temp: +125°C max
Do you know if the ESD protection is on the input, the output or both? (Datasheets don't specify this.) If ESD protection is on the Output, then would the buffer alone be sufficient as shown in the modified (& simplified) schematic below? (Note the buffer on RB7 with no supplementary ESD protection.)
Note in the bottom left that I also swapped out my PNP for the P-MOSFET you suggested. Not sure if R10 being 100k is too big, but turn on time isn't critical. It will be ON most of the time, so 100k would help keep wasted current consumption to a minimum.
JDW:
--- Quote from: forrestc on September 03, 2019, 12:00:23 pm ---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.
--- End quote ---
I spent the day testing the DAC, since I had never used it before. The 16F1508 datasheet has a number of errors, and the DAC pages are especially afflicted. The datasheet specifies "DAC1CON0" & "DAC1CON1" but using those generates Assember errors. "DACCON0" & "DACCON0" are correct. Then on page 143 in section 16.3, paragraph-2 ends like this:
"Reading the DACxOUTn pin when it has been
configured for DAC reference voltage output will"
"Will" what? Nobody knows!
Despite this hassle, I finally got the DAC working with Comparator1. Keeping the threshold somewhat close to 2.70v is desirable because I don't want it to go too high with Hysteresis enabled. So I thought Step-12 in combination with FVR=1.024v would be best. On my breadboard test I measured the lower threshold to be 2.725v (that voltage and below results in Comparator1-OUT=HI, which then cuts power to the fingerprint sensor). "Tolerances" are the key issue though. I wouldn't want the power-cut to start at below 2.70v. Table 29-16 on pg.332 in the 16F1508 datasheet says the parameters are characterized but not tested, and Note 1 links to graphs that have nothing to do with the DAC. However, it does say the absolute accuracy is 1/2 LSb, which must be referring to bits 4:0 of DACCON1. So +/-0.5LSb would be 11.5 or 12.5 (since I'm using 12). That yields the following calculations:
EQUATION 16-1:
DACx_output = ((Vsource+ – Vsource-) x DACR[4:0]/32) + Vsource-
Since Vsource- is Vss(GND) according to Figure 16-1 in the datasheet, and since Vsource+ is set to Vdd in my code, we have:
DACx_output = Vdd x DACR[4:0]/32
Find Vdd when DACx_out = FVR(1.024v):
1.024v = Vdd x 12/32
Vdd = (1.024v x 32) / 12 = 2.731v (nominal)
And with the 1/2LSb tolerance, we have:
Vdd = (1.024v x 32) / 12.5 = 2.621v (min) <- too low!
Vdd = (1.024v x 32) / 11.5 = 2.849v (max)
So a power cut-off threshold of 2.621v would be a problem, seeing it is below the 2.70v specified by the fingerprint manufacturer.
Using Step-11 instead of 12 would give:
Vdd = (1.024v x 32) / 11 = 2.979v (nominal)
Vdd = (1.024v x 32) / 11.5 = 2.849v (min)
Vdd = (1.024v x 32) / 10.5 = 3.121v (max) <- too high!
Using a 2x multiplier on the FVR and Step-24 would yield:
Vdd = (2.048v x 32) / 24 = 2.731v (nominal)
Vdd = (2.048v x 32) / 24.5 = 2.674 (min) <- too low!
Vdd = (2.048v x 32) / 23.5 = 2.789v (max)
Using Step-23:
Vdd = (2.048v x 32) / 23 = 2.849v (nominal)
Vdd = (2.048v x 32) / 23.5 = 2.789 (min)
Vdd = (2.048v x 32) / 22.5 = 2.913v (max) <- a bit high, but perhaps acceptable.
So I bench-tested FVR with a 2x multiplier and Step-23 on my DAC and measured the following:
Lower Threshold Voltage: 2.874v (this and below cut power to F.Sensor)
Upper Threshold Voltage: 2.900v (this and higher restore power to F.Sensor)
And that small 26mV difference between Upper and Lower is with Comparator Hysteresis ON. I must assume it has something to do with using the DAC instead of external voltage divider resistors. With the resistors I was getting a 66mV difference between Upper and Lower, which offers better noise immunity.
If you have any thoughts on this and my previous post, please let me know.
Navigation
[0] Message Index
[*] Previous page
Go to full version