Truck Telemetry – The Beginning
My Truck’s name is Bolton. I realize not everyone has a name for their vehicle, but whynot. Bolton is a couple years old now, right about 18 years old and it has a few miles under its belt, about 325k. Since its a reasonably old vehicle, it misses out on many of the features that all the new cars have. Let’s change that.
Whats the problem?
I work in tech, so there shouldn’t be any reason I can’t auto-start the truck from anywhere in the world, right? This project/series of posts will be about adding remote start and a few other ‘top of the line’ features to my “Legal Aged” truck.
This first post is an outline of what it’ll need/how it’ll work and some of the features that I want to add.
Since I’m not much of a programmer (yet) and I’ve started using it quite a bit at home, my software platform of choice is actually going to be a home automation platform, Home Assistant. With HA, it is incredibly easy to tie in new features, have things run side-by-side and start building ‘smart’ features. Just 2 lines* and voila, I can now tell if my phone is near Bolton. Two more lines* and every time leave the Bolton un-attended, it can auto-lock itself!
HA certainly isn’t built to run in a truck, but there are a surprising number of features I want to add that are incredibly easy to do in HA.
About a year ago, I visited a local shop (12v auto) to install about as base model of a remote-system as possible. It was just under $200 installed and well worth it. With this little keyfob I could now (mostly) remote start my truck AND lock/unlock the doors! The one big-ish downside is the keyfob has pretty limited range (couple hundred feet, far less in a parking lot) and it’s just a broadcast; I dont get any response back other than the rumble of the truck that Bolton heard my request.
My plan is to use that keyfob, install it in the truck and use a raspberry pi (running HA) to ‘press’ the start/lock/unlock buttons. Simple enough.
Once remote-start is working, we can add some more features.
– But you said “Anywhere in the world!” that sounds like its all running in the truck.
You’d be correct… SO, let’s add the ability to control the whole thing from anywhere. This is actually a little tricky to do on a home-brew/self-hosted project but not too hard. To start off, I’ll use “USB Tethering” on an android phone using a free Project Fi sim card. Project Fi has a not-well-known perk. That perk being free data sims. You can simply request a data sim that is tied to your existing fi service. They’ll send it over for free and you can use it for free. The data you use simply gets added to your account’s balance. Voila, now we have ‘free’ cellular data coverage for the Pi. Someday I’ll swap the Fi phone with a USB cellular modem, maybe.
Flipping between wifi and cellular though poses a problem, the Truck’s IP address will keep changing. Since it keeps changing and we don’t know what it’ll change to or when, we need for the truck to reach out to us. SO, lets do it like the chat-rooms of old, but modernized a little…
MQTT is very similar to a chat room in that there are topics(rooms) and payloads(messages). You can ‘subscribe’ to a topic just like joining a chat room and listen in to anything that people/devices post. Since our ‘chat’ server/MQTT Server is living at my house, it has a relatively static IP address so the pi can always contact the homestead. There are lots of public offerings for this type of service, Google Cloud’s PubSub is the first that comes to mind (not that I’m biased, AT ALL), but for the sake of self-hosting all of this, I’m using a self-hosted MQTT server, called a ‘Broker’, by the name of Mosquitto. ***
What do I want at the end of the day?
What a big question.. What all do I want for this project to ultimately do? I like being able to see the ins and outs of what’s going on. I’d love to get a few numbers back from the truck so I can know if some action needs to be taken, or have those actions happen automatically based on the situation.
- Monitor the fuel level, send a notification/reminder when it gets to a particular level.
- Auto-lock the doors when the truck isn’t running and I’m not nearby
- Start the truck via our Google Home’s
- Monitor Battery voltages (Bolton has 4! large capacity batteries across two banks). Connect the two banks when the truck is running to keep things charged.
- Monitor the cabin air temperature! (No one likes walking out to a cold vehicle)
This is a bit tricky. Luckily I already have a Fi phone and a simple Remote start system installed as well as some basic electronics. Additional money I’ll have to put in though, I would only guess only about ~ 45$. And a vast majority of that is a Model 3 B+ raspberry Pi (38$). Monthly cost (fi data) shouldn’t be more than a dollar or two since we’ll connect to and use the wifi first, then cellular for the road and mqtt is incredibly light-weight.
Hopefully this is interesting to others. Updates here will very likely be quite slow (I love writing! /s) but I’ve already made significant progress so I’m currently playing catch-up! 🙂 I’ll probably end up posting more detailed steps on the Rawlk Blog.
* Yes, seriously, the BT Tracker only takes two lines to get up and running ** Automations have a little fluff, it's actually ~8 lines of 'yaml' *** Can you tell I'm not an english major?