0

I have a Chinese hybrid solar inverter that exposes an rj45 input which talks the serial protocol (Baud rate 2400, no parity, 8 bits, 1 stop bit). I need my Arduino (say, Mega or whatever, does not really matter) to talk to it. What would be the best option to connect an Arduino board to the rj45 input such that it would be available as Serial in the code?

Basically, I'd like the following piece to code to "just work":

    uint8_t query[] = {81, 80, 73, 71, 83, 183, 169, 13};
    Serial.write(query, sizeof(query)); // Write some bytes to a device, i.e. send a request.
    Serial.flush();

    while (!Serial.available()); // Wait for device to reply.
    String str = Serial.readString();
    // do someting with `str`...

In other words, I am looking for a hardware solution to connect my Arduino board to the rj45 input without introducing an unnecessary complication (if any).

7
  • the rj45 is irrelevant here because it is just an 8 pin connector ... the electronics behind the connector are the important part
    – jsotola
    Aug 15, 2023 at 20:32
  • @jsotola I know for sure it talks Serial with the params I specified. That is the only fact I know. I belive the protocol is r232 or something alike, I am far from being proficient in the hardware part of the things. Yet the bytes I am sending over the serial are correct.
    – Zazaeil
    Aug 15, 2023 at 20:35
  • 2
    You need to know the signal voltage level (Arduinos use 5V or 3.3V depending on model), whether control signals (DTR, DCD, DSR...) are used or needed (Arduinos do not use them), whether flow control is needed (Arduinos do not do flow control natively), and the pinout of the RJ45 connector. If all the stars align, it's just a matter of connecting the device's RX, TX, and GND to the appropriate Arduino pins. Otherwise you may need a level shifter. Aug 15, 2023 at 20:53
  • @EdgarBonet I don't have necessary tools to get that data. Shall I hope it does align as expected and simply connect the named RX, TX and GND to a converter. The question is - how that conver is suppose to look like? I guess a would need a converter to be installed on the Arduino board AND I would also need a data cable that would carry the signal to the rj45 input. Where do I get these and how to choose them corretly? I don't really see another options except "give it a try" and pray.
    – Zazaeil
    Aug 15, 2023 at 20:58
  • You might consider having a few spare Arduinos, connecting them to the wrong voltage can fry them. There are interface ICs that to the translation from the micro to the serial cable. I am assuming that is a commercial inverter and it would surprise me if it were just a logic output.
    – Gil
    Aug 16, 2023 at 3:18

1 Answer 1

1

Look up the data sheet for the max232. It is an old chip that does what you need. ARDUINOs serial work at 0 to 5v and the old fashioned standard for serial data works at +-12v. Also, there will be a high low inversion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.