-
Notifications
You must be signed in to change notification settings - Fork 97
RS 485 Adapter Details
Jump to What are failed packets?
Read the README carefully! It mentions the need for a physical RS485 adapter as the first line in the install instructions and goes into further detail here.
Do you own an RS485 adapter? This is different from a standard serial port adapter. I recommend this JBTek for $6.99 on Amazon. We are no longer recommending the JBTek due to a significant number of failures.
Here are some community recommended adapters:
- Industrial RS 485
- GearMo Mini USB to RS485 / RS422 Adapter
- Moyina USB to RS485 Adapter
- Elfin EW11 Rs485 -> Wifi adapter setup info
You have your RS-485 adapter now, great! Can you see when you browse devices (on Windows) or does it show up in the /dev
directory on Mac/Linux?
Before you plug in the adapter, it will not be in /dev
.
Then plug it in and you will see the adapter listed. If it will show up as ttyUSB0
for the JBTek. Other adapters may have different names.
If it doesn't show up when you insert it, you probably need to figure out what chip your USB adapter uses. Two of the bigger ones are:
- CH340x: https://sparks.gogo.co.nz/ch340.html (This is my recommended JBTek chipset.)
- FTDI: http://www.ftdichip.com/Drivers/VCP.htm (First install the CDM v2.12.28 WHQL Certified driver to have Windows recognize the USB serial device, then install http://www.ftdichip.com/Drivers/CDM/CDM21228_Setup.zip to recognize the serial port itself.) Of course, install the drivers, reboot, yadda yadda...
Here are the screenshots of installing the FTDI driver on my Win7 image.
- Plug in the FTDI USB Serial Port, and it isn't recognized by Windows.
- Install CDM v2.12.28 WHQL Certified driver and Windows and the USB device is now recognized, but not the Serial Port itself.
- Install the drivers and then the serial port will be recognized. (Note: I did these two steps separately but this last setup package may install both USB and Serial Port drivers.)
Connect the wires. Once you see the driver listed in the /dev directory, you should connect the RS485 wires physically to your pool. Connect the DATA+ and DATA- either to your remote keypad, the Intellitouch itself, or to the protocol adapter of the Screenlogic Wireless.
There are only two possible ways to wire the DATA+ and DATA- wires. To see if you are getting the proper communications from the bus, before you even try to run this program, run from your unix command line
If you aren't getting serial data after following the below Mac/Linux instructions, check your RasPi Config settings.
- sudo raspi-config
- under interfacing options, serial, answer yes to enable the serial interface and no to disable the serial port shell.
od -x < /dev/ttyUSB0
Of course, you'll need to change the address of your RS-485 adapter if it isn't the same as mine (here and in the code). For example, od -x < /dev/tty.usbserial-AIZ9PCX
is the name of the RS485 adapter that showed up in my screenshot above.
You'll know you have the wires right when the output of this command looks like (you should see multiple repetitions of ffa5ff):
0002240 0000 0000 0000 0000 0000 ff00 ffff ffff
0002260 **ffff 00ff a5ff** 0f0a 0210 161d 000c 0040
0002300 0000 0000 0300 4000 5004 2050 3c00 0039
0002320 0400 0000 597a 0d00 af03 00ff a5ff 100a
0002340 e722 0001 c901 ffff ffff ffff ffff ff00
This is the WRONG wiring (no ffa5ff present).
0001440 0000 0000 0000 0000 0000 0000 0000 6a01
0001460 e1d6 fbdf d3c5 fff3 ff7f ffff ffff f9ff
0001500 7fff 5ff7 bf5f 87ff ff8d f7ff ffff 4d0b
0001520 e5ff adf9 0000 0000 0000 0000 0100 d66a
0001540 dfe1 c5fb f3d3 7fff ffff ffff ffff fff9
I recommending downloading RealTerm as it worked easily for me the first time. When you open it, make sure to have HEX selected as the output.
And the port settings should be 9600 baud, no parity, 8 data bits, 1 stop bit, no flow control. If you have the wires connected correctly, you will see (red circle) the FF00FFA5 repeated a number of times. If you don't see these, just reverse the wires on one end.
Now that you have your RS485 adapter configured and verified in the operating system, update this in the Setup (gears) -> Controller -> RS485 port in dashPanel. If you don't have dashPanel installed, stop njsPC and edit the following line in the config.json
in the root directory.
... "network": { "rs485Port": "/dev/ttyUSB0", to match the port you see above.
Run the nodejs-poolController app and it should talk to your Pentair pool system.
Failed packets are a normal part of RS-485 communications. RS-485 communications (with all pool equipment) uses a single pair of data wires (D+/D-) and it is half-duplex. This simply means that there is no "RTS" (Ready to send) signal and any piece of equipment can start talking at any time. It's like getting on a conference call and everyone is talking at the same time. Sometimes the equipment needs to say "sorry, your message came across garbled please say that again." This is a collision and we track it as a failed message.
Failed:{"bytesReceived":1622219,"success":65256,"failed":46,"bytesSent":744}
In normal communications, collisions should be well below 5% and often below 1%. In the example just above this is comms for an EasyTouch that has been running overnight.
Failed packets are only an issue if they interfere with the normal functioning of the equipment. Otherwise, don't worry about them.
First, look at the previous question. Is it an issue?
There are usually only a few reasons why the failure rate is very high. In order of likeliness:
- You have some loose wires and there is a poor physical connection between devices
- Your RS-485 adapter is on the fritz. Spend $7 and get a new one.
- You have multiple applications accessing the serial port and they are competing with each other
- You are using Socat to send RS-485 communications from a physical adapter to a remote machine and the network connection is unstable
- Your equipment is going bad. This is pretty unlikely and you will probably have other things wrong with the equipment as well.