sfeakes / AquapureD

Control SWG without control panel. (Hayward Aquarite, Jandy Aquapure, Zodiac TRi)
Other
18 stars 3 forks source link

List of compatible hardware #8

Open tomascrespo opened 4 years ago

tomascrespo commented 4 years ago

Hi! This project is awesome! Is exactly what I was searching for! Thanks!

A list of compatible hardware, even better a table with supported/unsupported functions would be great.

I am building a poll at the moment and the the feature of been able to communicate with the SWG is essential to decide what SWG I will purchase.

As I can see, all that support Jandy protocol are compatible, but how could I know that?

For instance, Zodiac EXO iQ compatible is compatible (use Jandy protocol)? Is some SWG of the brand Astralpool compatible? BTW, is there any compatible SWG which gives pH data? Or there is any pH meter device with jandy protocol? Lots of thanks

If your were I, nowadays, what SWG will choose (compatible with this project).

My pool is only 40m3

ChutneyMary commented 4 years ago

Zodiac EXO iQ appears to be incompatible. The chlorinator has an 'input' RS485 terminal block and an 'output' RS485 terminal block. Using AquapureD linked to the input terminal shows no activity or comms traffic.

There is a terminal for connection of an RS485 controlled variable speed pump (output terminal). This terminal shows the chlorinator polling for the presence of a pump every ~20 seconds. No further activity has been observed.

It appears Zodiac has ceased supporting local control of their devices in preference to the cloud app (iAqualink).

I needed to solder a relay on to the chlorinator power button to effect integration with my home automation system.

Kranzy commented 4 years ago

How are you applying power to the RS485 bus?

ChutneyMary commented 4 years ago

I've tried numerous options but +12VDC 'worked' on the VSP RS485 output. Wired as per the picture attached. That allowed me to see the pinging for the presence of the pump. +5VDC was insufficient.

I haven't had any success with the iAL RS485 terminals.

Picture attached - https://www.dropbox.com/s/bpxqh11wmetmaii/eXO-Pro%20iQ.png?dl=0

Kranzy commented 4 years ago

Are you able to potentially trace any of the connections to see if the wiring is different between the ialink and vsp 485 connections?

kolcun commented 4 years ago

Regarding compatible hardware - I've got a clarification question that hopefully you guys can assist with.

Is the intent for this project to connect the raspberry pi via the USB2RS485 to the SWG via the RS485 Connector? (Versus the AqualinkD project, which specifics connecting to a controller)

I've got the Hayward Aquaraite salt cell - and am looking to connect directly and control it. thanks

Kranzy commented 4 years ago

Hi @kolcun

Yep you are correct that AquapureD is designed to act as the controller and AqualinkD is to interface with an existing controller.

kolcun commented 4 years ago

Fantastic. I’ve ordered some of the parts I need. I’m looking forward to trying it out this weekend

Griffon1967 commented 4 years ago

I am also trying to comm with an Aquarite SWG directly. My board is r1.1 (so its a bit older). Anyway, using the Jandy Protocol (0x50) I am getting a response to the probe but requesting the SWG % returns an unknown response...wondering if anyone knows why? Some things to consider with Aquarite. It took me adding 10VDC to terminal 1 (red) and the neg. to terminal 4 (green). I used a 9.78VDC wall wart to do this. Comm lines from my RS485 device went straight from "A" to "A" and "B" to "B". A on Aquarite is terminal 2 (Black) and B is terminal 3 (yellow). Like I said, it is communicating but I get a strange response. Also, this seems to lock the local Aquarite panel controls up until I power cycle the entire SWG. I also made sure that the setting in the Aquarite SWG is AL-0 *which implies Aquarite protocol - I've been reading this thread and it seems that the Jandy protocol should work. Anyway, this is what I send and receive... From AquapureD: ..... Debug: Set serial port /dev/serial0 io attributes Debug: Jandy Sent Probe | HEX: 0x00|0x10|0x02|0x50|0x00|0x62|0x10|0x03|0x00| Debug: Serial read 9 bytes Debug: Jandy Received Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03| Debug: Jandy Sent AR %% | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00| Debug: Serial read 9 bytes Debug: Jandy Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03| do nothing, didn't understand return

And this is from my own UART utility: open UART read attrs cflag = 2237 sent attrs 2237 TX => 00 10 02 50 00 62 10 03 00 RX <= 10 02 00 01 00 00 13 10 03 TX => 00 10 02 50 00 62 10 03 00 00 RX <= 10 02 00 12 42 00 66 10 03

Its the same result each time. that 0x12 in the fourth byte of the result seems to be odd.... Any comments would be appreciated.

Griffon1967 commented 4 years ago

So this for anyone trying to directly connect to Goldline Aquarite... Remove the leading and trailing '0x00' from the send packets. If you simply send the required bytes, the system will respond and not "lock-up". I tried this today and all worked well (once again, from my utility): open UART read attrs cflag = 2237 sent attrs 2237 TX => 10 02 50 00 62 10 03 RX <= 10 02 00 01 00 00 13 10 03 TX => 10 02 50 11 0a 7d 10 03 (set % to 10 = 0x0a) RX <= 10 02 00 12 46 00 6a 10 03 (0x46 is 70 x 50 = 3500ppm)

Hope this helps anyone else looking to work directly with Goldline Aquarite SWG.

kolcun commented 4 years ago

I've found a 12VDC wall wort, hopefully that will work versus the 10.

@Griffon1967 You mentioned your utility, is this something different than AquapureD that you're using to debug? If so, could you share that?

Griffon1967 commented 4 years ago

@kolcun I have two PCBs for the Goldline. One is the original (installed) which is fw R1.1. The other (my spare) is new and its at R1.5 (I believe). On the new board, the PCB is clearly marked as 10V on terminal 1. Be careful....I have no idea how tolerant these things are to over-voltage.

The utility I wrote is a small piece of C code. It has the probe and temp set packets hardcoded...I just wrote it so I could manage the comm myself. You can certainly have the source....if you know C at all, you should be able to manipulate it however you like. In its current form, it will send the two packets I have shown above and then exit. Let me know and I'll post the code.

In all honesty, I'll probably install a separate temperature sensor in my line and forget about the RS485 with the SWG. I really wanted to get the water temp but after reading many posts on communicating with the Aquarite SWG, it seems no one has figured out how (or even IF) the system will respond with a temperature. I already use RS485 to communicate with a VFD which runs my pool pump. It seems a waste to add alot of extra gear just to get the PPM.

kolcun commented 4 years ago

@Griffon1967 my pump is currently controlled via a custom home automation system, using the relay controls that the pump offers - that's working very well. My desire for the SWG integration is generally to obtain status on the cell overall - temperature/generating/faults.

I have some background with c - would love to give your utility a try, thank you.

Fair point about the 10VCD - I did just open mine up to check, 10V is printed on the board. Hunting for one now - so many 5v, 9v, and 12v's lying around ;)

Griffon1967 commented 4 years ago

@kolcun I actually bought a 9VDC wart...when I metered it, it showed 9.78VDC so that was a bonus. You may try the same thing. They're only about $4 at the elec. shop near me so worth it to buy a few to try out (if you don't have one lying about). I also control a pump but mine is connected to a Frequency Drive (VFD) which I can control through actual MODBUS. I really wanted to get temperature from the Goldline....I have a Jandy Lxi not sure if that will spit out the temp but I'm more reluctant to destroy that PCB...I'm thinking its more expensive.

In regards to the code, its not coded as traditional modbus (high register for write / low for read). I'm not sure if this Jandy protocol requires it. I have a MAX485 which handles flow control so I can access it with straight serial data. The MAX handles the High/Low bits. So if your USB/RS485 interfaces requires flow control, my program may not work for you.

Let me know if you want to try it anyway.

kolcun commented 4 years ago

At this point I'm keeping the SWG/485 separate from my main controller. So if if your utility will help with getting the pi to connect directly with the SWG via RS485 I'm happy to give it a go.

I'm using this interface - https://www.waveshare.com/usb-to-rs232-485-ttl.htm The manual notes "Direction control: hardware automatic control" however I'm not sure if that's the same as it handling flow control.

Griffon1967 commented 4 years ago

@kolcun Ya pretty sure it handles flow control for you. Anyway just created a repo for the code here. Let me know if you find a way to pull a temperature out. Cheers

kolcun commented 4 years ago

@Griffon1967 Thanks - I'll give it a try and let you know what I find out.

kolcun commented 4 years ago

Hi @Griffon1967

So I was able to test your code tonight. Supplied 10V to the connector on the AquaRite and connected to my RS485 interface.

I ran it 25 times.

The first TX of TX => 10 02 50 00 62 10 03, 100% response rate of RX <= 10 02 00 01 00 00 13 10 03

Second TX of TX => 10 02 50 11 0a 7d 10 03 - much more varied, and not as successfull 14 responses led to UART RX ERROR RX <= 10 - 5 times RX <= 10 02 - 1 time RX <= 10 02 00 - 1 time RX <= 10 02 00 12 - 2 times RX <= 10 02 00 12 40 - 2 times

So none of these seem to be a full response to the TX, as indicated by your test runs.

Very odd - any ideas what might be going on?

Full results here if you're interested - https://github.com/kolcun/AqUART/tree/master/test-results

Griffon1967 commented 4 years ago

@kolcun I think your comms are fine. What you're seeing is a read of the buffer before its filled by the sender. You can try and increase the usleep between the write and the read. I was retesting yesterday (I keep switching over to my VFD) and noted this type of thing when asking for the device ID. Because the return packet is longer, the read needs to occur more than once to acquire the full returning packet. I will enhance the program further today and then send it to the repo and it will hopefully address what you're seeing. Did you try the AquapureD code? I had no joy with it as it seems to pre-send a 0x00 which caused the device to fault - and then requires a reboot. I'm currently writing a small bit of code to bang (attempted) commands at the device (outside of the known commands) to see if I get a response on anything. I really want that temperature but its seems to be a unicorn. Rgds, G

Griffon1967 commented 4 years ago

@kolcun New version up. If you just compile as-is, it will send the probe, rx the data, then send the request for ID, and receive that data. My output looks like: using device --> /dev/serial0 open UART read attrs cflag = 2237 sent attrs 2237 TX => 10 02 50 00 62 10 03 RX <= 10 02 00 01 00 00 13 10 03 TX => 10 02 50 14 00 76 10 03 RX <= 10 02 00 03 00 41 71 75 61 52 69 74 65 20 20 20 20 20 20 20 20 31 10 03

kolcun commented 4 years ago

@Griffon1967 I didn't get a chance to try the AquapureD code yet - Will try that next, same for the new version of your code.

Is there a programming guide on the protocol? Wondering how you're determining how to interpret the response, and build the queries.

Griffon1967 commented 4 years ago

@kolcun No guides anywhere. But lots of sample code (including AquapureD) which, when you run it, will show the packets. I ran AquapureD first but because of the leading 0x00, I just scribbled together that little bit of C code.

I've also found some other projects which define the packets and responses clearly. As far as I know, there are only three commands this thing will respond to. 0x00 = probe/ping, 0x11 = set salt %, 0x14 = version. You can read this guys findings here

kolcun commented 4 years ago

The updated code isn't working correctly for me it seems. My consistent output is

pi@poolpi:~/AqUART $ ./aquart 
using device --> /dev/ttyUSB0
open UART 
read attrs cflag = 2237
sent attrs 2237
TX => 10 02 50 00 62 10 03 
UART RX ERROR
RX <= 10 02 00 01 00 00 13 10 03 

However, the earlier version of your code did work for me. Immediately after I ran it, the AquaRite Remotely Controlled light lit up, and the percentage was set to 10% it quickly reverted to normal (I gather that unless you constantly communicate with it, it moves out of remote mode)

I didn't have much luck with AquapureD. Immediately upon start, the web iterface shows "Generating Salt" for just a few seconds before switching to "offline", however no changes at all on the AquaRite unit - doesn't switch to remotely controlled mode.

There are a ton of MQTT errors in the log, but once those are filtered out this is what I get.

