def fps_init(): print 'initializing fingerpirnt scanner' fps = FPS.FPS_GT511C3(device_name='/dev/ttyAMA0',baud=9600,timeout=2,is_com=False) fps.UseSerialDebug = True fps.SetLED(False) FPS.delay(1) fps.DeleteAll() print 'done.' return fps
def initialize(self): print('Begin') fps = FPS.FPS_GT511C3(device_name='/dev/ttyAMA0', baud=9600, timeout=2, is_com=False) print('Scanner connected') counter = 1 while counter < 5: fps.SetLED(True) time.sleep(2) print('On') fps.SetLED(False) time.sleep(2) print('Off') counter = counter + 1
def Finger_PrintSM(msg): fps = FPS.FPS_GT511C3(device_name='/dev/ttyAMA0',baud=9600,timeout=2,is_com=False) fps.UseSerialDebug = True fps.SetLED(True) # Turns ON the CMOS LED FPS.delay(1) # wait 1 second print 'Put your finger in the scan' if not hasattr(Finger_PrintSM,"state"): #Declare intial state Finger_PrintSM.state = IDLE print Finger_PrintSM.state print 'CurState:[' + Finger_PrintSM+']' print 'Cmd:[' + msg + ']' if(Finger_PrintSM.state == IDLE): if(msg == 'First'): Finger_PrintSM.state = GET_FIRST elif(Finger_PrintSM.state == GET_FIRST): if(msg == 'Second'): Finger_PrintSM.state = GET_SECOND elif(Finger_PrintSM.state is GET_SECOND): if(msg == 'Third'): Finger_PrintSM.state = GET_THIRD elif(Finger_PrintSM.state is GET_THIRD): if(msg == 'Finish'): Finger_PrintSM.state = STORE_FINGER elif(Finger_PrintSM.state is STORE_FINGER): print 'About to store finger' Finger_PrintSM.state = IDLE elif(Finger_PrintSM.state is WARNING): print 'Warning' else: print 'unknown state'
# print 'Failed to capture second finger' msg = {'msg': 'Failed to capture second finger'} socketIO.emit('fps_com', msg) else: # print 'Failed to capture first finger' msg = {'msg': 'Failed to capture first finger'} socketIO.emit('fps_com', msg) else: # print 'Failed: enroll storage is full' msg = {'msg': 'Failed: enroll storage is full'} socketIO.emit('fps_com', msg) if __name__ == '__main__': fps = FPS.FPS_GT511C3(device_name=DEVICE_GPIO, baud=9600, timeout=2, is_com=False) fps.UseSerialDebug = False GPIO.setmode( GPIO.BCM ) # programming the GPIO by BOARD pin numbers, GPIO21 is called as PIN21 # Set the LED GPIO number LED = 21 # Set the LED GPIO pin as an output GPIO.setup(LED, GPIO.OUT) # initialize digital pin21 as an output. # fps.UseSerialDebug = True #fps.SetLED(True) # Turns ON the CMOS LED FPS.delay(1) # wait 1 second for initialize finish fps.SetLED(True) # Turns ON the CMOS LED
#Press same finger again print 'press same finger yet again' while not fps.IsPressFinger(): FPS.delay(1) if fps.CaptureFinger(True): #remove finger iret = fps.Enroll3() if iret == 0: print 'Enrolling Successfull' else: print 'Enrolling Failed with error code: %s' % str( iret) else: print 'Failed to capture third finger' else: print 'Failed to capture second finger' else: print 'Failed to capture first finger' else: print 'Failed: enroll storage is full' if __name__ == '__main__': FPS.FPS_GT511C3(device_name='/dev/ttyAMA0', baud=9600, timeout=2, is_com=False) #settings for raspberry pi GPIO fps.Open() if fps.SetLED(True): LegacyEnroll()
Step 3: Connect the VCC pin of the fingerprint GTC511C3 to VCC 3,3 in GPIO Step 4: Connect the Ground pin of fingerprint GT511C3 to ground pin in GPIO This may be works fine, if don't, try to change the fingerprint baud rate with baud_to_115200.py sample code ''' import FPS, sys if __name__ == '__main__': fps = FPS.FPS_GT511C3(device_name='/dev/ttyAMA0',baud=9600,timeout=2,is_com=False) fps.UseSerialDebug = True fps.SetLED(True) # Turns ON the CMOS LED FPS.delay(1) # wait 1 second print 'Put your finger in the scan' counter = 0 # simple counter for wait 10 seconds while counter < 10: if fps.IsPressFinger(): #verify if the finger is in the scan print 'Your finger is in the scan' fps.SetLED(False) # Turns OFF the CMOS LED break else: FPS.delay(1) #wait 1 second counter = counter + 1 fps.Close() # Closes serial connection
''' Created on 08/04/2014 @author: jeanmachuca ''' import FPS, sys from test_raw import * if __name__ == '__main__': fps = FPS.FPS_GT511C3() fps.UseSerialDebug = True print Verify(fps, sys.argv[1]) fps.Close() pass
eid = 0 eAlready = True while eAlready is True and eid < 3000: eAlready = fps.CheckEnrolled(eid) if eAlready == True: eid += 1 print('slot available is ' + str(eid)) return eid def dBaseSync(kid, key1, key2): conn = sqlite3.connect("/home/pi/python-GT511c3/finger.db") row = [kid, key1, key2] print(row) c = conn.cursor() c.execute("INSERT INTO codes VALUES(?, ?, ?)", row) conn.commit() conn.close if __name__ == '__main__': fps = FPS.FPS_GT511C3(device_name=DEVICE_LINUX, baud=9600, timeout=2, is_com=False) #settings for raspberry pi GPIO fps.Open() if fps.SetLED(True): LegacyEnroll(fps) fps.SetLED(False) fps.Close()
''' Created on 08/04/2014 @author: jeanmachuca SAMPLE CODE: This is for to change the fingerprint baud rate to 9600 Executes this script only once ''' import FPS, sys DEVICE_GPIO = '/dev/ttyAMA0' DEVICE_LINUX = '/dev/cu.usbserial-A601EQ14' DEVICE_MAC = '/dev/cu.usbserial-A601EQ14' DEVICE_WINDOWS = 'COM3' FPS.BAUD = 115200 #initial baud rate FPS.DEVICE_NAME = DEVICE_MAC if __name__ == '__main__': fps = FPS.FPS_GT511C3(device_name=DEVICE_MAC, is_com=True) fps.UseSerialDebug = True fps.ChangeBaudRate(9600) fps.Close() pass
This may be works fine, if don't, try to change the fingerprint baud rate with baud_to_115200.py sample code ''' import FPS, sys DEVICE_GPIO = '/dev/ttyAMA0' DEVICE_LINUX = '/dev/cu.usbserial-A601EQ14' DEVICE_MAC = '/dev/cu.usbserial-A601EQ14' DEVICE_WINDOWS = 'COM3' FPS.BAUD = 115200 FPS.DEVICE_NAME = DEVICE_MAC if __name__ == '__main__': fps = FPS.FPS_GT511C3(device_name=DEVICE_MAC,baud=115200,timeout=2,is_com=False) fps.UseSerialDebug = True fps.SetLED(True) # Turns ON the CMOS LED FPS.delay(1) # wait 1 second print 'Put your finger in the scan' counter = 0 # simple counter for wait 10 seconds while counter < 10: if fps.IsPressFinger(): #verify if the finger is in the scan print 'Your finger is in the scan' fps.SetLED(False) # Turns OFF the CMOS LED break else: FPS.delay(1) #wait 1 second counter = counter + 1 fps.Close() # Closes serial connection