Developing An Automatic Tool For CAN Bus Hacking

In the old days, a physical button or switch on the dashboard of your car would have been wired to whatever device it was controlling. There was potentially a relay in the mix, but still, it wasn’t too hard to follow wires through the harness and figure out where they were going. But today, that concept is increasingly becoming a quaint memory.

Assuming your modern car even has physical buttons, pushing one of them likely sends a message over the CAN bus that the recipient device will (hopefully) respond to. Knowing how intimidating this can be to work with, [TJ Bruno] has been working on some software that promises to make working with CAN bus user interfaces faster and easier. Ultimately, he hopes that his tool will allow users to rapidly integrate custom hardware into their vehicle without having to drill a hole in the dashboard for a physical control.

But if you’re the kind of person who doesn’t like to have things done for them (a safe bet, since you’re reading Hackaday), don’t worry. [TJ] starts off his write-up with an overview of how you can read and parse CAN messages on the Arduino with the MCP2515 chip. He breaks his sample Sketch down line by line explaining how it all works so that even if you’ve never touched an Arduino before, you should be able to get the gist of what’s going on.

As it turns out, reading messages on the CAN bus and acting on them is fairly straightforward. The tricky part is figuring out what you’re looking for. That’s where the code [TJ] is working on comes in. Rather than having to manually examine all the messages passing through the network and trying to ascertain what they correspond to, his program listens while the user repeatedly presses the button they want to identify. With enough samples, the code can home in on the proper CAN ID automatically.

The upside to all this is that you can activate aftermarket functions or hardware with your vehicle’s existing controls. Need an example? Check out the forward-looking camera that [TJ] added to his his 2017 Chevy Cruze using the same techniques.

Continue reading “Developing An Automatic Tool For CAN Bus Hacking”

Sniffing CAN To Add New Features To A Modern Car

It used to be that there wasn’t a problem on the average car that couldn’t be solved with a nice set of wrenches, a case of beer, and a long weekend. But the modern automobile has more in common with a spaceship than those vintage rides of yesteryear. Bristling with sensors and electronics, we’re at the point that some high-end cars need to go back to the dealer for even minor repairs. It’s a dark time for the neighborhood grease monkey.

But for those of us who are more likely to spend their free time working with a compiler than a carburetor, a modern car can be an absolute wonderland. That’s what [TJ Bruno] found when he recently started experimenting with the CAN bus on his 2017 Chevy Cruze. Not only was he able to decode how the different switches and buttons on the dashboard communicated with the vehicle’s onboard systems, he was able to hack in a forward-looking camera that’s so well integrated you’d swear it was a factory option.

The idea started simple enough: using some relays, [TJ] planned on physically switching the video feed going to the Chevy’s dashboard between the stock rear camera and his aftermarket front camera. That’s all well and good, but the car would still only bring up the video feed when the gear selector was put in reverse; not exactly helpful when he’s trying to inch his way into a tight spot. He needed to find a way to bring up the video display when the car was moving forward.

With a PCAN-USB adapter connected to the car’s OBD-II port, he shifted into and out of reverse a few times and noted which messages got transmitted on the network. It wasn’t long before he isolated the proper message, and when he injected it with his laptop, the dashboard display switched over to the backup camera regardless of what gear the car was in. Building on this success, he eventually figured out how to read the status of all the buttons on the car’s dashboard, and programmed an Arduino to listen for the appropriate signals.

The final piece of the puzzle was combing bringing both of these capabilities, so that went the appropriate button was pressed on the dashboard the Arduino would not only send the signal to turn on the video display, but kick the relays over to switch the camera source. Now [TJ] has a front-facing camera that can be called up without having to kludge together some button or switch that would never match the modern styling of the vehicle’s interior.

A couple years back we saw a similar project to add a backup camera to a Peugeot 207 that was too old to have one from the factory, and more recently we saw how CAN hacking can allow you to fight back when your car’s touch screen interface robs you of simple pleasures like pushing buttons and turning knobs.

Continue reading “Sniffing CAN To Add New Features To A Modern Car”

Predicting Weather With The Internet Of Cars

Follow this train of thought: cars have sensors, cars are in frequent use over large areas, cars are the ultimate distributed sensor network for weather conditions.

