jorticus / pymate

Outback MATE python interface
https://jared.geek.nz/pymate
GNU General Public License v2.0
28 stars 9 forks source link

Is wiring using a USB to RS232 cable doable? #26

Open retrodaredevil opened 3 years ago

retrodaredevil commented 3 years ago

Hi,

I'm slowly doing research into your project to figure out if it'd be worth it for me to get the extra data that'd be possible if I wasn't going through the RS232 DB9 port on the Mate2.

Two years ago when I was creating a cable for another charge controller (Renogy Rover), I used a simple USB to RS232 to DB9 cable then used the pins on that DB9 cable to connect to the charge controllers Rx, Tx, and GND. I was wondering if I'd be able to do the same thing here, the idea being that I wouldn't connect to my PIs GPIO at all.

Can what I just described above be done, or is there more conversion that needs to takes place? From what I could tell I just needed to communicate with outback devices using RS232. As long as my RS232 serial adapter supports -24V and 24V, I should be able to use it, correct?

jorticus commented 3 years ago

It might work, but you'll need to invert the data since RS232 treats -V as a logic '1'

Take a look at this reverse-engineered schematic of the MATE: image

I think there's enough protection circuitry there that it wouldn't be harmful - anything below 0V should be clamped by D10/D13, and then anything higher than 50% of VBat will be treated as a logic '1'.

However be very careful of ground loops / isolation! The GND in that schematic has a direct path to the battery, so if your PC is connected to some kind of mains circuit that could cause surges. Best to have an opto-isolator in the path. (The MATE has internal opto-isolators which is why it's RS232 port is safe)

Reddgum commented 3 years ago

Just a weird observation here, but I trust pin 7 of the LM393 (RX data) isn't shorted to ground, as shown from pin 8, 13 and 14 on the IC 74HC257D Mux...otherwise nothing will ever be passed on from pin 9 and 12 because the input will always be 0.

On Thu, Jul 8, 2021 at 2:35 AM Jared Sanson @.***> wrote:

It might work, but you'll need to invert the data since RS232 treats -V as a logic '1'

Take a look at this reverse-engineered schematic of the MATE: [image: image] https://user-images.githubusercontent.com/584458/124899043-d6679a80-e033-11eb-8f12-31aa538d35e3.png

I think there's enough protection circuitry there that it wouldn't be harmful - anything below 0V should be clamped by D10/D13, and then anything higher than 50% of VBat will be treated as a logic '1'.

However be very careful of ground loops / isolation! The GND in that schematic has a direct path to the battery, so if your PC is connected to some kind of mains circuit that could cause surges. Best to have an opto-isolator in the path. (The MATE has internal opto-isolators which is why it's RS232 port is safe)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jorticus/pymate/issues/26#issuecomment-876289452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL2U6JKUHMHH3RP6YRINV3TWVWOLANCNFSM477Y73HQ .

jorticus commented 3 years ago

Yeah that's definitely an error in my transcribing process - it wouldn't make sense for pin 13/14 to be connected to GND. It's more likely that 4B is connected to GND, and 4A is connected to the LM393 😊