sfeakes / AquapureD

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

Initial Testing #1

Open Kranzy opened 5 years ago

Kranzy commented 5 years ago

Hi sfeakes,

Thought I would post here to keep our discussions about AquapureD separate from AqualinkD.

My RS485 converter showed up last night. This is the one I got: https://www.amazon.com.au/gp/product/B0721BB8PQ/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

Would you might giving a bit of direction about whats involved in introducing power on the RS485? Will I need to supply power into the Tri Chlor or just the 2 data pins?

Im assuming just setting up rasbian on the pi?

I have a Pi model B (from memory) laying around not doing anything that I'll be using. Ill be running ethernet to the shed (backs onto house) and will be looking at integrating it with home assistant once its all up and running.

DutchForce75 commented 4 years ago

My device is 1350 km's away from me right now (that's why I need the remote :-) , but from memory I think I can choose from: Aqualink Tri Jandy Rev L/M Jandy Rev K EOS/PENTAIR

It works on Jandy Rev L/M, definitely not Aqualink Tri. Not sure if the others would work.

The protocol is the same Aquarite protocol as found here and on other resources, for example: RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003 RS485 : <-- 1002 50 11 64 d7 1003 RS485 : --> 1002 00 16 28010000 51 1003

Perhaps it works only if the ground or 0v comes from the same PSU as the USB / Raspberry device. Did you apply 9 volts to POS an 0V then?

art0 commented 4 years ago

Hi @DutchForce75 I have tested and I get no answer from the Zodiac

RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 11 64 d7 1003 RS485 : -->

Do you need to turn on/off the device?

DutchForce75 commented 4 years ago

I think it doesn't matter, because if the connection is lost, the Zodiac switches to off mode by itself. What RS485 adapter are you using?

art0 commented 4 years ago

After trillion of attempts I got this handshake RS485 : <-- 1002 50 14 01 77 1003 RS485 : --> 1002 00 03 0141717561507572650000000000000000 3a 1003

Unfortunately it happened only once. I tried 2 different models. Not the same one you use though

DutchForce75 commented 4 years ago

At least that's something! Might be a line problem, do you have a long cable in between? Mine is only 5 meters of twisted pair network cable. By memory I think the Zodiac Tri Board has a EOL resistor onboard. Not sure about the USB device on the other side. Currently it works here without any EOL resistors, but you might need one if cable length is long.

Which software did you end up using this result?

art0 commented 4 years ago

The cable is 2m long, and I do not run a EOL. I used your software, the webserver and the testing script. Where did you buy your USB-RS dongle?

Can @DutchForce75 describe the order you follow to see communications in place?

a) start webserver b) power off? power on? SWG c) select EXT Controller, power on/off?

DutchForce75 commented 4 years ago

I bought a bunch of these at two different stores, not sure if they are 100% the same: https://www.reichelt.de/raspberry-pi-usb-rs485-interface-rpi-usb-rs485-p242783.html?r=1 https://www.hobbyelectronica.nl/product/max485-module-voor-rs485-seriele-communicatie-usb/ Not sure which I actually end up using.

Which one are you using?

Up till now I had the Zodiac Tri powered up and then made the connection with the scripts. Haven't tested what happens the otherway around, although my guess that it won't give problems.

On the Zodiac Tri, EXT controller is set to the Jandy Rev L/M setting, and mine remembers this when powered off.

One thing if you used my python software: it will first try to sync the packets, but if malformed packets are received they won't be displayed. Might be the reason why you don't see much traffic going on.

What happens if you open a terminal and run the following cmds like 10 times?: echo -n -e '\x10\x02\x50\x00\x62\x10\x03' > /dev/ttyUSB0 od -x < /dev/ttyUSB0

In my case I get this response: 0000000 1000 0002 0001 1300 0310 0000012

art0 commented 4 years ago

I run more tests this morning. POS(5V) and 0V coming from RB. Again I got some non consistent responses. Do you get responses from the first cmd or do you need to send ten beacons first?

I start to wonder if the problem is not related to the RS485 dongle. I have used in production for a electrical meter. Will be great to test with your same model to troubleshoot

python2 zodiactest.py RS485 : opening RS485 port /dev/ttyUSB0 RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : --> 1002 00 03 0141717561507572650000000000000000 3a 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003 RS485 : <-- 1002 50 14 01 77 1003 RS485 : --> 1002 00 03 0141717561507572650000000000000000 3a 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003 RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : -->
RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : --> 1002 00 03 0141717561507572650000000000000000 3a 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : -->
RS485 : <-- 1002 50 14 01 77 1003 RS485 : --> 1002 00 03 0141717561507572650000000000000000 3a 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : -->

