Keyless Entry System



Basic Idea: 

Ditch the key FOB and use your mobile phone as a passive key to access and authorize your car. There are many challenges with such a system but I believe this development is unavoidable. Whilst my prototype is certainly not the most elegant, it does proof a basic point, which is that dedicated physical car keys are a thing of the past. I hope that in the future car manufactures will implement such systems, but given that currently key FOBs can be sold for $200 a pop, killing this cash cow might take a while.

Demo of the Bluetooth Passive Keyless Entry System:



Tech Stuff:

Signal Strength - Distance Approximation

To my knowledge there is currently no way to rapidly poll the signal strength (RSSI) in the standard Anroid API. The RN42 chipset on the bluesmirf has a way of outputting RSSI values at 5HZ but coding and analysis gets quite a bit more complicated since one needs to enter the command mode of them modem which would prevent the actual devices from communicating. There is a passthrough command but trial and error showed that this method was not very reliable. 

The solution was to come up with a method of somewhat guesstimating the distance between the modem and phone. In simple terms this was done by sending data from the phone to the modem and measuring how many packets were lost in a given period of time. This is not ideal, but works surprisingly well. 

Future bluetooth modems might have better and easier ways of polling signal strength which then can be used to assess the distance more easily but for now we wanna stick to cheap off the shelf hardware, requiring no modifications.


The Bluesmirf Connected to the Arduino Board

 Slave/Master - Connection Initiation:

Your phone needs all the battery it has and can not waste precious power trying to continuously initiate a connection to the vehicle. It is thus imperative that the connection must be initiated by the bluesmirf, which has all the power it could ever need from the vehicles battery.


This is the documentation of the RN42 chipset including the command set. The basic things you will need to do:
  1. Enter Command Mode
  2. Set desired baud rate (I choose 9600kbps)
  3. Authorize the MAC address of your phone
  4. Set the Board to Master and Auto Connect Mode
  5. Adjust scanning and paging intervals to your liking (although the bluesmirf has somewhat limited capabilities in that the "The inquiry and page interval is fixed at 0x1000 = 2.56 seconds"

Powering the Bluesmirf:

The bluesmirf, according to Sparkfun, uses about 25mA. This figure showed to be an average guestimate after the actual power consumption was measured. Turns out that it spiked up to 42mA,more than the poor little Arduino can supply via a single Digital Input/Output pin. If there are people who actually used a single I/O pin could have damaged their boards...
Forum Topic Here

The solution was to simply use Two I/O pins. This way the bluesmirf could conveniently be switched on and off. During actual driving driving bluetooth communication is disabled to conserve power and board life but most importantly to let the phone goto sleep.

Hardware used:

Galaxy S3 (Android 4.1)
SainSmart 2-Channel 5V Relay Module for Arduino DSP AVR PIC ARM

Bluetooth Modem - BlueSMiRF Silver


Code Coming Shortly...

12 comments:

  1. how did you manage to make your
    bluesmirf establish the connection?
    i tried it but it didn't work.
    "CONNECT" failed

    ReplyDelete
  2. hey Ron,
    make sure you have the Bluesmift set to be the Auto-connect (Master Mode) (SM,3) and your phones Mac address stored in its memory!

    ReplyDelete
  3. Dude this is awesome. Keep up the good work!

    ReplyDelete
  4. This is really very cool! I am looking to do something similar to my w210 but I am having trouble figuring out how to activate/deactivate the alarm from inside the vehicle without using the fob, can you point me in the right direction?

    ReplyDelete
  5. Is it bluetooth low energy? How can we make use of Bluetooth LE in such project.

    ReplyDelete
  6. This sounds very cool! If only I could make it a module...

    ReplyDelete
  7. One of the latest keyless entries today is the smart locks.

    Forest Park Locksmith

    ReplyDelete
  8. I'm planning to use BT LE module. So can I use it? I want simple connect as you mentioned MASTER mode.

    ReplyDelete
  9. Dear sir, can you please sent me the source code. Seriously, i really need to know how to use the RSSi function between android and arduino. Thanks :)

    ReplyDelete
  10. Dear Sir, when you display the RSSI value by entering "L" command, are you really seeing the RSSI value being displayed at the rate of 5Hz?

    ReplyDelete
  11. Are you going to add more instructions? Wow would I love to do this.

    ReplyDelete
  12. Well the mercuino project was the reason I started my own version of a keyless entry system. I really wish he would of put up some code before disappearing but oh well.

    I started my own version of the mercuino project called carduino. If anyone is interested in starting this project then you can check up on my updates here: www.carduino.vonini.com

    Hopefully mercuino updates his stuff so we can see some finished results.

    ReplyDelete