AquaPure Daemon 0.7
Error:  Open file failed '/tmp/aquapure.cache'
Debug:  Starting aquapured!
Notice: Starting WEB Server on port 80
Debug:  Openeded serial port /dev/ttyUSB0
Debug:  Set serial port /dev/ttyUSB0 to non blocking mode
Debug:  Set serial port /dev/ttyUSB0 io attributes
Debug:  Jandy   Sent     Probe     | HEX: 0x00|0x10|0x02|0x50|0x00|0x62|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Ack       | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
Debug:  ++ Websocket joined
Info:   WS: Message - Key 'command' Value 'GET_DEVICES' | Key2 '(null)' Value2 '(null)'
Debug:  build_device_JSON 497 of 1024
Debug:  Jandy   Sent     AR %%     | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03|
do nothing, didn't understand return
Debug:  SWG resend last message
Debug:  Jandy   Sent     AR %%     | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03|
do nothing, didn't understand return
Debug:  SWG resend last message
Debug:  Jandy   Sent     AR %%     | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03|
do nothing, didn't understand return
Debug:  SWG resend last message
Debug:  Jandy   Sent     AR %%     | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03|
do nothing, didn't understand return
Debug:  SWG resend last message
Debug:  Jandy   Sent     AR %%     | HEX: 0x00|0x10|0x02|0x50|0x11|0x32|0xa5|0x10|0x03|0x00|
Debug:  Serial read 9 bytes
Debug:  Jandy   Received Unknown '0x12'| HEX: 0x10|0x02|0x00|0x12|0x42|0x00|0x66|0x10|0x03|
do nothing, didn't understand return
Error:  Too many no-reply from SWG, calling connection dead

Seems that there isn't any valid response coming back from the probe? it just ends up marking it dead after a few calls.

Griffon1967 commented 4 years ago

@kolcun Well as far as AquapureD, that output is exactly what I got which is why I wrote that small program. It seems AquapureD doesn't know what to do with that 0x12 in position 4. This is a normal response so it should be OK. Anyway, curious to know if your local control on the SWG was locked up after the AquapureD interaction....mine did and I had to power it down to recover. In regards to my prog, its odd that it actually successfully received the packet. Looped back around for more data and then got the RX fail message. You can see it dumped the RX packet which is correct. Maybe the timing on your device is a bit different from mine? You can try and alter the usleep in the RX routine on line 200. It currently states usleep(20000). Change it to a lower value like usleep(500) and see if that makes any difference. I only implemented this loopback to get more data as the request for ID packet sends more data than the initial read can handle. Good luck.

kolcun commented 4 years ago

@Griffon1967 No lock up for me - if I ran the code once, it flipped back to local control after a few seconds. I also ran it in a bash script loop to keep it in the remote control mode. After a few minutes, stopped the script and again it went back to normal without any lock up.

One thing I did try with the earlier version of your code was to add the padding of 0x00 to the first ping packet sent - it worked without any issue

With padding

using device --> /dev/ttyUSB0
open UART 
read attrs cflag = 2237
sent attrs 2237
TX => 00 10 02 50 00 62 10 03 00 
RX <= 10 02 00 01 00 00 13 10 03 

No Padding

using device --> /dev/ttyUSB0
open UART 
read attrs cflag = 2237
sent attrs 2237
TX => 10 02 50 00 62 10 03 
RX <= 10 02 00 01 00 00 13 10 03 

I'll try adjusting the timing and see if I can get it to work.

Griffon1967 commented 4 years ago

@kolcun Hey Mike. I changed over to a RPi4 today and noticed the same issue you had. I must have been using the miniUART/BT on the Pi3. Anyway, I corrected it and retested. Grab the latest code...it should be ok for you now. If nothing else, its good for firing packets at the SWG for testing. using device --> /dev/ttyAMA1 open UART read attrs cflag = 2237 sent attrs 2237 TX => 10 02 50 00 62 10 03 RX <= 10 02 00 01 00 00 13 10 03 TX => 10 02 50 14 00 76 10 03 RX <= 10 02 00 03 00 41 71 75 61 52 69 74 65 20 20 20 20 20 20 20 20 31 10 03

kolcun commented 4 years ago

@Griffon1967 Thanks- tested just now and it's also working for me. Thanks for posting the update.

Still no further luck with AquapureD on my end. As you mentioned, even if it were to work, doesn't seem like the temperature can be captured, which is a bummer.

kolcun commented 4 years ago

@Griffon1967 I was playing with another project - https://github.com/tagyoureit/nodejs-poolController

And was able to have it act as the controller, and successfully configured it with my AquaRite.
I'm able to remotely configure the output percentage and that works just fine.

Still not able to see or retrieve anything about the temperature of the water though - seems like that's just not available in the protocol.

Were you thinking of adding temperature probe to your plumbing line - like this? https://www.troublefreepool.com/threads/attaching-temp-sensor-in-pvc-pipe.157764

Griffon1967 commented 4 years ago

