-
I wonder if anyone can help, the text below is what I get on the serial monitor screen of the Arduino IDE with the sofar2mqtt.ino. loaded onto a esp8266 mini D1. From the monitor: WiFi connected - ESP IP address: 192.168.1.183 The above text is the same with the RS485 to TTL board connected or not, therefore I'm thinking the code in the esp8266 is the problem. Since I know that this same code has been used by solarman users it must be something I have done incorrectly. [code] // Update these to match your inverter/network. // The device name is used as the MQTT base topic. If you need more than one Sofar2mqtt on your network, give them unique names. #define WIFI_SSID "" (c)Colin McGerty 2021 colin@mcgerty.co.uk #include <Arduino.h> #define SOFAR_SLAVE_ID 0x01 #ifdef INVERTER_ME3000 #define RS485_TRIES 8 // x 50mS to wait for RS485 input chars. // MQTT parameters // SoftwareSerial is used to create a second serial port, which will be deidcated to RS485. // Sofar run states #ifdef INVERTER_ME3000 #define HUMAN_CHARGING "Charging" #elif defined INVERTER_HYBRID // State names are a bit strange - makes sense to also match to these? #define HUMAN_CHARGING "Normal" #define MAX_FRAME_SIZE 64 unsigned int INVERTER_RUNNINGSTATE; // Battery Save mode is a hybrid mode where the battery will charge from excess solar but not discharge. // SoFar ME3000 Information Registers #define SOFAR_FN_STANDBY 0x0100 struct mqtt_status_register static struct mqtt_status_register mqtt_status_reads[] = // This is the return object for the sendModbus() function. Since we are a modbus master, we // These timers are used in the main loop. // Wemos OLED Shield set up. 64x48, pins D1 and D2 /**
// Update the OLED. Use "NULL" for no change or "" for an empty line. void updateOLED(String line1, String line2, String line3, String line4)
} // Connect to WiFi
} int addStateInfo(String &state, uint16_t reg, String human)
} void sendData()
} // This function is executed when an MQTT message arrives on a topic that we are subscribed to.
} void batterySave()
} // This function reconnects the ESP8266 to the MQTT broker
} /**
int sendModbus(uint8_t frame[], byte frameSize, modbusResponse *resp)
} // Listen for a response.
} int readSingleReg(uint8_t id, uint16_t reg, modbusResponse *rs)
} int sendPassiveCmd(uint8_t id, uint16_t cmd, uint16_t param, String pubTopic)
} void sendMqtt(char* topic, String msg_str)
} void heartbeat()
} void updateRunstate()
#ifdef INVERTER_ME3000
} unsigned int batteryWatts()
} void setup()
} void loop()
} //calcCRC and checkCRC are based on... void calcCRC(uint8_t frame[], byte frameSize)
} bool checkCRC(uint8_t frame[], byte frameSize)
} Thanks Mike |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Looks like a problem with your rs485 interface. I purxhased 3 from from aliexpress and only one works! They are supposed to be identical. Do you see the RS485 symbol in the inverter display? Top left. |
Beta Was this translation helpful? Give feedback.
-
[Image.jpeg]Thanks for your speedy response, I had given thought to the RS485 boards being faulty and ordered another 2 boards from a different source in AliExpress but got the same outcome.
I should have mentioned that the Rx and Tx leds on the interface board have never shown any activity.
I’ve checked the 3.3 volts from the esp8266, I’ve checked that I am using pins D6 and D7, I have also used a different esp8266 board and of course I have tried 4 different interface boards etc.
I haven’t seen the RS485 symbol on the display but I will pay more attention to that when I connect it up again today.
I wonder what are the chances of me having 4 faulty boards. The serial monitor gives out the same messages whether the interface is connected or not, so is the message telling me that the board is not seen by the esp8266, should the interface device be visible in device manager because I checked ages ago and it wasn’t?
I have also used the mqtt to display temperatures from bme280 and Dallas sensors, I did these experiments to try to get familiar with mqtt and found that they worked well without any hassle.
For your information I am running home assistant on Raspberry Pi 3b and the photo attached shows the SOFAR installation in my house which I am trying to connect to.
Regards
Mike
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: cliffdude ***@***.***>
Sent: Wednesday, October 4, 2023 9:13:10 AM
To: cmcgerty/Sofar2mqtt ***@***.***>
Cc: kiwibhoy ***@***.***>; Author ***@***.***>
Subject: Re: [cmcgerty/Sofar2mqtt] Sofar2mqtt cmcgerty Failure to get data from esp8266 (Discussion #68)
Looks like a problem with your rs485 interface. I purxhased 3 from from aliexpress and only one works! They are supposed to be identical. Do you see the RS485 symbol in the inverter display? Top left.
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APVHUIH3AYFE7GTYLT2L5HDX5RWVNAVCNFSM6AAAAAA5QJR7EKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TCNZZHEYDS>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
$ faulty boards is unlikely, I agree. MQTT is not the problem as you are not receiving any data from the inverter. You could also change the code to GPIO numbers "D6 -> 12" and "D7 -> 13" however you must check that your boards D6 actually goes to gpio 12 on the chip, if it does not you will not cause any damage but it will not work. |
Beta Was this translation helpful? Give feedback.
-
Hi.
Great success!
What I found is that you had nailed it!
I had left the original ESP8266 MOD board I had selected earlier while using that particular board, and that I had dropped the D6, D7 and used 6&7 as you will see in the code I sent you previously. I now have Rx and Tx flashing and all I have to do is some work on HA and node red to get rid of some errors.
Thanks so much for your very appreciated help.
Regards
Mike
…________________________________
From: cliffdude ***@***.***>
Sent: Wednesday, 4 October 2023 7:24 pm
To: cmcgerty/Sofar2mqtt ***@***.***>
Cc: kiwibhoy ***@***.***>; Author ***@***.***>
Subject: Re: [cmcgerty/Sofar2mqtt] Sofar2mqtt cmcgerty Failure to get data from esp8266 (Discussion #68)
$ faulty boards is unlikely, I agree. MQTT is not the problem as you are not receiving any data from the inverter.
What model do you have?
The LEDS should flash even if the inverter is not "replying" to the serial data sent to it, in that case you would see only the TX led flash so that make me think it is a pinout issue on your esp8266. Did you select the correct board in the arduino IDE as defining Dx pins means that the IDE must convert D1 to the corresponding GPIO number. The esp chip does not know what D1 or D5 means it only knows what a GPIO number is. Check out this link and you will see what I mean : https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
You could also change the code to GPIO numbers "D6 -> 12" and "D7 -> 13" however you must check that your boards D6 actually goes to gpio 12 on the chip, if it does not you will not cause any damage but it will not work.
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/APVHUIFKVHVOD5YC6AMHMHDX5T6JHAVCNFSM6AAAAAA5QJR7EKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TCOBTGAYDA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You are welcome! Same thing has happened to me too... |
Beta Was this translation helpful? Give feedback.
$ faulty boards is unlikely, I agree. MQTT is not the problem as you are not receiving any data from the inverter.
What model do you have?
The LEDS should flash even if the inverter is not "replying" to the serial data sent to it, in that case you would see only the TX led flash so that make me think it is a pinout issue on your esp8266. Did you select the correct board in the arduino IDE as defining Dx pins means that the IDE must convert D1 to the corresponding GPIO number. The esp chip does not know what D1 or D5 means it only knows what a GPIO number is. Check out this link and you will see what I mean : https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
You could also ch…