I've got a Raspberry Pi in my car I'm planning to make control the locks. I'd like to get it to get a message from my phone, preferably over BT though Wifi would be do-able, to unlock the door.

What I've tried so far:

Establish connection from Phone to RPi - Takes too long (Around 20 seconds for the first message)

Use hcidump on RPi to log incoming messages from phone and act based off of phones device name (name + MAC is in the first packet, I changed the name to LOCK and UNLOCK for the commands) - Too slow still, the phone does a scan then attempts to connect. It also just feels far too hackish and cheap.

Check signal strength/ping time to approximate distance - Signal strength doesn't drop from 100% until I'm nearly 150 feet away from my car in the open, ping jitters far too much to be reliable


Alternatives I see: NFC -- I don't know the operating range of NFC, but if it'd work over ~2 feet I could put a sensor in the driver-side door to check for it, but I don't believe it goes far enough

Unconnected wi-fi message - I think this would be the best, but I have no idea how to do it, or if it's even possible.

When it's done, I'd like to be able to do something like this:

Phone sends RPi a private-public key encoded message including timestamp + a command
RPi decodes and checks if timestamp is within a range, then operates based off of the command

Obviously the RPi will be left on all the time to keep the clock set
If you had another cheap cell phone, you could use a text message. Very Happy

Failing that, rfid might work. You don't have to put the RPi right by the sensor, but rather have the sensor in the door, and the RPi somewhere else.

Some questions:
Wouldn't your RPi drain your battery? I can't see leaving it on all the time being a good thing?
Also, how hot does your car get. It'd be bad if one day you couldn't unlock your car because it was too hot, and something melted.

Cool idea. I've always wanted something where I just walk up, and it unlocks when I grab the handle of the car.
A txt message would be too slow, and yea, I know I could have the sensor on a cable and not put the RPi in the door.

I've been running a netbook inside it for quite a while without any issue from heat, and I'm sure that puts out more than the RPi will. I put it in standby when I go inside for long times, and I haven't had it kill my battery yet, though it does in about two days if I leave it on.
Creating a AdHoc WiFi network isn't all that hard. Heck, even an SD card can do it. Sadly, the SD card won't enable communications between the RPi and the Phone.

Just setup a network password and make sure your phone remembers it, write two apps - one for the RPi and the Phone - and you're set. The only hiccup I can see is that you're within range of a previous WiFi network so you'll have to manually switch to your cars AdHoc.
The issue with that is that it takes a significantly long time to switch to an AdHoc network on an Android phone. I'd really like to just send a message out without establishing a connection.

Edit: If anyone is curious, here's what else I'm going to be using the RPi for:




Touchscreen, by the way.
What touchscreen is that, how much is/was it, and how hard is/was it to interface with the Pi? I liked the idea you posted on IRC, wherein you use a high-frequency tone emitted by your phone and identified by the Raspberry Pi, but I'd additionally suggest modulating that tone in some way. Even better, with a speaker-mic pair on both the car and the phone, you could do a challenge response:

1. Phone emits "I am here" tone.
2. Car emits challenge signed with its private key, assuming previous key-pair exchange.
3. Phone verifies challenge, re-signs challenge, and emits the result.
4. Car checks challenge response, unlocks the car if valid.

Public-key crypto!
KermMartian wrote:
What touchscreen is that, how much is/was it, and how hard is/was it to interface with the Pi? I liked the idea you posted on IRC, wherein you use a high-frequency tone emitted by your phone and identified by the Raspberry Pi, but I'd additionally suggest modulating that tone in some way. Even better, with a speaker-mic pair on both the car and the phone, you could do a challenge response:

1. Phone emits "I am here" tone.
2. Car emits challenge signed with its private key, assuming previous key-pair exchange.
3. Phone verifies challenge, re-signs challenge, and emits the result.
4. Car checks challenge response, unlocks the car if valid.

Public-key crypto!


Sorry for the delayed response, I forgot I posted this.

The touchscreen I'm using is this (though mine only cost $17), the display is one I ripped out of some portable movie player and found a controller board for on eBay

It was pretty much plug-n-play with Linux (I might have had to install drivers, I can't recall.) It showed up as a standard HID device once it was set up, though. Windows had to have some poorly-written driver to work right with it.

As far as communication goes, I'm still at a complete blank. I don't think that my phone could emit a high enough frequency pitch (Seems to peak out at around 14-16KHz, and that's audible)

Right now the only solution that I think would work is an NFC reader in the door and holding my phone to unlock it, which wouldn't have much any advantage over just using the key to get in.
Bluetooth is your only real option for medium distance wireless. Establishing a connection between two already paired devices is pretty fast, it should be good enough.
graphmastur wrote:
If you had another cheap cell phone, you could use a text message. Very Happy

Failing that, rfid might work. You don't have to put the RPi right by the sensor, but rather have the sensor in the door, and the RPi somewhere else.

Some questions:
Wouldn't your RPi drain your battery? I can't see leaving it on all the time being a good thing?
Also, how hot does your car get. It'd be bad if one day you couldn't unlock your car because it was too hot, and something melted.

Cool idea. I've always wanted something where I just walk up, and it unlocks when I grab the handle of the car.


Thanks for your share
Hey, maybe this would be of help: http://stackoverflow.com/questions/11117035/android-bluetooth-rfcomm-connect-too-slow

Since you know the info for both devices you could make an app for the Android phone that uses the linked code to skip discovery when making the connection. This should greatly reduce the time. I'd imagine it would be only a second or two to make the connection and send an encrypted message after hitting the "unlock" button.

Possibly a better option would be to make the app run as a service and try to connect to the RPi every so often. Then it would be ready when you need it and locking/unlocking would be instantaneous.

You could even have it so that it knows via GPS where you parked the car (check for when you start moving walking pace) and only start looking for the RPi when you get within a certain distance to the car. Probably too much work for what you want, but I'd see it as a fun challenge.

Another idea: the app runs as a service and only checks the accelerometer. When you take the phone out of your pocket or when you do some gesture (wave it around like a magic wand?) it starts looking for a connection to the RPi. Then it's not wasting battery checking all day, is relatively simple, and requires minimal interaction (you don't need to navigate a bunch of menus before unlocking).
i remember microsoft having a app wich does the gps tracing thing, i believe it is called onX, you can make your own scripts with just javascript and its api. so its fairly easy to set up.
This thread came to mind as I was reading somebody else's writeup of a similar project.
They use Bluetooth, and have the car set up to be the initiator (so the phone doesn't need to continuously poll).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement