Announcement

Collapse
No announcement yet.

Homemade Keyless Entry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Homemade Keyless Entry

    Hey everyone, finally out of school and I finally have done something to my e30 worth posting.

    The inspiration for this is really from the thought of being able to open and maybe even start the car from a smart watch. Unfortunately, I don't have a smart watch yet but I'll be grabbing one later this year. In the mean time, keyless entry with my phone will have to do.

    The get started, I used the following parts:
    • Arduino Micro. I used this one because it is tiny and is powered by micro usb just like a phone.
    • 4 channel relay board for arduino
    • HC-05 bluetooth module for arduino
    • 440ohm resistor
    • 220ohm resistor
    • old car charger
    • multimeter


    These parts were all used for the final build, I used an Arduino Mega and a breadboard for prototyping

    Wiring the Arduino is fairly straight forward, the only thing that matters is that all communication pins are is digital i/o pins (marked on the board) and that the write-wire from the bluetooth module is on an interrupt port (pin 8, 9, 10, 11, 14 on the Arduino Micro. Varies with other microcontrollers) otherwise the Arduino will not hear any incoming signals.

    For connecting the bluetooth to the arduino, here are how things were connected.

    Bluetooth Arduino
    GND ------------------------------------ GND
    . . . . . . . . . . . . . . . . . . . . . . ./
    . . . . . . . . ___440ohm resistor /
    . . . . . . . ./
    RXD --------220ohm resistor --------- Pin 9
    TXD ------------------------------------ Pin 8
    VCC ------------------------------------ 5v

    *Just to clarify, the wire from the RXD pin on a bluetooth module splits. One path has the 440ohm resistor and connects to ground. The other has a 220ohm resistor and connects to Pin 9 on the arduino.

    The resistors are for splitting the 5v current signal from the arduino to to the bluetooth so that the voltage will drop to 3.3 so the bluetooth will understand the arduino. Wiring the realy is simpler. GND to GND, VCC to 5v, and the last 4 pins on the relay module to any 4 digital i/o pins on the ardion. I used pins 4, 5, 6, 7.

    Until I figure out how to use r3v gallery, we have links
    Here is a picture of my proof on concept prototype:
    Prototype
    Final assembly

    I added a little under a meter of wire to the bluetooth module so that I may more freely position it when I install it.


    Ok, now for the software starting with the arduino. You can find it here under the sketch folder:
    Code
    This code may not work for everyone as it requires all the pins to match to mine If any pins are different or you are using a different microcontroller, change the pins used in the sketch to match what you are using. You will need the arduino sdk to load the program onto it, there are plenty of tutorials of how to do that already out there.

    Note, you will want to change the passwords used in the sketch as they aren't particularly hard to guess. Currently limited to 4 characters long.

    Once that is done, every time the arduino is started it will immediately start this program and await to be connected. The device name will be "HC-05" and the default password is "1234". To test the microcontroller with the new passwords, I downloaded Bluetooth Terminal from the Play Store and typed the commands. You'll know it is working if any command you send it is sent back to you.

    Now for the phone application. This is only for Android because I don't know how to code for iPhones and I don't want to learn. Also, android will be a lot easier to put on the store for others to download once I add a settings tab so that you may select the device to connect to and the commands to send. Until it is on the store, you will have to download the code, compile it, and install it to your phone through the android sdk. Tutorials out there already and the code is under the CarEntry folder:
    Code

    Like with the arduino, you will need to change the commands to what you want. The commands are in the TalkToCar file. Also, make sure the device name the widget will try to connect matches the device. You will need to connect to it at least once before so connect with the password and then the widget will connect automatically.

    Hopefully soon, I will update both sets of code with lots of comment describing many things.

    Alrighty, so how does it look? Like this:
    The widget

    Using it:
    There really isn't anything special to using the widget. Just leave it on the phone and when you hit any of the buttons it will try to connect if it isn't already. If it does connect, it then sends the command you hit.

    Make sure that you connect to the device at least before using the widget. This way you can login to it with the required password and the widget will find it in the bonded bluetooth devices.

    In terms of what the buttons are actually supposed to do, hitting unlock will open the second relay to unlock the car, and tap the third relay twice to blink the turn signals. Hitting lock will open the first relay to lock the car, tap the third relay twice to flash the blinkers, and very shortly tap the fourth relay for the horn to tell you it is locked. The Panic button just turns on the third and fourth relay and around half second intervals for about 10-15 seconds. This does the horn and blinkers. Hitting the button again will make it stop.

    That's it, wire into the car like any other keyless entry. Just be careful to make sure all the connections are correct and to test before putting it in the care. I am taking no responsibility if something goes wrong. Just sharing a personal project.

    For power usage, I measured 35 mAmp drain while waiting for commands. That's low enough for me to be fine with it.

    Thanks and I'll post the next microcontroller project when it's done. Dream would be a plug and play lcd gauge cluster to replace the onboard obc and add camera's, more info, etc but that would take quite a while. Summer project maybe? This project only took me about 10 hours to do everything. Until that is started, give me comments on these smaller project ideas:
    • Slightly more intelligent wipers
    • Automatic climate control
    • Check panel car compass
    • Automatic mirror lowerer when in reverse like in my e34
    • Automatic windows (just tap the button)
    • Can't think of any more atm

    #2
    Very impressive.

    Comment


      #3
      For anyone who will find this. There will be another write up hopefully soon of the next version of this. This version will have a physical key fob, much more sophisticated software for both the ardruino and android, and capacitive locks (hopefully) (meaning touching the car handle will unlock it for you)

      Comment


        #4
        Intersting

        Watching this

        Comment


          #5
          This guy is legit. He has great plans. Sub'd!
          ACS S3 Build / Dinan 5 E34

          Comment


            #6
            'Splain your username?

            Closing SOON!
            "LAST CHANCE FOR G.A.S." DEAL IS ON NOW

            Luke AT germanaudiospecialties DOT com or text 425-761-6450, or for quickest answers, call me at the shop 360-669-0398

            Thanks for 10 years of fun!

            Comment


              #7
              Originally posted by StereoInstaller1 View Post
              'Splain your username?
              Heheh - don't mind Luke - he's just wants you to get off his lawn. So old school he's allergic to solder.

              Love your go-getter attituide. Just FYI, you can't use a voltage divider to make 3.3 volts. As the load goes up, the divider won't work(the voltage divider won't be a divider anymore) - but many 3.3v things are 5 volt tolerant. So it might not fry right away. Instead use a low quiescent 3.3 volt regulator.

              35mA is huge! Putting the atmel to sleep and using interupts and wake ups would be the way to go. 2-3 mA would be ok I guess, and no reason why with a bit of just programming less then 1mA. Heck even 1/100 of a of that.

              Automatic mirror lowerer when in reverse like in my e34
              You'll need to replace the motor with a servo/stepper. There's no room, and it's really not needed on such a small car.

              Automatic windows (just tap the button)
              Some ass-hole already sells them on here.

              Automatic climate control
              Would be cool - but an e30 isn't a 2016 50K Benz. Much better option is seat heaters!

              Check panel car compass
              Cell phones with navigation kinda trump that.

              What is needed is someone to make a turbo intercooler input-output efficiency gauge with a water sprayer.
              Originally posted by Matt-B
              hey does anyone know anyone who gets upset and makes electronics?

              Comment


                #8
                Update

                Hey guys, quick update. Still working on this as life got in the way (e34 might be getting a nice 5L v8 very soon) but here is what has happened.

                So I have investigated a variety of methods to get the real keyless entry method to work. To start I am now using a much more advanced bluetooth chip that actually has documentation for it. This is awesome as now I can have the car initiate commands, change the name/password of the bluetooth, add security, adjust usage of power (down to 2ma on it now), etc. The lack of documentation was actually why the power consumption was 'high' before hand. The bluetooth module is not something I programmed, it is its own computer that I have 2 wires to interact with. With the new BT module, I have the option now to use sleep cycles, but that also reduces reliability to connect. So it is a trade, power consumption vs reliability. Programming is not that magical. The new BT module does not need a voltage divider as it reads from 5v's. I did need the divider as it could not read the data coming from the arduino. Load was a non issue because this was a digital communication pin and no load should ever be building up on it.

                With that I could now get the car to connect to the phone. The reason why something like that would be great is that now the car is trying to connect to my phone. This means I can now hide my car from other phones and make it near impossible (the other phone would need the same ID as mine. Doable but not by the average joe) for others to open my car or even know it has this capability. This also means I don't have to waste battery on my phone always trying to connect and that would definitely kill my phone. Unfortunately, the native functionality to autoconnect to the phone only works on device start up, which I could force a reboot but that can cause issues with bit rate and make this a lot more complicated than needed. That lead to me manually sending commands for it to connect to the phone. I could get updates from the bluetooth to know if I am connected or not. The issues this created was first that both the commands from the phone and the updates from the bluetooth come from the same wire. So I would need to parse the output from the BT module and resend commands if something was corrupted/wrong/jumbled. Aka, a small intranet for this BT module. On top of that, getting the BT module to initiate the connection was not reliable. The best I could get it to connect to the phone took on average 30 seconds. That is way too long and made this option not worth continuing.

                So, I can't have my phone search for the BT module and I can't have the car search for my BT module. Ok, what about RFID. This could work, but most inexpensive kits for long distance (up to 1m is a huge distance for RFID that is passive) don't interface well with the arduino and would require some interior modification to get the RFID reader in a good spot. So, not this route. I don't want to do the work required just so I can unlock a door by touch.

                Apple makes new ultra low power BT modules that I could use as a key. That is extremely non secure and just sends commands aimlessly for anyone to hear. So I would need to figure out how to hear passive signals.

                With android I could actually use the phone as an RFID card and send the signal from the phone. This is low power but is deliberately difficult to do because any phone with NFC can be a RFID card. I plan to go down this route in the future as it wouldn't be hard to get secure one way communication. A psuedo random key generator with a select-able key would be pretty simple. Basically, what Mercedes is now doing.

                So what was the decision, the easiest one xD I change the BMW logo to also be a button and would attempt to connected to the BT module for the next 5 minutes. Once connected, it would send a command to the BT module to tell it to unlock as soon as the capacitive sensor is triggered by the touch of a finger.

                What's left to do now is create the settings panel for the widget so that a user can enter all this specific info via a UI and actually install the new keyless entry in the car. What is much more likely to happen is that I will look at this again so that I can take advantage of NFC on the phone and remove the current key fob for a secure one. Currently, if you just buy the adafruit key fob, you could open my car. Not good.....


                Unfortunately, this project has taken a back seat to my e34 as I found an awesome deal on a low mile s62 that I couldn't pass up. So for the next few months, that will be my focus.

                Comment

                Working...
                X