So this happened:
Now let me tell you how I got all that to work.
Raspberry Pi 2 w/Case
16GB Micro SD Card
TP-LINK TL-WN722N Wireless N150 High Gain USB Adapter
SainSMart 4 Channel Relay Module
2A Car Charger
Avital 5103L Remote Start Car Alarm
The high-level workflow goes like this:
- Activate Google Now on my Note 4 by saying, “Okay, Google”
- Send Google Now the command “Start the Jeep”
- AutoVoice intercepts the command and kicks off a Tasker task
- Tasker launches Chrome with the URL that corresponds to a PHP page on the Pi
- That PHP page calls the WiringPi library and sets a GPIO pin to out mode, then activates that pin for 2 seconds and deactivates it
- The relay card accepts the GPIO signal and energizes one of the relays for that 2 second interval
- The relay is connected to the Remote Start Activation wire on the Normally Open side of the relay and the Jeep’s Ground on the common terminal, so when the relay is energized, the Remote Start Activation wire is grounded
- The alarm recognizes that the Remote Start Activation wire is grounded, and kicks off the black-box-to-me remote start process.
Unfortunately, I don’t have it working with my Samsung Gear Live Android Wear watch yet, but I’m confident I’ll get that figured out.
It’s important to note here that I wrote exactly 6 lines of code here, and two of those lines were the PHP opening and closing tags. This is not a project that requires a lot of that kind of expertise. Familiarity, yes, but not expertise.
The Remote Start
When I bought my Jeep, the previous owner had installed an Avital 3100L car alarm. I’ve had a few cars with remote start, so when the alarm started flaking out on me, I replaced it with an Avital 5103L Remote Start Car Alarm. The reason why I went with that remote start is, frankly, because it shares a harness with the 3100L. I didn’t want to have to re-wire the door locks, starter kill, dome light, etc. if I didn’t have to. Plus it was only like $80. Now that I’ve had it for a while, I know I should have spent the extra $30 and gotten the two-way pager model.
Avital is a DEI brand–like Viper, Clifford, and Python. DEI sells an internet-connected alarm add-on module for like $170 plus $70 a year. As of mid-August 2015, their “new version 4.0–coming early 2015” is still not ready yet. My point is that my Avital alarm has a wire that, when grounded, activates the remote start capabilities of the unit.
This is good, because now we can use this dedicated, purpose built hardware to accomplish the most difficult part of all this: Actually starting the Jeep!
Now, my Jeep is a 98. It’s old. It doesn’t have factory security or any fancy RFID keyfob. DEI has modules that can bypass those things, but they cost extra. Installing a remote start is not for the faint of heart, especially in a newer vehicle with 37 different kinds of security. Remote Starts essentially hotwire the car, and automakers have spent the last decade or so trying to make it very, very difficult to do that.
The Raspberry Pi 2
I finally broke down and bought one after Barron plugged it on GBVC EP27. And yes, it was my plan all along to use it for this purpose since I knew about that remote start activation wire.
In addition to my home wifi network, my employer provides a guest wifi network that I can have the Pi connect to. I haven’t gotten this part fully worked out yet, but the plan is to have the Pi connect to my OpenVPN instance at home and route the commands through that. I don’t want other people on the guest network to be able to randomly start my Jeep during the day 🙂
In order to make sure the Pi can actually reach the guest network, I bought a TP-LINK TL-WN722N Wireless N150 High Gain USB Adapter specifically because it has an external antenna connector. I also bought a 5db Antenna, but I’m not sure that’s actually getting me anything. Fifteen years ago I had a little magnet-mount 2.4ghz antenna specifically designed for WarDriving with an Orinoco card and I hope to find something like that. It was a great little antenna.
The Relay Card
The GPIO pins on the Pi can only handle a very tiny amount of current. It may be possible to set up the Pi in such a way that the relay card is necessary, but the card was only a few dollars and I can use the other relays for other things, like rolling down my windows or turning on my rear defrost.
In order to avoid the possibility of frying either the Pi or the Alarm brain, I got the relay card to isolate the two.
The card can be powered by the 5v line on the Pi 2. I’m not sure if I’d want to power all 4 relays simultaneously for an extended period of time, but for my purposes this is fine. One thing to note is that my card activates a relay if it is receiving a 0 on the GPIO line, not a 1. I had to compensate for that.
The Pi Software
I’m not going to lie: I totally followed this fabulous Instructable to get me to a point where I could hit a single page and activate a relay for 2 seconds. I didn’t do steps 5 or 6 because it wasn’t necessary for me.
Here is the entirety of the code that I wrote for this project:
system ( "gpio -g mode 4 out && gpio -g write 4 1");
system ( "gpio -g write 4 0");
sleep ( 1 );
system ( "gpio -g write 4 1");
That’s saved as RemoteStart.PHP. Hit http://your.pi.ip/RemoteStart.PHP and BOOM! Relay fires for 2 seconds:
The Android Software
I bought Tasker about a year ago because everyone says it’s awesome and I had $10 of Play credit to use. As part of this project, I also installed the AutoVoice plugin for Tasker, and then bought the unlock code because it was $1.34 and in order to use the 7 day trial version, the developer wanted me to sign up with an account on some gaming site. Eff that. Take my money.
Now, I thought that AutoVoice was to make this work with my Android Wear, but I was wrong. This is to make this work with regular Google Now.
The AutoVoice page on Play has a pretty good video tutorial so I’ll refer you to that for how to set up the AutoVoice portion.
For Tasker, you want to set up a Task and call it “Start the Jeep” or whatever. Add a “Net” action for “Browse URL” and put your URL in there. Hit the play button to test it: Your default browser should open and go to that page. If not, something’s not right.
On the Profiles tab, create a new Event Profile. Select Plugin->AutoVoice->Recognized. Do the Speak Filter thing they demonstrate in the video tutorial and say “Start the Jeep.”
The Enter Task dialog will pop up. Select the task you created.
NOW THIS IS VERY IMPORTANT! You have to actually activate Tasker! I didn’t at first and was angry–AutoVoice was showing a popup (sprite) saying that it recognized my “Start the Jeep” command, but then it wasn’t doing anything! If you don’t have a lightning bolt icon in your system bar up top, Tasker is not active.
Test it out!
Putting it all together
And everything should work…as long as you’re connected to your network.