DutchForce75 commented 4 years ago

No 1 or 2 messages are enough to get a decent response in my case.

Just to rule out that the syncing part in the python script is the problem, or to see what actually goes wrong on the RS485 communication layer: what happens if you run these commands from the command line: echo -n -e '\x10\x02\x50\x00\x62\x10\x03' > /dev/ttyUSB0 od -x < /dev/ttyUSB0

DutchForce75 commented 4 years ago

Also make sure you feed the Raspberry with a big stable power supply. Read on another forum that can prevent bad checksums as well

sbhc68 commented 4 years ago

Hello,

I just did a test with my Zodiac Tri and it works. I can read data. Thank @DutchForce75

On the other hand, what would be interesting, it is to be able to recover the information concerning the Chlorine and the PH.

DutchForce75 commented 4 years ago

Haven't succeeded in obtaining pH and ORP info. I tried to send every command between 0 and 255, but the Tri responded only on the already known AquaRite commands.

I cant test right now, but maybe it will respond to ChemLink commands when Ext Controller is set to Aqualink?

Has anyone succeeded in connecting when set to Aqualink at all?

Really keen on being able to read these values too!

sfeakes commented 4 years ago

The SWG AquaRight protocol only has SWG % and PPM information in it. There is one other value I haven’t had chance to decide yet, but I believe it’s water temp.

My bet is you can get this using the ChemLink protocol. But until I find someone with a working ChemLink to Aqualink control panel, I won’t be able to decode that. All I know so far is the ID for ChemLink

art0 commented 4 years ago

Some feedback @DutchForce75 et al I have decided to power the POS port directly with a 5.2V power supply, the unregulated power coming from the RB was part of the problem. As soon as i got the power stable RS485 started to work.

!!! MAKE SURE YOUR POWER IS NOT 4.87 V !!! Now some questions:

192.168.1.224 - - [10/Sep/2019 17:10:06] "GET /setChlorine?pct=69 HTTP/1.1" 200 - RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003 RS485 : <-- 1002 50 11 45 b8 1003 RS485 : --> 1002 00 12 5000 74 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003 RS485 : <-- 1002 50 11 45 b8 1003 RS485 : --> 1002 00 12 5000 74 1003 RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003

art0 commented 4 years ago

@sfeakes

%SWG: % of time that the Cell works. Not sure how this works, if 50% will it stop every 30 mins per hour? PPM: PPM of what? Salt? How is the Salt PPM measured? Calculated from the voltage level in the cell?

sfeakes commented 4 years ago

@art0 SWG% is the % of Chlorine to generate. This is same as setting the % control knob on the panel itself. I have not looked into the electronics, but I would assume it's simply changing the voltage going to the salt cell itself, rather then cycling it. PPM is Parts Per Million of salt measured from the water traveling through the cell.

There is usually LED on the panel that states "remote controlled" or something similar, when that is lit you are controlling the panel over RS485. But you need to send a command every second or so to keep it under remote controlled.

sfeakes commented 4 years ago

BTW, The ChemLink ID is 0x80 so if you send a probe packet to that ID and you get an ACK back you know the Tri can also use the ChemLink protocol. Then you should be able to set and get Ph & ORP, plus change the Ph and ORP feed rate.

DutchForce75 commented 4 years ago

@sfeakes: Next time I can try is in 5 weeks, but will def try!

sfeakes commented 4 years ago

@DutchForce75 Here is some information on ChemLink protocol. I don;t have much more, but it'll be enough to get you started.

Probe to ChemLink
| HEX: 0x10|0x02|0x80|0x00|0x62|0x10|0x03|

ACK from ChemLink
| HEX: 0x10|0x02|0x00|0x01|0x18|0x00|0x2B|0x10|0x03|

Request for ChemLink status
| HEX: 0x10|0x02|0x80|0x02|0x94|0x10|0x03|

ChemLink Status Reply
| HEX: 0x10|0x02|0x00|0x21|0x02|0x3B|0x03|0x4B|0x0E|0x02|0xCE|0x10|0x03

0x10|0x02 = head
0x12 = ChemLink Responce Message
0x02 = Responce type is Status
0x3B = Target ORP (1st bit)
0x03 = Target ORP (2st bit)
0x0E = Target PH (1st bit)
0x02 = Target PH (2st bit)
0xCE = checksum
0x10|0x03 = tail
art0 commented 4 years ago

