Reddit’s “shower thoughts” on my car’s factory radio screen.

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:

RP2_Pinout

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:

File 2016-05-16, 8 09 40 PM

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.

  10 comments for “Reddit’s “shower thoughts” on my car’s factory radio screen.

  1. May 24, 2016 at 1:33 pm

    Do you have that bug where if you put the media player in shuffle mode, it doesn’t remember that it was in shuffle mode when you restart your car? I have a Hyundai Santa Fe that has this problem and I am doing something similar to this but not with the CAN bus. There is a iPod connector that looks like a USB jack but it also doubles as a port for the Apple Accessories Protocol. I plan on using a CHIP computer to feed the song title and play the audio, much like your project, but serial port instead of CAN bus.

    I got a questions:

    Is this the same CAN bus that’s connected to the ODBII debug port?

    Is there any way of detecting if the XM button is pressed?

    Great project!

    • Harin
      May 24, 2016 at 10:14 pm

      Hey, thanks for leaving a comment!

      I never use the media player. I may have used it a handful of times in the 4 years I’ve had the car, so I don’t know if the shuffle setting persists between cranks. I have not heard about the “Apple Accessories Protocol” but thank you very much for the information! I can probably use this to pass the track info from my tablet. I’ll start playing with this soon.

      This isn’t the same CANbus that’s connected to engine data. There are typically two CANbus networks, one high speed, one low speed. The one that contains “infotainment” messages is the low speed. You could bridge them using a RPi with two MCP2515’s or a slave Arduino with an MCP2515 (the method I would choose).

      Yes, the XM screen message is the message relayed to node 006 in my code. Please let me know if I can help you anymore. My knowledge is very limited but I may be able to help you get started at the very least.

      • Bogdan
        June 14, 2016 at 11:56 pm

        Great post! Could you detail a Little bit more the hardware setup? Did you used an COTS MCP2515 shield for the Arduino, or you have build it by yourself? I am using a PiCan (uses also msp2515) but I am having problems configuring the SPI to work with this shield.

        • Harin
          June 15, 2016 at 1:09 am

          You would find the most information for the Arduino portion on the first post of this series. I used the cheapest mcp2515 board on aliexpress (the one in the photo).

          The main part of this is run off of the Raspberry Pi with the slave Arduino really only acting as another Canbus device. You can use the Arduino as a more complex player in this scenario but with the Raspberry Pi handy I didn’t bother too much with the Arduino.

          What kind of Arduino are you using? I might be able to help you troubleshoot the problem you’re having with the SPI.

          Thanks for the comment!

          • Bogdan
            June 15, 2016 at 1:55 am

            I am only using a RPi 2 (I also have a RPi 3, RPi 1 and RPi A 🙂 ) + PiCan (http://skpang.co.uk/). Following their tutorial on how to enable this shield on the RPi (http://skpang.co.uk/blog/archives/1165) I am having problems enabling the SPI. After I choose yes on the raspi-config / advance / SPI, it fails to enable the SPI. I am using the latest raspbian. I have also checked the /boot/config.txt and I have dtparam=spi=on

          • Harin
            June 15, 2016 at 2:42 am

            So you’re having difficulty with enabling SPI on the Raspberry Pi? It could be possible that the version of raspbian you are running is causing the issue. I use the latest Wheezy version that was released and had good results with that. I have avoided Jessie due to a few issues I ran into that weren’t present in Wheezy.

Leave a Reply