Raspberry Pi PiCAN

frosty985

Registered User
Joined
Dec 13, 2017
Messages
11
Reaction score
6
Points
3
Location
Cardiff
Hi guys,

I've had a little project in mind of connecting a RaspberryPi to my '04 1.9Tdi. What the end of this will be is yet to be decided.

I've found a lot of information and examples here, but can't find any information on the can bus PIDs, so thought I'd post my own findings here, for anyone else, or as just a back up for me.

I have used a Raspberry Pi 3 (so has Bluetooth and WiFi built in)
4gb SD Card
and USB key sticks
for the CAN connection, the PiCAN HAT from skpang.co.uk
I previously added a device to connect a phone/iPod with a 3.6mm headphone cable which tricks the radio into thinking there is a CD changer installed, I used this to splice into the CANH and CANL to connect to the PiCAN HAT

Once the Pi is connected and powered up, ssh in and run the following:


## run as root

# remove unneeded packages
apt remove --purge scratch minecraft-pi sonic-pi dillo gpicview penguinspuzzle Wolfram-engine libreoffice
apt-get clean && sudo apt-get autoremove
apt update
apt upgrade

# install packages
apt install can-utils
apt install realvnc-vnc-server
apt install wireshark

# add needed to /boot/config.txt
sed 's/#dtparam=spi=on/dtparam=spi=on/' -i /boot/config.txt
echo "dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25" >> /boot/config.txt
echo "dtoverlay=spi-bcm2835-overlay" >> /boot/config.txt
echo "dtoverlay=spi-dma-overlay" >> /boot/config.txt

# add to /etc/network/interfaces
echo "auto can0" >> /etc/network/interfaces
echo "iface can0 inet manual" >> /etc/network/interfaces
#
# 100kbs (info bus) ###
echo " pre-up ip link set $IFACE type can bitrate 100000 listen-only off triple-sampling on" >> /etc/network/interfaces
echo " up /sbin/ifconfig $IFACE up" >> /etc/network/interfaces
echo " down /sbin/ifconfig $IFACE down" >> /etc/network/interfaces

# reboot at this point

At the moment I am connected to the info bus, bit rate of 100kbs
 
  • Like
Reactions: Dee60 and S.
Found PID Codes..

So far I have discovered the following codes and what they do

00 00 03 63 : sends current display from radio to DIS row 1 : example CD1 or RADIO 1 (station)
00 00 03 65 : sends current display from radio to DIS row 2 : example TR1 or RM 1 (preset)
00 00 06 5f : Broadcast of VIN number (sent every .2 of a second across 3 packets)
 
Last edited:
  • Like
Reactions: S.
Every time you have project in mind, first you have to ask your self "why am i doing this", what i want to accomplish.
Then you can work towards goal.

Working on project that you yet are to decide what you want to do with it is dead project all along. Set goal, ask question which will solve problem or help you solve problem toward your goal
 
Arduino is so much more cost effect for manipulating CAN. Built a CD emulator for £2.50
 
Thanks for the information, read about the Carberry before, interesting project.

When I said end project is yet to be decided, I got a few plans... just not sure which will be the end one.

So far, put the road I am on speed limit and road name in the DIS.
I have a gps dongle to get lon and lat, then uses openmaps to find the OSREF to then get the information on the road, save that a file to save download it every refresh.
 
Interesting.
Seen few projects like that.
i think it's way out of my knowledge to get into it.
 
Next useful code I have found

00 00 06 61 : keep alive signal from radio to DIS ... seems sends different info possibly part of key code functions
 
Sounds exciting. Instead of spending £100 on a Dension kit, I could add BT streaming and DIS display via CD changer emulation?
 
I have been looking into the pi as a Bluetooth receiver, but read sound quality from pi isn't brilliant.

Look on eBay for emulator though, pretty sure they had Bluetooth ones
 
IF you search around properly you can easily build an arduino (Attiny85) CD emulator to Input aux at the cost of about £1, then you can use a regular Bluetooth A2DP receiver to feed in the audio signal.
 
Just never thought off just going to the Bakers for some Raspberry pie . Following with interest adding so pics would help forum users
 
Sorry for delay.. I had a dodgy power lead which killed my sdcard, and have had to rewrite my scripts.

I've set up a github account and will add link later.

Also will put some pictures up tomorrow of where I've attached to the can bus and what the out puts look like.

And I'll also link to the instructions for connecting as a Bluetooth speaker which works well.
 
  • Like
Reactions: ch1z64, S. and maxpayne
links to git hub

https://github.com/frosty985/dashNav

the rebuild instructions lists everything, not exactly step by step, but everything is there... also, they are now for the latest version of raspbian stretch, actually easier to set up Bluetooth.
 
taken a couple of pics, need to resize to upload them..

but.. found code for when ignition switch is on

00 00 01 51

will be using this to auto stop/start the tracker script
 
I’m also thinking of looking into this as a possible way of adding DAB. I’ve recently fitted digital TV as a way of getting digital radio but i really want to give it a kinda factory fitted look. I’m thinking of possibly using the RNS-E to control the pi via a pi hat.
 

Similar threads