I recently had a power surge come through my Pentair IntelliTouch-based pool control system, destroying its control board, and unfortunately destroying the control module of my home automation system on the other side of a serial connection into it. This was likely the fault of my A/V installer having no clue about electricity, serial comms, etc. combined with the lack of meaningful guidance from the home automation vendor Elan Nortek Security & Control LLC, maker of the Elan G! system my home uses. Their install guide, for example:
It’s just like hey, plug your serial crap in using our pin-outs and you’re good to go. It doesn’t mention that RS485 could present a very serious issue with ground differential if it’s being wired to a device with both grounds connected together, or between devices with a dissimilar ground, which is very possible given the use case would often involve pool and/or sprinkler equipment, which could be in an adjacent building. Low voltage installers have no formal training on electrical codes and concepts, they just know hey + to +, – to -, we got us some serialz woohoo.
In any case, what my installer did was steal a four conductor speaker wire that was in the vicinity for some yet to be installed speakers. Given it already went from home automation area to pool controller, he decided to wire up the +/-/ground across this non-twisted speaker cable to the Pentair bus. This is of course bad for RS485 because it uses voltage differential for signaling, and over long distances like these, it expects twisted pair to preserve the signal, cable shielding, and a ground of that shielding at just one end.
After my destroyed equipment and the associated costs, I decided to see if I could come up with a better solution.
Option one would be the optional Pentair add-on for this equipment management system, their ScreenLogic cloud management product. It allows remote control from mobile devices. It connects to the same RS485 bus described above; +/-/+15vdc/ground. There are a two characteristics of ScreenLogic that aren’t nice. Its unique identification of your install is simply based on the last six digits of the device’s MAC address. It communicates with their cloud service entirely in plain text. So…. if you were to use it from any network where anywhere along the path someone is capturing packets, they would have what they need to control your pool equipment remotely, including the optional “code” to “secure” it. This sounds like not too big a deal, I mean it’s just your pool, but what if they turn your heater and pump to max in the winter; you’ll only know when you get next month’s $1500 power bill.
I decided to look for an option two to eliminate future risk to my replacement Elan G! controller. What I came up with is a Raspberry Pi-based air gap from Pentair controller to the RS485 interface of the Elan controller by way of serial over IP with the Pi on wifi. Here’s my parts list:
- Proper 22/2 cable in a CL3P plenum-rated jacket with both shield and ground lead for the shield. https://amzn.to/36DpTzB
- RJ45 to screw terminal break out connector: https://amzn.to/30zUBG2
- Micro HDMI to HDMI adapter: https://amzn.to/36GKx1E
- Any of the following solutions for RS485 from an Raspi should work, as the drivers are built into the kernel (at least they were for me with 5.4 / Aug 2020 Pi OS Lite):
- “DSD TECH SH-U12 RS485 to TTL 5V Board with MAX13487 Chip” – Cheapest, doesn’t waste a USB port, utilizes on-board UART so it does not require any special drivers (but does require access to the relevant pins on the 40-pin header), has both surge and over voltage protection, has visible LED indicator of send/receive, only has half duplex (two-wire +/- ) support for ~500kbps max, leaves you with a circuit board and leads to pretty up: https://amzn.to/3d3e6vv
- “DSD TECH SH-U11L USB to RS485 RS422 Cable with FTDI FT232 Chip” – Bit more expensive, but still cheap, USB-based with a 5 foot lead before the terminal, drivers built into the Pi OS 5.4 kernel, supports full duplex (4 wire) and half duplex (2 wire) connections to ~3Mbps full / ~500kbps half. I tried it on MacOS, the drivers were garbage meant for ancient versions, and they didn’t work, so stick to Linux for such a use case. https://amzn.to/3d5dfun
- Pentair COM port expansion module. Yes, this piece of crap is literally nothing more than a paralleling board for ten times the cost of a breadboard, but I went ahead and bought the official one anyway, for a few reasons. 1) It’s the official way to connect more than two COM (RS485) ports to an IntelliTouch control board; why risk Jim Bob pool maintenance person freaking out when they come to work on your system and find a ton of stuff crammed into the same sockets, or your own frankenstein creation? For the price, you’ll probably come out the same based on just one aborted service call. 2) the terminal blocks pop off! This is the nicer aspect of the thing. If you need to disconnect something from the COM bus easily, you just pop it off. That’s especially useful for devices receiving the +15vdc power from the bus: https://amzn.to/30BsAxJ
- 2gb Raspi 4 Model B w/2 GB mem: https://amzn.to/3ngJMT0
- Clear Miuzei case & power supply; this one is not metallic, which is helpful when deploying on a concrete / rebar wall in a weak wifi area. I didn’t bother with the fan that will surely die at some point; it comes with heatsinks and for my use case it isn’t going to get hot, or need much CPU: https://amzn.to/3d8Fjxa
Raspberry Pi config:
- Installed the Lite OS release from https://www.raspberrypi.org/downloads/raspberry-pi-os/ using DD on my Mac after determining my SD card was /dev/disk4 via ‘diskutil list’:
diskutil list /dev/disk4 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *64.1 GB disk4 1: Windows_NTFS 64.1 GB disk4s1 diskutil unmountDisk /dev/disk4 sudo dd bs=1m if=2020-08-20-raspios-buster-armhf-lite.img of=/dev/disk4 sudo diskutil eject /dev/disk4
- Boot the Raspi up, configured wifi, then updated and upgraded, i.e. “apt update” and “apt-get distro-update”
- Get Bluetooth modem services out of the way as they’ll take the system UART you need exposed on the pins if using the DSD SH-U12 RS485 interface card. You can ignore this step if you’re just using USB-based RS485:
systemctl disable hciuart systemctl stop hciuart
- Installed ‘screen’ via: “apt-get install screen”
- Testing time. I figured I’d let the Raspi talk to itself between two RS485 interfaces to see if both work. I connected both the DSD SH-U12 to the appropriate Raspi 4 UART pins, and plugged in a DSD SH-U11L USB-based RS485 interface. Contrary to what you might expect to do, you’ll connect + to + and – to – for a two wire RS485 half duplex test connection, as these are not “transmit” and “receive” like RS232 serial; the voltage differential is used for the signal indicator. For a two wire to four wire, what is + and – on the two wire will go to the TXD+ and TXD- on the four wire.
- I SSH’d into the Rpi twice and used screen on each session to validate RS485 functionality:
screen /dev/ttyS0 9600
screen /dev/ttyUSB0 9600
After executing the above commands, typing into either screen session mirrored the typed characters to the other via the serial interface. Looks good!
More to come… ran out of time starting to type this out.