In order to test out some of the commands I’ve managed to sniff, I’ll have to isolate the LCD from the canbus network. The “proof of concept’ project will be getting a RaspberryPi to get the hottest post of the hour from Reddit’s shower thoughts subreddit and print it to the factory LCD. I was unsure if the Arduino would be able to keep up with listening to one Canbus interface reliably while transmitting to another as there are hundreds of messages flying on this network every second. I decided it would be better to use a RaspberryPi with an MCP2515 to transmit to the LCD screen and then have it use an Arduino connected to an MCP2515 as a receiving node for the Canbus network.
I set up a Raspberry Pi with wheezy and connected the MCP2515 to the GPIO pins. The SPI pins on the Raspberry Pi 2 (The model I used) are the pink ones in this image:
I borrowed that picture from Microsoft’s github and I hope they don’t mind…
Luckily, the library I used for the RPi was able to work with the 8MHz crystal so I didn’t have to sacrifice another Pro-Mini. However, there is a modification that must be made in order to make it work with the 3.3V environment of the RPi. You can follow this guide to see the how to get your setup configured properly and running. The Hyundai Genesis Coupe’s infotainment canbus uses a baud rate of 100k so I had to make sure that I set the can0 interface to that baud rate whenever I initialized it. Reading through the entire linked thread will leave you with a fully working can0 interface that auto-starts with the RPi.
In order to be able to scrape posts from reddit in a python environment, you must install and use PRAW. The code I managed to cobble together is available on my github. I have no programming experience other than a few Arduino projects around the house so my code is definitely not optimal. Hopefully this will atleast give you some kind of starting point for your own project and you will be able to see the underlying process for making this work.
The Hyundai Genesis Coupe’s infotainment bus will print the artist name and song title when it’s on the XM screen. Having dealt with SiriusXM numerous times due to double billings and service interruptions I won’t ever be a subscriber of its service ever again so it was nice to be able to add a purpose for that useless XM button on my dashboard. The display receives ASCII characters in an 8 item hex array including a message ID and a row identifier. My main script retrieves the top post from shower thoughts and converts the characters to their hexadecimal equivalents, adds the message ID and row identifier, and stores it in an SQL database. The current iteration of my system then calls a second script that adds a message to the SQL database containing the current time which then calls a third script that finally transmits the contents of the SQL database to the LCD. My reason for choosing this method is that eventually I’ll be able to screen the messages intended for the LCD on the primary canbus network and add the ones I want to keep to the SQL database while removing the ones I don’t need anymore.
This is the stage I am at:
It correctly prints the time and the top post from Reddit. I have yet to figure out the canbus message that triggers scrolling of the message. I was experimenting with having the RPi drop the first 3 characters and reprint the message but this isn’t as elegant as I would like and would also make it difficult to make the display react to an interruption such as a received phone call. I will have to reinstall the LCD in the car and keep sniffing until I can figure out how the message scrolling works. I hope this gives you enough information to get started with your own project. My next post will continue from here after I’ve managed to sniff the scrolling message from the canbus network.
EDIT: Thanks for the post hackaday! Since my last post, I’ve managed to get the scroll working. If you’re interested in seeing how this progresses, please consider subscribing. I’m a full time student with a full time job so I don’t get to tinker as much as I’d like to but I will keep this page up to date on all my projects.