Posts | Comments

Planet Arduino

Archive for the ‘CAN’ Category

top angle view of the can bus bff

CAN Bus is a small-scale networking standard, originally designed for cars now used for many robotics or sensor networks that need better range and addressing than I2C, and don’t have the pins or computational ability to talk on Ethernet.

The Adafruit CAN Bus BFF guide has everything you need to get started with using this BFF. There’s pages for overview, pinouts, CircuitPython, Arduino and resources for download.

Check out the full guide: Adafruit CAN Bus BFF

 

It used to be that upgrading a car stereo was fairly simple. There were only a few mechanical sizes and you could find kits to connect power, antennas, and speakers. Now, though, the car stereo has interfaces to steering wheel controls, speed sensors, rear-view cameras, and more. [RND_ASH] was tired of his 14-year-old system so he took an Android head unit, a tablet, and an Arduino, and made everything work as it was supposed to.

The key is to interface with the vehicle’s CAN bus which is a sort of local area network for the vehicle. Instead of having lots of wires running everywhere, today’s cars are more likely to have less wiring all shared with many devices.

[RND_ASH] has several videos describing the whole project and we expect there will be some more upcoming. You can see part one, below.

The project also reverse engineers how to display on the tiny screen in the dashboard. The code for the CAN bus interface is on GitHub. There’s also a written narrative on what he learned about the Mercedes interface in a different repository.

We’ve seen other cars get similar treatment, of course. If you want a gentle introduction to CAN hacking, we’ve done that, too.

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.

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.

Aug
06

OBDCAN Shield for Arduino

arduino, CAN, OBD-II, OBDCAN, shield Comments Off on OBDCAN Shield for Arduino 

ObdCanShield

The Arduino OBDCAN Shield connects Arduino board to CAN OBD-II compliant car, light truck, or motorcycle.

  • ISO15765-4 (CAN) protocol
  • Arduino R3 form factor
  • Stacking headers for expansion and connection to LCD
  • Joystick control for menu navigation
  • Provides operating voltage for the Arduino board from OBD connector
  • Serial port operating voltage either 3.3V or 5V, driven by IOREF pin
  • Standard DB-9 subconnector for use with OBD-II cable.

OBDCAN Shield for Arduino - [Link]

Sep
19

Arduino CAN-BUS OBD Gas Gauge

arduino, CAN, Gas, OBD, OBDuino32K, ODBII, SMD, Test/Measurements Comments Off on Arduino CAN-BUS OBD Gas Gauge 

winneymj writes:

My inspiration for developing this gas gauge was after purchasing a new car (Scion Xa) and wondering what MPG I was getting. After much research on ODBII protocols (Scions support CAN-BUS), and looking into open source software that already existed (OBDuino32K) I delved into my first Arduino project.

This project has taken me over a year to put together from building my own CAN-BUS shield, learning to design a circuit board, soldering SMD parts and then building my own enclosure so I could mount it in my car.

Arduino CAN-BUS OBD Gas Gauge - [Link]



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook