RS485-CAN-HAT
From SB-Components Wiki
RS485 CAN HAT
RS485 CAN HAT is a multi node communication module, to communicate with devices in a long-range, designed dedicatedly for Raspberry Pi with an operating voltage of 3.3 V, CAN controller MCP2515 via SPI interface, onboard transceiver SN65HVD230 that is controlled via UART. It is built to support automatic TX/RX control without programming. It performs half-duplex communication and it has an onboard transceiver SP3485.
Features
- Onboard TVS (Transient Voltage Suppressor),lightning-proof & anti-electrostatic
- Standard Raspberry Pi 40 Pins GPIO Extension Headers
- Half-duplex Communication
- Long-Distance Communication via RS485/CAN functions
Specifications
- Operating voltage: 3.3V
- CAN transceiver: SN65HVD230
- RS485 transceiver: SP3485
- CAN controller: MCP2515
- Communication Protocol - RS485 and CAN
Pinout
Board PIN | Raspberry Pi GPIO (BCM) | DESCRIPTION |
---|---|---|
3V3 | 3V3 | 3.3V Power |
GND | GND | Ground |
SCK | GPIO 11 | SPI clock input |
MOSI | GPIO 10 | SPI data input |
MISO | GPIO 9 | SPI data output |
CS | GPIO 8 | SPI chip selection |
INT | GPIO 25 | Interrupt |
RXD | GPIO 14 | RS485 UART receive |
TXD | GPIO 15 | RS485 UART transmit |
RSE | GPIO 4 | RS485 TX/RX control (auto control by default) |
Installation
Python
- Stack PiRelay-V2 HAT on Raspberry Pi 40 Pin GPIO header.
- Make sure all four jumpers are connected.
- Open Terminal and clone/download the repository by typing below command in terminal:
git clone https://github.com/sbcshop/PiRelay-V2
- Your code will be downloaded to '/home/pi' directory. Use 'ls' command to check the list of directories and 'cd' command to enter directory.
cd PiRelay-V2
- 'test.py' is example code for PiRelay-V2. Run test file and play with PiRelay-V2 by running below python command.
python3 test.py
- You can also use any other GPIO of Raspberry Pi by removing the jumpers and connecting relay pin directly to the Raspberry Pi GPIO header using jumper cables or wire.
GPIO 4 Relay Not working Fix
- Click on Start button >> Preferences >> Raspberry Pi Configuration, Then click on Interfaces Tab and make sure 1-Wire is disabled.
- Click on OK button then reboot Raspberry pi.