Blog
Recent Posts
Installing python-can on the Raspberry Pi
Posted by
onThis post demonstrates the steps required to install python-can on the Raspberry Pi for use with PiCAN2, PiCAN3, PiCAN-M CAN Bus HATs.
First make sure the driver is installed. See:
PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi...
Now install python-can:
pip3 install python-can
Check there is no error.
You can now initialize the CAN interface:
sudo /sbin/ip link set can0 up type can bitrate 500000
Check there is no error message returned. Now we can try the interactive python shell. Start typing at the prompt:
python3
To sent a message out type the following lines:
import can
bus = can.interface.Bus(channel='can0', bustype='socketcan_native')
msg = can.Message(arbitration_id=0x7de,data=[0, 25, 0, 1, 3, 1, 4, 1])
bus.send(msg)
Check CAN frames on the bus.
To received messages and display on screen type:
notifier = can.Notifier(bus, [can.Printer()])
For more Python sample code, see:
PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi
This post provides you a brief overview on the steps required to install the software driver on the Raspberry Pi for use with the PiCAN2, PiCAN3, and PiCAN-M CAN Bus HATs, including the dual-port and SMPS versions. Please refer also to the board's user manual. Start by creating a new SD card image with the Raspberry Pi [...]
Thermocouple Measurement HAT Adds Industrial Temperature Measurement To The Raspberry Pi Platform
Measurement Computing Corporation has announced the release of their MCC 134 thermocouple measurement HAT for Raspberry Pi. The MCC 134 brings industrial temperature measurement capabilities to the vastly popular Raspberry Pi platform. The device comes with four thermocouples (TC) inputs capable of measuring popular TC types, such as J, K, R, S, T, N, E, and B. [...]
PiCAN2 CAN Bus HAT for Raspberry Pi - Getting Access To The 40-pin GPIO Header
In the past, we had received a number of inquiries regarding the PiCAN2's 40-pin GPIO header, which is designed in a way that it prohibits access to unused GPIOs. Besides the power supply, the PiCAN2 board (one CAN port) itself uses only 6 signals, while the remaining signals cannot be accessed when the board is [...]
PiCAN2 CAN Bus Board for Raspberry Pi - Functionality Test
The PiCAN2 board provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. It uses the Microchip MCP2515 CAN Bus controller with MCP2551 CAN Bus transceiver. Connections are made via a 4-way screw terminal or DSUB-9 connector. This board is also available with a 5VDC/1A SMPS (switch mode power supply) that can power both the Pi and [...]
PiCAN2 Duo CAN Bus Board for Raspberry Pi - Functionality Test
The PiCAN2 DUO board provides two independent CAN Bus interfaces for the Raspberry Pi. It uses the Microchip MCP2515 CAN Bus controller with MCP2551 CAN Bus transceiver. Connections are made via a 4-way screw terminal. This board is also available with a 5VDC/1A SMPS (switch mode power supply) that can power both the Pi and the [...]