1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Raspberry Pi PiCAN

frosty985 Dec 13, 2017

  1. frosty985

    frosty985 New Member

    9
    6
    3
    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
     
    Dee60 and S. like this.
  2. frosty985

    frosty985 New Member

    9
    6
    3
    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: Dec 13, 2017
    S. likes this.
  3. eLeCtRaSh

    eLeCtRaSh Member

    69
    3
    8
    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
     
  4. eLeCtRaSh

    eLeCtRaSh Member

    69
    3
    8
  5. aqibi2000

    aqibi2000 A3 170 Quattro

    225
    23
    18
    Arduino is so much more cost effect for manipulating CAN. Built a CD emulator for £2.50
     
  6. frosty985

    frosty985 New Member

    9
    6
    3
    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.
     
  7. S.

    S. Save the manuals Team Ibis TFSI Owners Group Audi S3 quattro Manual

    2,094
    581
    113
    Interesting.
    Seen few projects like that.
    i think it's way out of my knowledge to get into it.
     
  8. frosty985

    frosty985 New Member

    9
    6
    3
    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
     
  9. maxpayne

    maxpayne Active Member

    424
    71
    28
    Sounds exciting. Instead of spending £100 on a Dension kit, I could add BT streaming and DIS display via CD changer emulation?
     
  10. frosty985

    frosty985 New Member

    9
    6
    3
    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
     
  11. aqibi2000

    aqibi2000 A3 170 Quattro

    225
    23
    18
    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.
     
  12. frosty985

    frosty985 New Member

    9
    6
    3
  13. ch1z64

    ch1z64 C'mon you's bhoy's in Green TFSI Owners Group Silver Supporter Team Sprint Audi S3 Manual

    1,072
    162
    63
    Just never thought off just going to the Bakers for some Raspberry pie . Following with interest adding so pics would help forum users
     
  14. maxpayne

    maxpayne Active Member

    424
    71
    28
    I did. No joy.
     
  15. frosty985

    frosty985 New Member

    9
    6
    3
    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.
     
    ch1z64, S. and maxpayne like this.
  16. frosty985

    frosty985 New Member

    9
    6
    3
    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.
     
  17. frosty985

    frosty985 New Member

    9
    6
    3
    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
     

Share This Page