The SmartEdge IIOT GatewaySmartEdge IIOT Gateway is a Raspberry Pi 3 Compute based industrial Linux box. It runs Raspbian with some additions. There's a set of industrial hardware extensions. In this blog I review the isolated RS-485 bus. |
Hardware
The gateway has a physical RS-323 / 485 driver. That's a piece of hardware that's not available on the standard Raspberry Pi family.
I'm going to test it with an Arduino MKR 485 shield.
SmartEdge
By default, the serial output is configured as RS-485 half-duplex, terminated. This is how I'm going to test it.
image source: SmartEdge Industrial IoT Gateway User Guide
The pins to use are GND, A- and B+.
image source: SmartEdge Industrial IoT Gateway User Guide - click for a sharp image
Arduino MRK 485 Shield
This one is by default full duplex. Move the middle switch left to switch to half duplex.
image source: https://store.arduino.cc/arduino-mkr-485-shield
The pins to use are GND, Y and Z (on the MKR 485, these are the data pins in half duplex mode)
images source: https://datasheets.maximintegrated.com/en/ds/MAX3157.pdf
While the SmartEdge's bus is isolated, the one on the Arduino isn't. It does not matter for this application.
Connection
- GND to GND,
- SmartEdge A to Arduino Z,
- SmartEdge B to Arduino Y.
Twist the two data lines.
I've used an Arduino MKR WIFI 1010
Software
I'm using 9600 baud, because that's what the Arduino example is set to.
SmartEdge
The character device to interface with the RS-485 bus is /dev/ttySC0.
Set its speed to 9600.
stty 9600 < /dev/ttySC0
If you want to restore the original setting later, query it first:
stty -F /dev/ttySC0 -a
Then use a terminal program to connect to it. I installed screen.
sudo apt install screen screen /dev/ttySC0
To terminate the screen session type ctrl+a, then k.
Arduino
I loaded the RS485Passthrough example. The opened the Serial Monitor at 9600 baud.
In the image below you see the results, after typing 12345 in the Arduino monitor and 98765 in the SmartEdge terminal.