I connected an RS485 module to an ESP8266 D1 mini to read data locally from from my Growatt inverter (SPH5000). It works but a few of the addresses return random huge anomalous data between updates which I’ve set to every 10 seconds. Some of the channels are from the ESPhome component and the others are reading the RS485 channels (found in the inverter datasheet).
I’ve added a filter on to a couple of channels but this only clips the data to the max range I’ve set.
Is there any way to disregard or stop this data passing through to Home Assistant?
Gif of the random data:
History graph is unuable:
Filtered channel graph is also full of noise:
The RS485 module is connected to a spare port on the inverter not the standard port used for the Growatt wifi module, I still have that connected separately.
As far as I can tell, the problem of Modbus CRC fail is because the received package begins with an extra 0x00 byte which should not be there. A modbus package begins with the address, which in this case is 0x01, the second byte of the package.
The same thing that our setups have in common is the usage of softserial, but at such low baudrate, it should not be a problem.
Anyways, I will try to use hardware serial and see if the problem is solved.
I tried changing the stop bits to 2 but it didn’t like it.
I also tried various baud rates but it only works at 9600.
I enabled the debugging and get loads of “CRC check failed” messages. I’ll check my wiring and add shielding where I can but I’ll be away from home for a couple of weeks. If it’s a hardware issue it’s likely between my TTL -RS485 adapter and the ESP.
I removed R7 which is the 120 ohm termination resistor and the CRC failed error did not appear anymore.
Removing the termination resistor should make things worse, not better, since I only have this board connected on the RS485 port of the inverter, but anyways, it works!
Thanks. That’s the same board I have. I’ll give it a try, I had planned on adding a resistor across A/B when I got a chance but I didn’t realise one was already on the board.
Did you come right. I have tried everything i cannot get my spf5000es to communticate. I have a nodemcuv3 with the same rs485 board. DI is wired to GPIO12, RO is wired to GPIO13 and the RE and DE are wired to GPIO4. I copied your setup but all i get is sending on the uart log without the resistor and with the resistor i just get CRC errors
I removed R7 on the RS485 board and I get less CRC errors but still get random high values coming through. I’ve still to try adding resistors on the terminals when I get time. I resoldered my boards with shorter wire connections to reduce noise also.
There’s info on your inverter here. I’d double check which pins you’re using and swap around.
I can’t remember but I think it may have been different pins entirely (maybe 3&4), my inverter is an SPH model.
Try each pair until you get Comms. You will see the data come through on the esphome log. Also check the protocol version (RTU or RTU2). I found a data sheet for my inverter online which had the modbus addresses listed (I’m not sure all the addresses were accurate though).
Hi @Gregsy, I know it’s been a while since this message was posted, but I have the same inverter as you and I would like to ask you for help on how to do it, can you answer these questions?
Do you have the Modbus documentation of the SPH?
How do you have it connected to the rs485 connector with rj45?
Can you tell me what I have to buy?
4.Can you pass me the configuration for esphome that you have?
I’ll get back to you in the next few days, I’m working away from home.
I should be able to pull all the info together and post it soon.
I used a D1 mini esp board and a TTL to RS485, I get quite a few CRC errors and it’s probably the cheap RS485 converter so you may want to search for something better.
The above words did not appear anywhere in this thread, so I feel the need to mention it here:
If you research how an RS485 bus is supposed to operate on the physical layer then it should become clear that there are periods where all connected transceivers are idle and high-Z. Therefore there must be pull-resistors somewhere on the bus to pull the voltage levels safely towards the idle (“MARK”) level. These pull resistors are called failsafe resistors.
Looking at the schematics for the TTL to RS485 converter it has built in fail safe resistors and a termination resistor. I removed the termination resistor from my board and added a different value resistor to the terminal connectors but no luck.
Use an old ethernet cable, cut one end off and connect pins 4&5 to the A&B- of the RS485 converter. (I’m in the UK, I believe different countries inverters may use different pins).
I used an ESP8266 D1 Mini board wired to a MAX485 TTL to RS485 converter board. Soldering required.
The D1 Mini has 5v and 3.3v pins for use and a micro USB connection. I powered this from the inverters unused USB port. Wire as per this:
you don’t know how much I appreciate your help. But I have continued researching and I see different connection schematics between both boards
does it make sense?
The wiring of the 3 signal wires is not critical which ones you use as long as you define them in the code. I just realised the wiring diagram I posted is not the one I originally used but must have saved it somewhere.
If you follow the wiring diagram on the link you posted change my section of code to:
I would like to do a similar setup, except that the Wemos serves as a slave device and transmits the values of a One Wire sensor and the A0.
For testing, I would like to read out the whole thing via Modscan.
My problem here is that I am not working with ESPHome but with the Arduino IDE.
Unfortunately, I can’t find any examples for Modbus Slave, only Modbus Master, but that doesn’t get me any further.
Does anyone have an idea or a page where I can derive a code?
I’m not sure what you’re aiming to do. Are you using modbus with the Wemos? If you’re not using ESPHome you’d probably be better starting a new thread.
I’ve been reading up in this thread, and figuring this may be the solution I’m looking for.
My Inverter (5000 TL3-s) comes with a DB9 port only, so I got the Wifi ShineLan.
Now, i’m quite a noob when it comes to this circuitry, but I think I somewhat understand what to do.
However, I’m wondering how to connect the setup to a DB9 plug. As my (poorly added) lines in the picture show, I"m wondering how connect the DB9 connector to the TTL-to-RS485 board.