-
Notifications
You must be signed in to change notification settings - Fork 97
RS 485 Adapter Details
This article goes into more detail on the RS-485 adapter that you need to run this code.
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.
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 settionsgs.
- sudo raspi-config
- under interfacing options, serial, answer no to both questions to disable the serial interface.
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, change the line in your config.json
... "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.