@art0 SWG% is the % of Chlorine to generate. This is same as setting the % control knob on the panel itself. I have not looked into the electronics, but I would assume it's simply changing the voltage going to the salt cell itself, rather then cycling it. PPM is Parts Per Million of salt measured from the water traveling through the cell.

There is usually LED on the panel that states "remote controlled" or something similar, when that is lit you are controlling the panel over RS485. But you need to send a command every second or so to keep it under remote controlled.

@sfeakes The Zodiac Tri does not change the voltage of the cell, it remains constant. % of chlorine seems a time-based % i.e. the time that the cell is active vs the time that SWG is ON.

DutchForce75 commented 4 years ago

@sfeakes: Great stuff! Will try as soon as I have the opportunity.

Or is there somebody else here that can test some python code and have Aqualink selected as controller on the Zodiac Tri?

Kranzy commented 4 years ago

@art0 I will be looking at testing mine tonight. Can you let me know what your wiring ended up looking like? Was it just 5v to the board and A & B between RS485 usb and board or did you need the ground on the USB adapter shared between the pi, adapter and board or any combination of?

Kranzy commented 4 years ago

@DutchForce75

I’d be happy to test once I’ve got Aquapure up and running successfully.

@sfeaks We are free to change between different software and protocols without the board locking to a specific one?

art0 commented 4 years ago

hi @Kranzy

Let me summarize my findings in the last weeks

=======

=======

 ==
 ==

Then you know that Zodiac-Tri has received the RS packet

(ASCII-Art) from @art0

sfeakes commented 4 years ago

@Kranzy It’s the control panel that will lock out on SWG change, not the SWG itself. So yes to the best of my knowledge you’re free to change.

Also AquapureD and the Python script posted uses the exact same protocol, so switching between them won’t cause an issue. If one works so should the other as the both send the same codes.

DutchForce75 commented 4 years ago

@art0 I can confirm that I used the same power routing directly from the PSU and not directly from the RPI, didn't thought it would make such a big difference, sorry!

DutchForce75 commented 4 years ago

@Kranzy: would be great if you could test!

So please run the chemlinktest.py and aqualinkscan.py that's in the https://github.com/DutchForce75/pyZodiacTri

If you want the screen output to a file instead use these commands to post the results here, but you won't see any feedback on the screen then (anyone got a working around to see screen output AND route it to file?):

python aqualinkscan.py > aqualinklog.txt python chemlinktest > chemlinklog.txt

sbhc68 commented 4 years ago

Hello,

Here are the generated files. I am in "Jandy Rev L / M" mode

output-aqualinkscan.txt.gz output-chemlinktest.txt.gz

DutchForce75 commented 4 years ago

Will look into those later, can you also run them in Aqualink mode?

Verstuurd vanaf mijn iPhone

Op 11 sep. 2019 om 09:33 heeft sbhc68 notifications@github.com het volgende geschreven:

Hello,

Here are the generated files. I am in "Jandy Rev L / M" mode

output-aqualinkscan.txt.gz output-chemlinktest.txt.gz

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

sbhc68 commented 4 years ago

Yes, I can generate them, but only tonight.

art0 commented 4 years ago

For Jandy mode

aqualinkscan:

RS485 : <-- 1002 50 00 62 1003 RS485 : --> 1002 00 01 0000 13 1003

chemlinktest:

got no answer

Changed to Aqualink.-Tri controller and got no responses for both tests.

DutchForce75 commented 4 years ago

Thanks guys!! Too bad you didn't get any answer art0

DutchForce75 commented 4 years ago

Here are the generated files. I am in "Jandy Rev L / M" mode

output-aqualinkscan.txt.gz output-chemlinktest.txt.gz

These are axaclty as what I got, no response other then the AquaRite protocol unfortunately

Kranzy commented 4 years ago

I’m still getting nothing read when using aquapure. Haven’t tried with @DutchForce75 code.

Kranzy commented 4 years ago

No 1 or 2 messages are enough to get a decent response in my case.

Just to rule out that the syncing part in the python script is the problem, or to see what actually goes wrong on the RS485 communication layer: what happens if you run these commands from the command line: echo -n -e '\x10\x02\x50\x00\x62\x10\x03' > /dev/ttyUSB0 od -x < /dev/ttyUSB0

@DutchForce75 When running these (assuming I did it correctly) my response is just '0000000'

