Arpan Rughani
Published © MIT

Car Diagnostics with Raspberry Pi

How to transmit and receive high speed CAN or CAN FD messages using Raspberry Pi.

BeginnerFull instructions provided3,238
Car Diagnostics with Raspberry Pi

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
DB-9F to OBD-II cable
×1
ValueCAN 4
×1
neoOBD2-SIM - Portable ECU simulator
×1

Software apps and online services

libicsneo open source API
python_ics

Story

Read more

Code

Code snippet #7

Plain text
def receive_can(device):    
    msgs, error_count = ics.get_messages(device)
    print("Received {} messages with {} errors.".format(len(msgs), error_count))
    for i, m in enumerate(msgs):
       print('Message #{}\t'.format(i+1), end='')
       print('\tArbID: {}\tData: {}'.format(hex(m.ArbIDOrHeader), [hex(x) for x in m.Data]))

Code snippet #8

Plain text
def transmit_can(device):
    msg = ics.SpyMessage()
    msg.ArbIDOrHeader = 0x01 # CAN Arbitration ID
    msg.Data = (1,2,3,4,5,6,7,8) # Data Bytes go here
    msg.NetworkID = ics.NETID_HSCAN # First channel of CAN
        # msg parameter here can also be a tuple of messages
    ics.transmit_messages(device, msg)

Github

https://github.com/intrepidcs/libicsneo

Github

https://github.com/intrepidcs/python_ics

Credits

Arpan Rughani

Arpan Rughani

1 project • 1 follower
http://linkedin.com/in/arpanrughani/

Comments