Hey @kolcun. I have a field on my home website for temp that is not yet filled so I'm definitely going to solve it. I have a frankenstein setup - I installed a VFD and 3p motor before they were readily available. My small VFD has full (and standard) RS485 comms so I talk to it very easily. The Aquarite is very basic as you've learned. I also set the % and retrieve PPM to display on my web page as well as on a small OLED screen on my local controller, using that small utility I have. I have a Jandy LXi heater which has a thermistor style temp sensor. The resistance values are well documented and those terminals are easily accessible. I'm just doing the research as to whether I can put another device to read the resistance in series/parallel with the heater itself. Obviously don't want to upset the heaters readings but this would be a simple solution with no plumbing. Barring that, yes, I'll have to explore plumbing in a solution. The one you've linked to seems to be the most common solution (and simplest).

Griffon1967 commented 4 years ago

@kolcun I managed to get temperature from the Thermistor in my Jandy heater. So no plumbing and a little hardware and electronics. Not sure if you're interested in that kind of solution but let me know if you are and I'll give you details of how it can be done.

kolcun commented 4 years ago

@Griffon1967 I ended up using an external temperature sensor in a thermowell, read through a small nodeMCU board. I mounted it fairly easily using a T fitting with a 1/2 threaded connection for the thermowell (turns out it seems impossible to get that simple fitting in Canada - ordered it from ebay eventually). Works quite well so far!

I had checked, but couldn't find any details on getting the temperature from my raypak heater.

jorythompson commented 2 years ago

Has anyone fleshed out the command/response packets any more? Looking for more information back from the chlorinator (flow, hi/low salt, etc)

kolcun commented 2 years ago

@jorythompson I haven't gone any further with this yet. I'd like to be able to capture flow state, and I may give this another try once the snow is gone ;).

Kranzy commented 2 years ago

Has anyone fleshed out the command/response packets any more? Looking for more information back from the chlorinator (flow, hi/low salt, etc)

@jorythompson What unit are you using?

For me I already get the status back from the unit such as 'Low Salt', 'No Flow' etc

Is there more information you're hoping to extract?

jorythompson commented 2 years ago

For me, that byte is always 0x00, so I can't get any status from the unit

Griffon1967 commented 2 years ago

Never went further. I have my salt PPM and am getting a temperature from another sensor. I didn't have a need to take this further.

kolcun commented 2 years ago

@jorythompson @Griffon1967 I'm interested in how each of you have set things up physically. Were you able to fit the rs232 interface and Raspberry pi (or other device) inside the aquarite, or are you using a separate enclosure?

jorythompson commented 2 years ago

I have a separate enclosure because I am trying to control a couple of pumps as well (in fact, I have two: one is for high voltage, the other for low, which is where the pi-zero lives). To clarify, communication is not via RS-232, it is RS-485. I am using an adapter that connects to the pi's UART pins (https://www.amazon.com/dp/B07DK4QG6H/ref=cm_sw_r_apanp_PMJvwsOMWw8bp)

williammuff commented 2 years ago

@Griffon1967 I ended up using an external temperature sensor in a thermowell, read through a small nodeMCU board. I mounted it fairly easily using a T fitting with a 1/2 threaded connection for the thermowell (turns out it seems impossible to get that simple fitting in Canada - ordered it from ebay eventually). Works quite well so far!

I had checked, but couldn't find any details on getting the temperature from my raypak heater.

Did you ever figure out anything about the COMM port on the rapak heater (the flat wire to the control board). I know it has the digital signal that reveals temp, just unclear what type of signal it is. I'm just not super familiar with digital signals, id love to guess and check using a Arduino/etc.

jorythompson commented 2 years ago

I continue to get 0 for flow, clean cell, low salt and high salt (have not dumped a bunch of salt in the strainer to test high salt and a hose for low salt yet). OK is 1 and PPM is correct.

On Thu, Feb 10, 2022, 6:20 PM Kranzy @.***> wrote:

Has anyone fleshed out the command/response packets any more? Looking for more information back from the chlorinator (flow, hi/low salt, etc)

What unit are you using?

For me I already get the status back from the unit such as 'Low Salt', 'No Flow' etc

Is there more information you're hoping to extract?

— Reply to this email directly, view it on GitHub https://github.com/sfeakes/AquapureD/issues/8#issuecomment-1035633146, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKSXUFHRFGJVROXD655WG3U2RB3LANCNFSM4MYFLQEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>