Help, my solar experiment is crashing my serial monitor!
I am running an Arduino Uno v3, latest IDE on stock Windows XP SP3. I have a current monitor that ties into my arduino board and sends current readings back to the serial port that is then displayed on the serial monitor. Everything works fine, for several hours, but then, every single time, the next day I return to the office to find the computer hanging, serial output stopped, and javaw running at 100%. The example code is below - untouched from: https://github.com/adafruit/Adafruit_INA219/blob/master/examples/getcurrent/getcurrent.pde
The sensor reads correctly when the program is operational - but for reference:
The circuit is wired thusly: http://learn.adafruit.com/adafruit-ina219-current-sensor-breakout/wiring. The only twist I have is the incoming current comes from a solar panel so I have an diode in the path the prevent back flow of current. It is a high side current sensor / volt sensor so it is required to connect the (-) from the solar panel to the (grd) from the arduino to the (-) on the solar charge controller. The (+) goes to through the current sensor (V+ to V-) then to the charge controller. The charge controller then charges a 12 V Deep Cycle Battery if necessary.
Is the serial monitor not a reliable way to view data over the long haul or am I missing something obvious?
Please note the code below is straight up example code from Adafruit and I am told is bug-free:
Serial.println("Measuring voltage and current with INA219 ...");
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
shuntvoltage = ina219.getShuntVoltage_mV();
busvoltage = ina219.getBusVoltage_V();
current_mA = ina219.getCurrent_mA();
loadvoltage = busvoltage + (shuntvoltage / 1000);
Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V");
Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V");
Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA");