ESP8266 Annex Keyless Entry

Place your projects here
Post Reply
Zim
Posts: 281
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 256 times
Been thanked: 128 times

ESP8266 Annex Keyless Entry

Post by Zim »

After locking my keys in the truck, I always wanted a keyless entry. I hate the idea of drilling holes for a keypad or having any kind of switch out in the elements.
Along came the XKC-Y25-PNP fluid level switch from china- Easy to position inside a vehicle behind glass. I have since relocated to the side rear window Then came Annex!!
You will have to dd your own homework on how to attach to your door locks. Connect across the outside key switch is the easiest, as it will also disable the alarm if it has one. I am lucky to have a vehicle schematic, so I'm going to the body Control Module.
The esp8266 parasitic drain is too high, so deep sleep is applied when unlocked, or 30 seconds after the last code attempt
The 30 seconds also allows you to log in to AP mode as well, if you want to change the code-
The added electronics allows the code entry pin to also issue the "wake up" call, so no need for 2 sensors-
Watch the bottom Video for operatiom
Total project was under $20
Hope this helps someone!
2021-02-09 16_20_14-Window.jpg
2021-02-09 16_20_30-Window.jpg

Code: [Local Link Removed for Guests]

GOSUB CREATE_PAGE
CREATE_PAGE:
CLS
TIMER0 1000, CHECK
TIMER1 30000, SLEEEP  'puts it to sleep after 30 sec of inactivety
CNT = 0
CNT2 = 0
UNL$ = ""
D1=5:D2=4:D6=12:D7=13      'D1 mini format to io
PIN.MODE D6, OUTPUT       ' keeps reset high, preventing reset while awake
PIN(D6) = 1                 
PIN.MODE D2, OUTPUT    'D2 is an output to relay
PIN.MODE D1, INPUT   'D1 is input pin for sensor. It also wakes from sleep
PIN(D2) = 0                   
AUTOREFRESH 1000
WAIT

CHECK:
IF PIN(D1) = 1 THEN TIMER1 30000, SLEEEP 'sleep 30 sec. after last key press
IF UNL$ = "AB" THEN LET CNT2 = (CNT2 + 1) ELSE CNT2 = 0
IF CNT2 = 6 THEN LET UNL$ = ""
IF PIN(D1) = 0 THEN LET CNT = 0
IF PIN(D1) = 0 RETURN
PIN.MODE D7, OUTPUT  'led flash
PIN(D7) = 1     
PAUSE 100      ' for indicator visibility
PIN(D7) = 0
PAUSE 800       'critical for finger off responce time
CNT = CNT + 1
IF PIN(D1) = 0 AND (CNT = 2) THEN LET UNL$ = "AB"                          ' unlock
IF PIN(D1) = 0 AND (CNT = 1) AND (UNL$ = "AB") THEN LET UNL$ = "ABCD"      ' code
IF PIN(D1) = 0 AND (CNT = 3) AND (UNL$ = "ABCD") GOSUB UNLOCK ELSE RETURN  ' 213
IF PIN(D1) = 0 RETURN
RETURN

UNLOCK:
PIN.TONE D7, 8, 1500 'flashes led to confirm unlock
PIN(D2) = 1    
PAUSE 900   'pulse relay
PIN(D2) = 0
UNL$ = ""
PAUSE 500
SLEEP 0
RETURN

SLEEEP:
PIN(D2) = 0
PAUSE 10
SLEEP 0
You do not have the required permissions to view the files attached to this post.
Post Reply