theidealist
Member
Thanks for the suggestion! Unfortunately, I see no real difference (other than the number of bytes per "packet"). I conducted an experiment trying each of SEVENBITS or EIGHTBITS, at each of 4800, 9600, 19200, 38400 baudrates. There wasn't a clear winner
The results:
Looking here, I think 9600, EIGHTBITS, STOPBITS_ONE are the right settings:

... but this does mention RS-232 instead of RS-485. But I don't think that matters? RS-485 is just like the more industrial, noise resistant transport? Either way you are reading some number of bits by looking at voltages on pins at some interval, right?
I guess next step is to check the wires again. Maybe if I invert Data+ and Data- something will work? I thought I tried that before and got nothing. But, not sure what else to do. Wish I was better at this stuff!

The results:
Code:
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a59710, open=True>(port='/dev/ttyUSB0', baudrate=4800, bytesize=7, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 426 bytes, with dest 0x1
Read the next packet. It was 455 bytes, with dest 0x0
Read the next packet. It was 462 bytes, with dest 0x4
Read the next packet. It was 461 bytes, with dest 0x0
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a53710, open=True>(port='/dev/ttyUSB0', baudrate=4800, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 280 bytes, with dest 0xbc
Read the next packet. It was 419 bytes, with dest 0x1
Read the next packet. It was 415 bytes, with dest 0x1
Read the next packet. It was 430 bytes, with dest 0x14
Read the next packet. It was 447 bytes, with dest 0x0
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a96750, open=True>(port='/dev/ttyUSB0', baudrate=9600, bytesize=7, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 744 bytes, with dest 0x0
Read the next packet. It was 744 bytes, with dest 0x49
Read the next packet. It was 460 bytes, with dest 0x0
Read the next packet. It was 753 bytes, with dest 0x60
Read the next packet. It was 765 bytes, with dest 0x1
Read the next packet. It was 753 bytes, with dest 0x8
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb59c6730, open=True>(port='/dev/ttyUSB0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 704 bytes, with dest 0x0
Read the next packet. It was 694 bytes, with dest 0xc0
Read the next packet. It was 335 bytes, with dest 0x48
Read the next packet. It was 695 bytes, with dest 0x0
Read the next packet. It was 697 bytes, with dest 0x0
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb59cf730, open=True>(port='/dev/ttyUSB0', baudrate=19200, bytesize=7, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 1407 bytes, with dest 0x50
Read the next packet. It was 1422 bytes, with dest 0x12
Read the next packet. It was 1386 bytes, with dest 0x50
Read the next packet. It was 1401 bytes, with dest 0x0
Read the next packet. It was 1401 bytes, with dest 0x50
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a0a790, open=True>(port='/dev/ttyUSB0', baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 1303 bytes, with dest 0x88
Read the next packet. It was 1314 bytes, with dest 0x4
Read the next packet. It was 1278 bytes, with dest 0x2
Read the next packet. It was 1288 bytes, with dest 0x1a
Read the next packet. It was 1286 bytes, with dest 0x81
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a17650, open=True>(port='/dev/ttyUSB0', baudrate=38400, bytesize=7, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 2400 bytes, with dest 0x0
Read the next packet. It was 2367 bytes, with dest 0x0
Read the next packet. It was 1803 bytes, with dest 0x0
Read the next packet. It was 2397 bytes, with dest 0x30
^C
KeyboardInterrupt
pi@raspberrypi:~/Downloads $ ./jandy_heater_control.py
Opening rs485 serial connect on port /dev/ttyUSB0
-> Serial port opened: RS485<id=0xb5a2c770, open=True>(port='/dev/ttyUSB0', baudrate=38400, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=True, dsrdtr=False)
Read the next packet. It was 2242 bytes, with dest 0x5
Read the next packet. It was 1988 bytes, with dest 0x14
Read the next packet. It was 2200 bytes, with dest 0x0
Read the next packet. It was 2194 bytes, with dest 0x10
Read the next packet. It was 2218 bytes, with dest 0xd5
Read the next packet. It was 2237 bytes, with dest 0x35
^C
KeyboardInterrupt
Looking here, I think 9600, EIGHTBITS, STOPBITS_ONE are the right settings:

... but this does mention RS-232 instead of RS-485. But I don't think that matters? RS-485 is just like the more industrial, noise resistant transport? Either way you are reading some number of bits by looking at voltages on pins at some interval, right?
I guess next step is to check the wires again. Maybe if I invert Data+ and Data- something will work? I thought I tried that before and got nothing. But, not sure what else to do. Wish I was better at this stuff!