Hello,
After reading through some other ground problem topics, I could not really figure out a solution for my situation.
I built a power source based on PV, battery and charge controller based on 12V. This power source shall supply my outdoor micro-controller projects with power. The power supply in general works well. My charge controller though has a COM port from which I can get hold of details regarding the loading, charging, etc. and I would like to capture and use this data. The capturing of the data takes place via a modbus module and the overall processing is happening with a Mega+WiFi micro-controller.
My assumption of having a ground problem are the following two setups that I have tested, attached/below are visual illustrations:
- Micro-controller being powered/grounded by PC USB cable and the charge controller being powered/grounded by its own circuit based on PV and battery. The only connection between the charger and the micro-controller setup are the A and B communication cables for the modbus. With this setup everything is working fine, I can read the charger COM port via the modbus module and micro-controller.
}
But the idea is not to have a spearate power source connected to this outdoor setup, the micro-controller setup shall get its power from the charger:
- Micro-controller being powered/grounded via the charger. With this setup the electronics and power supply work all well. The problem is that with this common ground the COM port does not provide any data anymore.
Can anyone think of why this happens and what needs to be done to fix the problem? I read some content that went in the direction of adding isolators/separators to such a setup but my general understanding is that a common ground should be actually preferred.
Key components used:
EPEver Trancer 1210 AN
Mega+WiFi micro-controller
Modbus module
Simplified code used to validate communication:
#include <ModbusMaster.h>
#define MAX485_DE 3
#define MAX485_RE_NEG 2
ModbusMaster node;
void preTransmission()
{
digitalWrite(MAX485_RE_NEG, 1);
digitalWrite(MAX485_DE, 1);
}
void postTransmission()
{
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
}
float batvol = 0;
void setup()
{
// put your setup code here, to run once:
pinMode(MAX485_RE_NEG, OUTPUT);
pinMode(MAX485_DE, OUTPUT);
// Init in receive mode
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
// debug / monitor serial port
Serial.begin(9600);
Serial.println("Serial 9600 Check");
// Modbus communication runs at 115200 baud
Serial1.begin(115200);
//Modbus slave ID 1
node.begin(1, Serial1);
// Callbacks allow us to configure the RS485 transceiver correctly
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);
}
void loop()
{
// put your main code here, to run repeatedly:
uint8_t resultMain;
resultMain = node.readInputRegisters(0x3100, 6);
// Serial.println( resultMain );
if (resultMain == node.ku8MBSuccess)
{
batvol=(node.getResponseBuffer(0x04) / 100.0f);
Serial.println(" - - - - - - - - ");
Serial.println("PV Voltage: ");
Serial.println(node.getResponseBuffer(0x00) / 100.0f);
Serial.println("PV Current: ");
Serial.println(node.getResponseBuffer(0x01) / 100.0f);
Serial.println("Battery Voltage: ");
Serial.println(node.getResponseBuffer(0x04) / 100.0f);
Serial.println("Battery Charge Current: ");
Serial.println(node.getResponseBuffer(0x05) / 100.0f);
}
delay(5000);
Appreciate any thoughts, comments, remarks that could guide me in the right direction of guide this discussion in the right direction.