0

I am trying to insert a raspberry pi zero into a Kwikset 913. I want the pi to capture the pin pad key presses so that I can have my own pin store on the pi, rather than the onboard chip. I managed to capture the key presses with a bus pirate and ols logic sniffer and the output was surprisingly straightforward:

This is 1 enter image description here

This is 5 enter image description here

I think these are 9 bit Binary Encoded Decimal values? Or at least just dropping the last bit and the rest of it is the binary representation of the key. Ok, so far so good. However, a 1 seems to just be "wider" than a 0, rather than a straight forward on for 1 off for 0. So how can I read these values into a raspberry pi? Or what do I need to research?

Edit

I made some progress with the RPi.GPIO python library with this: import RPi.GPIO as GPIO import time

GPIO.setmode(GPIO.BCM)

# BCM pin 21, Board pin 40
keyPin = 21

now = 0.0
pulse_count = 0

def check_pulse( channel ):
    global now, pulse_count
    # Rising
    if GPIO.input( channel ):
            now = time.time()
    else:
            print( "pulse: %s" % (time.time() - now ) )
            pulse_count +=1 
            if pulse_count % 9 == 0:
                    print( )


GPIO.setup( keyPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN ) 

GPIO.add_event_detect( keyPin, GPIO.BOTH, callback=check_pulse )

Unfortunately, the timing is very inconsistent. For the same button, I get different values for long and short pulses. To test the theory, I did much the same with an Arduino I had lying around and it was fully consistent every single time.

So maybe it's an issue with the Python lib, but I'm wondering if it is the linux os that is too slow. These pulses are in the low millisecond range. Based on my poking with the bus pirate, this should be the same 9 pulse code twice:

pulse: 0.0200440883636, GAP
pulse: 0.0219140052795, GAP
pulse: 0.000178813934326, 0
pulse: 0.000241994857788, 0
pulse: 0.00129985809326,  1
pulse: 0.000235795974731, 0
pulse: 0.00119590759277,  1
pulse: 0.000277042388916, 0 
pulse: 0.020092010498,    GAP
pulse: 0.000533819198608, 0
pulse: 0.0011260509491,   1
pulse: 0.00225782394409,  1
pulse: 0.00336098670959,  0
pulse: 0.000250816345215, 0
pulse: 0.00121092796326,  1
pulse: 0.00240182876587,  GAP?
pulse: 0.000396013259888, 0
pulse: 0.00126600265503,  1

Any idea if I can get better resolution with the pi, or will I need to "front" it with something like an arduino?

  • Please add url to Kwikset 913. – MatsK Sep 19 '17 at 3:05
  • Are those pictures screenshots from the buspirate software? – user2497 Sep 19 '17 at 4:03
  • @MatsK. I don't have the required 10 reputation to have more than 2 links and apparently the pictures count. Here. – nomadic_squirrel Sep 19 '17 at 16:18
  • @user2497, those are from ols, which is pulling the info from the bus pirate. I followed the tutorial here – nomadic_squirrel Sep 19 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.