Many years ago, as I wasted yet another chunk of my life sitting in the linear parking lot that was my morning commute, I mused that there had to be a way to prevent this madness. I thought: What if there was a way for the cars to tell each other where slowdowns are? This was long before smartphones, so it would have to be done the hard way. I imagined that each vehicle could have a small GPS receiver and a wireless transceiver of some sort, to send the vehicle’s current position to a central server, which would then send the aggregate speed data for each road back to the subscriber’s car. A small display would show you the hotspots and allow you to choose an alternate route. Genius! I had finally found my billion dollar idea.

Sadly, it was not to be. Seemingly days later, everyone on the planet had a GPS-equipped smartphone in his or her pocket, and the complex system I imagined was now easily implemented as software. Comically, one of the reasons I chose not to pursue my idea is that I didn’t think anyone would willingly let a company have access to their location information. Little did I know.

So it was with great interest that I read an article claiming that windshield wiper data from connected cars can be used to prevent floods. I honestly thought it was a joke at first, like something from a Monty Python sketch. But as I read through the article, I thought about that long-ago idea I had had, which amounted to a distributed sensor platform, might actually be useful for more than just detecting traffic jams.

Continue reading “Predicting Weather With The Internet Of Cars”

Juicing Up The Chevy Volt With Raspberry Pi

While Chevrolet’s innovative electric hybrid might officially be headed to that great big junkyard in the sky, the Volt will still live on in the hearts and minds of hackers who’d rather compare amp hour than horsepower. For a relatively low cost, a used Volt offers the automotive hacker a fascinating platform for upgrades and experimentation. One such Volt owner is [Jared Stafford], who’s recently made some considerable headway on hacking his hybrid ride.

In an ongoing series on his blog, [Jared] is documenting his efforts to add new features and functions to his Volt. While he loves the car itself, his main complaint (though this is certainly not limited to the Volt) was the lack of tactile controls. Too many functions had to be done through the touch screen for his tastes, and he yearned for the days when you could actually turn a knob to control the air conditioning. So his first goal was to outfit his thoroughly modern car with a decidedly old school user interface.

Like most new cars, whether they run on lithium or liquefied dinosaurs, the Volt makes extensive use of CAN bus to do…well, pretty much everything. Back in the day it only took a pair of wire cutters and a handful of butt splice connectors to jack into a car’s accessory systems, but today it’s done in software by sniffing the CAN system and injecting your own data. Depending on whether you’re a grease or a code monkey, this is either a nightmare or a dream come true.

Luckily [Jared] is more of the latter, so with the help of his Macchina M2, he was able to watch the data on the CAN bus as he fiddled with the car’s environmental controls. Once he knew what data needed to be on the line to do things like turn on the fan or set the desired cabin temperature, he just needed a way to trigger it on his terms. To that end, he wired a couple of buttons and a rotary encoder to the GPIO pins of a Raspberry Pi, and wrote some code that associates the physical controls with their digital counterparts.

That’s all well and good when you need to mess around with the AC, but what’s the Pi supposed to do the rest of the time? [Jared] decided a small HDMI display mounted to the dash would be a perfect way for the Raspberry Pi to do double duty as information system showing everything from battery charge to coolant temperature. It also offers up a rudimentary menu system for vehicle modifications, and includes functions which he wanted quick access to but didn’t think were necessarily worth their own physical button.

In the video after the break, [Jared] walks the viewer through these modifications, as well as some of the other neat new features of his battery powered bow tie. What he’s already managed to accomplish without having to do much more than plug some electronics into the OBD-II port is very impressive, and we can’t wait to see where it goes from here.

Today there are simply too many good electric cars for hybrids like the Chevy Volt and its swankier cousin the Cadillac ELR to remain competitive. But thanks to hackers like [Jared], we’re confident this isn’t the last we’ve seen of this important milestone in automotive history.

Continue reading “Juicing Up The Chevy Volt With Raspberry Pi”

The Thrill Of Building Space Hardware To Exceptionally High Standards

It’s fair to say that the majority of Hackaday readers have not built any hardware that’s slipped the surly bonds of Earth and ventured out into space proper. Sure we might see the occasional high altitude balloon go up under the control of some particularly enterprising hackers, but that’s still a far cry from a window seat on the International Space Station. Granted the rapid commercialization of space has certainly added to that exclusive group of space engineers over the last decade or so, but something tells us it’s still going to be quite some time before we’re running space-themed hacks with the regularity of Arduino projects.

Multi-use Variable-G Platform

