TL;DR
If you're just looking for the good stuff, feel free to skip our development story and head straight to the Code section :) Some videos are scattered throughout if you'd like to see the project in action. If you're in for the long haul, read on!
The Mission
This project was created during the Phoenix "Hack to the Future" Hardware Weekend. We had two days (really, one and a half) to design, build, and implement a project. We decided to start the car automatically and were surprised to find that nobody had tried it yet!
Starting out, RunDMC aimed to use Bluetooth to detect that an authenticated owner has approached the car. This would arm the system and act as the owner's "car key" from that point forward. No keyfob necesssary! If the car was an automatic, the user simply entering the car would start it. (After making sure it was safe to do so with some sensors.)
The car would continue running until the user's presence is no longer detected and the car was parked, and at that point would shut the car off automatically.
Later features might include unlocking the car as the driver approaches it, and re-locking it as they walk away.
Brainstorming
At first, we were a little ambitious. We had some cool ideas like:
- Combination of range and motion sensors to detect user presence in the car.
- Using a cellphone's Bluetooth pairing as a "keyfob"
- Having a pair of 7-segment displays count up to 88mph before the car started, triggering a sound module to play sounds from Back to the Future as it did so, then falling back down to 00 to monitor speed. We'd achieve this via another team's use of the Wunderbar on their project.
- Monitoring the voltage of the 12v line on the car with a voltage divider such that we could tell when the alternator kicks in, indicating the motor is running, so we can "stop starting" the car. This would be more reliable than simple timing, but would require a safe timeout.
- Unlocking the doors when the phone was present, and re-locking them when it went away.
- A sleek housing to put this all in. (Ended up with a Grove Kit box, lol)
Only a couple of these ended up working out, but it was fun coming up with ideas and left us room to improve. Our final product was successful in detecting that the user was in the car, and starting it automatically (provided safety measures were in place).
Getting Started
Let's get going! First off, this car was a manual. That meant we couldn't simply start it without any human interaction like we could with an automatic, lest we plow Adam's DeLorean into something.. other than the future. We decided that detecting the clutch being pressed down was probably the best way to assume it's a "safe" time to start the car. This /should/ have been relatively simple, buttt we had some issues as we started to choose our development platform and start coding. Due to our lofty goal of utilizing Bluetooth and interacting with other teams over it, we chose to use the Intel Edison, an unfamiliar platform. This let to some..
Challenges
Oh boy, challenges. We had a few.
The Intel Edison and the XDK
A lot of our challenges revolved around our platform choice. We chose the Intel Edison as our platform, paired with a Grove Starter Kit (as well as a couple extra Grove Relays Alex was able to procure for us.) This all seemed great, but we soon ran into some problems.
- During the quick Intel presentation, the speaker mentioned downoading the Intel XDK to get started. I was halfway paying attention as we were still brainstorming ideas, and it turns out there are not one, not two, but 3 or more IDE's available to program the Edison with, as well as 3 different methods for connecting to it!
- After installing the XDK the speaker mentioned, I soon found out this was for developing web applications and I couldn't find anything mentioning the Edison.. the hell? Turns out there's ANOTHER XDK, called the "Intel XDK, IoT Edition" for the Edison. Sigh, just wasted 30 minutes downloading and installing the wrong thing, and now we have to wait another 45 minutes to download the right one on saturated wifi. Things weren't off to a great start.
I got the right XDK and tried to get going. Out of the box, the Edison is broadcasting it's own name, an ad-hoc wifi network of "Edison". However, by this time we were sitting in a room full of Edisons called "Edison"! It took some time to decipher which was ours and get it connected. After struggling with the XDK for a while and being a little lost as to how to actually program on the device, we got a tip that we had to first flash it with Yocto linux, connect to it with serial and perform the initial config, then connect it to wifi and SSH into it from there to actually drop files on the thing and execute code. I'm sure there was a good guide on this somewhere, but we were in a hurry and didn't find it. That's what we get for choosing a new platform, but hey we were learning.
Ok, we're connected. Now what? We had to choose a language to develop in, from Python, Node.js, and a handful of others. (I would have preferred Arduino and was confused as to why that wasn't an option here when this thing had an Arduino shield breakout board on it.. but more on that later.) We chose Node.js since I have a web development background.
We moved on to design, and needed to check out the car's ignition to see if this was even possible. Lucky for us, Adam's DeLorean had the area beneath the steering wheel already removed and the ignition column was mounted sideways so it was easily accessible. We determined the leads were 12v, Ground, Accessory, Ignition, and what we called Engine Core power.
[to be continued]
Code
Below is some pseudocode we jotted down while designing and before solidifying our platform. The original source code will be posted soon - the Hackster team requested to keep the project as part of the car, and we forgot our only working copy was on the device itself :) Check back later for the full source.
Init{
bool carRunning = false;
bool Motion = false //is this over a time period?
int MotionTimeout = 20 //seconds to wait until motion is considered stopped
int rangefinder_defacto = //what the rangefinder value is if there is nobody in the car? ode>
}
Loop{
//rangefinder_value = //get rangefinder value
//motion_value = //get motion sensor value
bool BTpaired = //get bluetooth paired status (assuming # of devices paired > 0)
if (carRunning){ //assess running state of car
//car is running, is user present (range, and/or motion)?
//if not, and if BTpaired == false
//stop car
//lock car doors if configured.
}
else{ //car is stopped
if (BTpaired){
//owner has approached car.
//if configured and rangefinder_value < defacto, unlock doors.
//is there motion yet? if sustained motion for a few seconds,
if(checkFailsafes){
//if failsafes are secure, motion is detected for a few seconds, key is present, and engine is stopped, start the car.
// countdown starts, trigger movie sound, LCD counts up to 88 while playing movie sound
// beep 3, 2, longbeep START
carRunning = true;
}
}//end carRunning == false scenario
}//end loop
Comments
Please log in or sign up to comment.