I am running the Pi from a USB adapter and a separate adapter to apply 5v. Do you think the issue could be that I am not sharing a common ground between the 5v psu to the board and the usb that is powering the Pi? I did try grounding the RS485 to the psu to the board but no luck.

Tx led lights on the board, Rx led never lights.

@art0 did the power supply you used to the board, did that also power the pi or was it two separate circuits in your setup?

I even tried using a raspberry pi b+ instead of an original pi.

Open to any other ideas to try...

DutchForce75 commented 4 years ago

Seems like you don't get a repsonse yet.

Are you sure your RS485 adapter shows up as /dev/ttyUSBO? You could check by running ls /dev/tty*

I use a power adapter that poweres both the RPI as well as the Zodiac Tri. Make sure the power supply is big enough. I use this one: https://nl.farnell.com/mean-well/hdr-30-5/power-supply-ac-dc-5v-3a/dp/2815640?CMP=i-ddd7-00001003 In my case I did use the + and ground for the Tri

Kranzy commented 4 years ago

Seems like you don't get a repsonse yet.

Are you sure your RS485 adapter shows up as /dev/ttyUSBO? You could check by running ls /dev/tty*

Yeah I'm pretty sure it is. I have run ls /dev/tty* and there is only one USB device which is USB0. When I run either your script or sfeakes I get led feedback on the RS485 adapter. Just no responses.

DutchForce75 commented 4 years ago

Might be driver / adapter related?

DutchForce75 commented 4 years ago

@Kranzy: You could try to edit myZodiacTriClass.py line 78 into self.port.rs485_mode = serial.rs485.RS485Settings(True,False,None,None)

Does that make a difference?

Kranzy commented 4 years ago

@DutchForce75 No difference unfortunately. I did power the raspberry pi and 5v for the SWG from the same power source and I started getting rx led responding after the tx led. However I was still unable to get a response back when running either scripts.

DutchForce75 commented 4 years ago

@Kranzy: So what did you change that made the RX led respond? Was it the power source or the change of line 78?

Kranzy commented 4 years ago

@DutchForce75

It was the power.

Changing line 78 didn’t seem to make a difference even after power change.

DutchForce75 commented 4 years ago

That's something!

What is the response if you run these again? echo -n -e '\x10\x02\x50\x00\x62\x10\x03' > /dev/ttyUSB0 od -x < /dev/ttyUSB0

Kranzy commented 4 years ago

Side question.

Might be due for a new pump soon. Looking at an eco pump. Are there any brands that would be able to be integrated with this software??

sfeakes commented 4 years ago

Side question.

Might be due for a new pump soon. Looking at an eco pump. Are there any brands that would be able to be integrated with this software??

There is a Jandy line of pumps that use this protocol, I listed above in this thread when I was explaining protocols. But most use the Pentair protocol. The node project I listed will support Pentair pumps (and this SWG) protocol without a master control panel. But neither this project or the python listed in this thread currently support pumps.

DutchForce75 commented 4 years ago

Just wondering why the Zodiac Tri isn't responding when controller set to Aqualink, could this be because it's communicating on a higher baud rate?

Kranzy commented 4 years ago

That's something!

What is the response if you run these again? echo -n -e '\x10\x02\x50\x00\x62\x10\x03' > /dev/ttyUSB0 od -x < /dev/ttyUSB0

So back to square one unfortunately. I couldnt get any response or rx leds when powering both SWG and pi from the same 5v source. Wondering if I need to try a different adapter...although not sure that it's the problem.

I might try and move the pi so its a very short cable run to the SWG, see if that makes any difference.

DutchForce75 commented 4 years ago

What did you change compared to the situation where the rx leds responded?

Kranzy commented 4 years ago

What did you change compared to the situation where the rx leds responded?

@DutchForce75 I'm not sure to be honest. When I was first testing it and got the rx led to respond I was having to clamp the positive/negative 5v to drive the controller and then powered the pi with it also.

I bought a dc plug to match the transformer I was using, and wired the 5v for controller with a micro usb to power the pi on the same power source. Still no joy. So I then added wires so I could power the pi from the gpis headers, no change. I even tried powering pi via usb and gpis header from the same 5v source running to the controller.

I have decided to by a different RS485 for testing, im assuming that'll take another week or two to arrive.

Open to any other ideas to try in the mean time.

art0 commented 4 years ago

@sfeakes @DutchForce75 If we can not get the PH and ORP values from the SWG I wonder if we could tap into the sensors to read the voltage there.

Has anyone any experience measuring the voltage from the BNC of the sensors?

Do you know the brand of the sensors and their voltage range/curve?

image

image