That being the case, you might assume the protocols and methods used to develop a scientific payload for the ISS must seem like Latin to us lowly hackers. Surely any hardware that could potentially endanger an orbiting outpost worth 100+ billion dollars, to say nothing of the human lives aboard it, would utilize technologies we can hardly dream of. It’s probably an alphabet soup of unfamiliar acronyms up there. After all, this is rocket science, right?

There’s certainly an element of truth in there someplace, as hardware that gets installed on the Space Station is obviously held to exceptionally high standards. But Brad Luyster is here to tell you that not everything up there is so far removed from our Earthly engineering. In fact, while watching his 2018 Hackaday Superconference talk “Communication, Architecture, and Building Complex Systems for SPAAACE”, you might be surprised just how familiar it all sounds. Detailing some of the engineering that went into developing the Multi-use Variable-G Platform (MVP), the only centrifuge that’s able to expose samples to gravitational forces between 0 and 1 g, his talk goes over the design considerations that go into a piece of hardware for which failure isn’t an option; and how these lessons can help us with our somewhat less critically important projects down here.

Check out Brad’s newly published talk video below, and then join me after the break for a look at the challenges of designing hardware that will live in space.

Continue reading “The Thrill Of Building Space Hardware To Exceptionally High Standards”

A Fully Automatic Electric Can Crusher

Those of us who recycle our empty drink cans know the annoying storage problem these containers present. For an object with very little metal, a can takes up a huge amount of space, and should you possess a greater than average thirst you can soon end up with a lot of space taken up with stacks of cans. The solution of course is to crush them, and while there are many simple solutions involving hinged blocks of wood or lever systems, this is 2019! We have Machines to that kind of thing for us! [All Things Electro-Mechanical] thinks so anyway, for he has created an automatic can crusher that is a joy to behold.

At its heart is a 120V AC powered linear actuator, which crushes a can held in a welded steel guide. As the can is crushed it drops into a waiting bin, and when the actuator retracts a fresh can drops down from a hopper. Control is handled by a Raspberry Pi, and there are end sensors for the actuator and an optical sensor for the can hopper. As it stands, once the last can is in place the machine stops due to the optical sensor registering no can in the hopper, but no doubt a software change could cause it to execute a single crush cycle after the last can it detects.

This machine would be an ideal candidate for a simple industrial automation system, but however it is controlled it would save its owner from an embarrassing test of strength. Take a look, we’ve posted the two videos showing it in action below the break.

Thanks [Baldpower] for the tip.

Continue reading “A Fully Automatic Electric Can Crusher”

Emulating OBD-II On The ESP32

It used to be that you could pop the hood and with nothing more than flat head screwdriver, some baling wire, and tongue held at the optimal angle, you could fix anything that ailed your car. But today, for better or for worse, the average automobile is a rolling computer that runs on gasoline and hope (if it even still has a gasoline engine, that is). DIY repairs and maintenance on a modern car is still possible of course, but the home mechanic’s toolbox has needed to evolve with the times. If you want to do anything more advanced than changing a tire, you’ll really want to have the gear to interface with the vehicle’s computer via the OBD-II port.

But for some, even that isn’t enough. [limiter121] recently wrote in to tell us of an interesting project which doesn’t read the OBD-II port in a vehicle, but actually emulates one. Like so many others this hack was born out of necessity, as a way to test an OBD-II project without having to sit out in the driveway all day. It allows you to create fictitious speed and engine RPM values for the OBD-II device or software under test to read, complete with a slick web interface to control the “car”.

So what makes it tick? Surprisingly little, actually. At the most basic level, an ESP32-WROOM-32 is connected up to a SN65HVD230 CAN transceiver chip. You’ll also need a 3.3V power supply, as well as a USB to serial adapter to do the initial programming on the ESP32. From there it’s just a matter of compiling and flashing the code [limiter121] has made available in the GitHub repo.

If you’re wondering if such products don’t already exist on the commercial market, they do. But like so many other niche projects, the price is a bit hard to swallow for the home hacker. Compared to the nearly $300 USD list price of commercial offerings such as the Freematics OBD-II Emulator, building one of these ESP32 based emulators should only cost you around $20.

Unless you’re developing an OBD-II reader, you probably don’t have much use for an OBD-II emulator. But this project could still be useful for anyone who wants to learn more about OBD from the comfort of their couch.