Battery powered fingerprint reader
-
This project is about a battery powered fingerprint sensor I placed just outside the door of my house. The last person leaving the house or the first entering it would use the sensor so the controller could arm/disarm the alarm but of course can be used to control anything (e.g. opening the door). Since the controller gets the id of the fingerprint when there is a match, would also know who is entering the house so greeting the person by name out loud (kind of funny :P).
The fingerprint sensor I'm using is a FPM10A that can be found on Aliexpress for 5$ (https://www.aliexpress.com/item/Fingerprint-Reader-Sensor-Module-FPM10A-Optical-Fingerprint-Fingerprint-Module-Locks-Serial-Communication-Interface-For-Arduino/32835820214.html).
Wiring is pretty simple (http://www.duino.lk/image/cache/catalog/Components/fingerprint scaner/fingerprint_sensor_6pwhs7n-500x500.jpg) , it uses a serial connection for the communication and sample code and a library is available from Adafruit (together with a Windows utility that can be used for troubleshooting and for enrolling your fingerprints).If battery powered, the sensor cannot of course stay always on since consuming around 150mAh. This is why I've attached a button to the project so the person using it can press the button, the node wakes up, the sensor turns on and the person can put the finger on it. After that, the board goes back to sleep. I've also added a buzzer to shortly beep in case of a positive match.
This is how the project looks like:
- 1: EasyPCB from @sundberg84 RFM69 version
- 2: FPM10A sensor. RX and TX connected to pin 5 and 6 (using SoftwareSerial).
- 3: MCP1302 voltage regulator to provide 3.3v out of the 3 AA batteries (4.5v). I preferred using this configuration since the FPM10A works so so when the voltage is below 3v. The regulator is placed in the booster position so to measure the battery level
- 4: battery measurement, resistors 1M and 300k ohm
- 5: since the FPM10A has to be powered on only on demand and an arduino pin cannot provide enough current, I'm using a pn2222a transistor connected to an arduino pin on one side through a 220ohm resistor (with a 10k resistor going to ground) and the FPM10A gound on the other side
- 6: button for waking up the board and starting the fingerprint sensor
- 7: 3 AA battery pack
- 8: buzzer
This is the code I'm using (from the NodeManager's development branch):
/********************************** * MySensors node configuration */ // General settings #define SKETCH_NAME "Fingerprint" #define SKETCH_VERSION "1.0" #define MY_NODE_ID 9 // RFM69 radio settings #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER // Advanced settings #define MY_BAUD_RATE 9600 #define MY_SPLASH_SCREEN_DISABLED /*********************************** * NodeManager modules for supported sensors */ #define USE_BATTERY #define USE_SIGNAL #define USE_DIGITAL_OUTPUT #define USE_INTERRUPT #define USE_FPM10A /*********************************** * NodeManager built-in features */ // Enable/disable NodeManager's features #define FEATURE_DEBUG ON #define FEATURE_POWER_MANAGER ON #define FEATURE_INTERRUPTS ON #define FEATURE_CONDITIONAL_REPORT OFF #define FEATURE_EEPROM OFF #define FEATURE_SLEEP ON #define FEATURE_RECEIVE ON #define FEATURE_TIME OFF #define FEATURE_RTC OFF #define FEATURE_SD OFF #define FEATURE_HOOKING ON /*********************************** * Load NodeManager Library */ #include "NodeManagerLibrary.h" NodeManager node; /*********************************** * Add your sensors below */ // built-in sensors SensorBattery battery(node); SensorSignal signal(node); PowerManager power(-1,A1,1000); // Attached sensors SensorFPM10A fingerprint(node,5,6); SensorDigitalOutput buzzer(node,A5); /*********************************** * Main Sketch */ void bip(Sensor* sensor) { if (fingerprint.success) buzzer.setStatus(ON); } // before void before() { // setup the serial port baud rate Serial.begin(MY_BAUD_RATE); // battery sensor battery.setMinVoltage(3.2); battery.setMaxVoltage(4.6); battery.setBatteryInternalVcc(false); battery.setBatteryPin(A0); battery.setBatteryVoltsPerBit(0.00459433); // buzzer sensor buzzer.setPulseWidth(20); // fingerprint sensor fingerprint.setPowerManager(power); fingerprint.setWaitFingerForSeconds(15); fingerprint.setInterrupt(3,FALLING,HIGH); fingerprint.setPostLoopHook(&bip); // node configuration node.setSleepMinutes(60); node.before(); } // presentation void presentation() { // call NodeManager presentation routine node.presentation(); } // setup void setup() { // call NodeManager setup routine node.setup(); } // loop void loop() { // call NodeManager loop routine node.loop(); } #if FEATURE_RECEIVE == ON // receive void receive(const MyMessage &message) { // call NodeManager receive routine node.receive(message); } #endif #if FEATURE_TIME == ON // receiveTime void receiveTime(unsigned long ts) { // call NodeManager receiveTime routine node.receiveTime(ts); } #endif
Basically the node sleeps and wakes up every hour to report battery and signal level. When the button (attached to pin 3) is pressed, the node wakes up and the FPM10A is powered on by PowerManager (which turns HIGH pin A1 so saturating the transistor and activating the sensor). If there is a fingerprint match, then the fingerprint id is sent back to the gateway and the node goes back to sleep. Before doing so a short "bip" is sent to the buzzer.
If nothing happens for 15 seconds, the node goes back to sleep regardless.Just a little trick, since I'm running all my arduino nodes at 1Mhz, the FPM10A has to be configured to work at 9600 baud (57600 is the default). The only library that I found with a working example to change this into the device is the following https://github.com/brianrho/FPM/blob/master/examples/setParam/setParam.ino
-
Hi,
nice project.
for power savings i generally use load switch, p-mosfet instead bjt (like your transistor). but that depends on the circuit, voltages etc.
just curious, as you're using 1Mhz clock, have you measured power consumption ? Sometimes it's not worth to use 1mhz.
-
Is the fingerprint data stored in the sensor itself? or somewhere else?
-
@crankycoder yes, in sensor itself. It has its own built-in micro-controller.
-
do you know if this will work with the sparkfun library?
https://github.com/sparkfun/Fingerprint_Scanner-TTL
I ordered one of those scanners to test with. But aliexpress.... gonna be a bit lol
-
@crankycoder you can use this library: https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library
I've just checked spurkfun's fingerprint scanner isn't compatible with adafruit's. They have different data packet formats. But it seems that FPM10A (ZFM-20) has the same format as more expensive R309 (if you happen to come across one).
-
@scalz thanks for advice first of all. Agree, the 1Mhz clock was unnecessary for this project but I usually leverage this configuration not because of the power consumption but mainly to allow the board running with 2 AA batteries way below 3V. But for sure an over complication here
@crankycoder the fingerprint sensor should be able to keep track of 200+ fingerprint which have to be enrolled first (through a windows utility or an ad-hoc arduino sketch). Regarding the library in NodeManager I've integrated the Adafruit's one, the one on sparkfun seems designed for a different sensor.
-
@monte i was just wondering if it could use the sparkfun, since you can do an enroll without saving it to the internal and have the template it generates dumped to a var. Then you can do a finger capture without having it try to identify and dump that to a var.
Ill dig in to the adafruit one and see what i can find
-
@scalz forgot to mention, other reason why I'm using a 1Mhz bootloader is because having other nodes at 1Mhz in my network for running on batteries below 2.8v, the gateway is 1Mhz as well and I've always noticed issues when mixing 1Mhz and 8Mhz nodes with RFM69 radio. Since 2.2.0 they can at least kind of communicate but due to the different speed I guess, sometimes something gets lost. With NRF24L01 mixing looks good instead.
-
@user2684
well, here i prefer to use a faster processing gateway. no issue with slower nodes.. but i'm not using official mys branches (could be that, not sure..).nice to hear it's working as you wish, the most important