Raspberry PI and Can Bus

Hi
is there a way to connect Raspberry pi throw can bus? We are trying to send data to the roborio without using ethernet…
if someone did it please help.
Thanks Guy From Steampunk 1577 Israel.

If you have a USB B cable you can also plug that into the RoboRio to send data instead of through Ethernet or a wireless connection.

https://canable.io/

You can use a dongle similar to this.

You can get an MCP2515 and MCP2551 board and plug those into the rPi UART pins. You could also get a CAN-USB adapter like the CANable. There are also rPi CAN hats available.

There are products to connect an rpi to the CAN bus. But I’d say there are probably easier ways to send relatively small* amounts of data than integrating the CAN bus. It should be easier (and better documented) to send the data over network tables (using pynetworktables), one of the mutually supported serial protocols**, or even several DIO pins for small amounts of data.

 
* meaning a bunch of numbers and/or text, as opposed to pictures/video
** I believe RS232, I2C, SPI are all supported by both, and there may be others I’m forgetting about

2 Likes

Be careful with that. IIRC, the RoboRIO uses RS-232 signalling, while the UART on the Pi uses “TTL serial”, which is inverted compared to RS-232. Even if both devices share a protocol, the signal levels have to match, too. For example, I think that trying to connect the RIO’s serial port to the Pi might blow up the Pi, since the Pi uses 3.3 V signals and isn’t 5 V tolerant.

DISCLAIMER: Don’t take my word for it, check the datasheets before you plug anything in.

4 Likes

The serial port header is rs232, but on the mxp port is a 3.3v uart. So you can safely hook into those pins with a pi.

1 Like

RS232 uses a negative polarity to indicate a 1 and a positive polarity for a 0. The pi can handle something like RS485, but not RS232.

Unless you get an adapter, I don’t think RS232 will work with the pi.

Er, I don’t think so, not without some additional circuitry. RS-485 uses differential signalling, so you’d need line drivers and receivers to convert the differential signals to single-ended to send to the Pi’s UART. (And line termination, if you want to do things properly.)

Ah, you’re right. It looks like RS485 was different from what I thought it was.

How many Raspberry PIs are you putting on the robot?

(My Hebrew is not perfect but it seems like more than 1)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.