RS-485 Shield is a cost-effective solution for serial communication networks. It can be used at data rates of 10 Mbit/s or up to 1200 m at lower speeds. RS-485 Shield is a standard overlay for Raspberry Pi. It is integrated with a simple screw terminal and DB9 interface.
Buy Now |
Properties
- One controller and one receiver per part
- EMI noise minimization
- Transmission speed up to 2.5 Mb / s
- No limitation on the driver's rate of rise
- Limited short-circuit current
- Fail-safe applications
Specifications
Feature | Value |
---|---|
Operating voltage | 3,3 V |
Interface | RS-485 DB9 InterfaceX1 RS-485Screw interfaceX1 2×13 Female connector for Raspberry X1 2×13 Additional female connector X1 GroveI2CinterfaceX1 |
Data rate | 2.5 Mbps |
Number of receivers | 32 |
Temperature range storage |
from -65°C to 160℃ |
Number of channels | 8 |
Resolution | 12-bit |
Energy consumption | Different depending on transmission speed |
Dimensions | 62 x 39,2 x 21,8 mm |
Weight | 23 g |
Packaging dimensions | 140 x 75 x 25 mm |
Gross weight | 42 g |
Typical applications
- RS-485 transmitters-receivers with low power consumption
- Level converters
- Transmitter-receivers for industrial applications in networks sensitive to electromagnetic interference
- Semi-duplex applications
Equipment overview
Exit timetable
RS-485 DB9 Interface and RS-485 Screw interface
The 485 interface uses differential signal transmission. Make sure port A is connected to port A of the 485 device and port B to port B of the 485 device.
485-A: Connect the A-end of the RS485 data cable to pin A of the MAX485 chip.
485-B: End B of the RS485 data cable, connect to pin B of the MAX485 chip.
GND: Connect to GND Raspberry Pi.
As you can see, GPIO14 and GPIO15 are used for data transmission and GPIO18 as permission signal.
The definition of logical signals can be found in the table below.
Female connector for Raspberry
We use a female 2X13 connector to connect this module to Raspberry Pi. Make sure that the pins are aligned.
Additional female connector
The RS-485 Shield takes up 26 Raspberry Pi pins, and only 5 GPIO pins are actually used. We bring out these 26 pins in case you need them for other purposes.
List of used GPIOs
GPIO number | Function |
---|---|
GPIO02 | SDA for Grove port I2C. |
GPIO03 | SCL forGrove I2Cport. |
GPIO14 | Connect to the pinDIa Max485 chip for data transmission. |
GPIO15 | Connect to the pinROa Max485 chip fordata transmission. |
GPIO18 | Connect to the pinsREiDEof the Max485 chip, acts as a permission signal. |
Port Grove I2C
We have reserved the I2C interface so it can be easily used with I2C devices. Note that the VCC of this port is 5V. Please check if the module operates with 5V.
SCL: I2C serial clock, connect to GPIO03 Raspberry Pi.
SDA: I2C serial data, connect to GPIO02 Raspberry Pi.
VCC: Connect to 5V Raspberry Pi pin.
GND: Plug into the GND pin of Raspberry Pi.
Chip Max485
For this overlay the MAX485ESA chip was used. For more information about this chip, see theMAX485 data sheet.
How to get started
Equipment
Required materials
Raspberry Pi | RS-485 Shield for Raspberry Pi |
---|---|
-
Step 1: Connect RS-485 Shield to Raspberry Pi.
-
Step 2. connect 485-A tocable A 485, connect 485-B to cable B 485.
Note If the cable is busy, communication is not possible. |
- Step 3: Connect the power supply to the Raspberry Pi with the microUSB cable.
Software
Communication test code
You can create a new Python file and copy the following code to the new file or you can download the source file in the resource download area. Then run it in your terminal.
Send code.
#!/usr/bin/env python import time serial import wasp imports send_str = "*******rs4858888--rn" os.system("echo 18 > /sys/class/gpio/export") os.system('echo out > /sys/class/gpio/gpio18/direction') ser = serial.Serial(port='/dev/ttyAMA0',baudrate =10000000,bytesize=8,stopbits=1,timeout=1) last_time = time.time() now_time = time.time() os.system('echo 1 > /sys/class/gpio/gpio18/value') time.sleep(0.01) n = 800 while n>0: ser.write(send_str) n=n-1 # time.sleep(0.001) os.system('echo 0 > /sys/class/gpio/gpio18/value')
Pickup code
#!/usr/bin/env python import time serial import wasp imports send_str = "********abcdefghijklmnopqrstuvwxyz&" os.system("echo 18 > /sys/class/gpio/export") os.system('echo out > /sys/class/gpio/gpio18/direction') ser = serial.Serial(port='/dev/ttyAMA0',baudrate =115200,bytesize=8,stopbits=1,timeout=1) last_time = time.time() while 1: now_time = time.time() if((now_time-last_time)>=1): last_time = now_time # print "172 sending" os.system('echo 1 > /sys/class/gpio/gpio18/value') time.sleep(0.01) ser.write(send_str) time.sleep(0.01) os.system('echo 0 > /sys/class/gpio/gpio18/value') os.system('echo 0 > /sys/class/gpio/gpio18/value') time.sleep(0.01) count = ser.inWaiting() if(count != 0): x=ser.readline() if "********" in x: # print "str length is. " + str(count) print x
To test the code above, you need two overlays and two Raspberry Pi or you can use a serial tool on your computer to communicate with your Raspberry Pi.
Links
-
[Zip] RS-485Shield for Raspberry Pi - Eagle files
-
[Zip]Test code in Python
-
[PDF] MAX485Technical Data Acquisition
-
[PDF] PDFWiki Format