www.zoneblue.nz

Getting data off Midnite Classic

The bad news is that the Midnite Classic charge controller does not have a web interface. However it does have a ethernet port, and a modbus over TCP implementation.

 

Using that and the "Local App" software (kinda hard to find, its at www.mymidnite.com ) you can see whats happening to your solar on your desktop. It requires Adobe Air which is a sort of framework application that runs on windows and mac, that uses html and flash to allow web applications to run on the client.

 

First attempts with the local app resulted in lots of disconnects until i upgraded the local app, and air package to the latest. Still, the data export options are not really that useful to those that want to do real time data logging. Worst is that out of the box the lite has no idea what the current date is.

 

So googling, i first found and tried phpmodbus:

 

require_once 'Phpmodbus/ModbusMaster.php';

$classic = new ModbusMaster("192.168.0.223", "TCP");

function readRegister($reg) {

      try {

            $temp = $this->modbus->readMultipleRegisters(1, $reg-1, 1); //note midnite and phpmodbus disagree by 1

            return (($temp[0] << 8) + $temp[1]);

      }

      catch (Exception $e) {

            echo "Error reading :" . $reg. $e;

      }

}

echo readRegister(4119) ; //controller output power right now

 

It works, but for some reason on my network and with my classic it times out unpredictably and often.

 

I then tried stephenvs python method. That certainly worked more consistently, but was still slow.

 

Saving the best for last, is rossw's custom, pure c solution. Download it at support.rossw.net/midnite/, rename it to newmodbus, save it somewhere sensible like /opt, chmod 0755, and your'e away:

 

peter@atom:~$ ./newmodbus   192.168.0.223 4101-4111

ID CLASSIC

ClassicTime 12:38:34   02/07/2013

4101 1174 (0x496)

4102 2012 (0x7DC)

4103 2061 (0x80D)

4104 0 (0x0)

4105 0 (0x0)

4106 7061 (0x1B95)

4107 3840 (0xF00)

4108 24605 (0x601D)

4109 0 (0x0)

4110 0 (0x0)

4111 3042 (0xBE2)

 

Then all you have to do is run something out of cron every minute, to parse and load the results into your database. Piece of cake.

 

For help on the registers see the documentation or if that breaks its under Documents-Specs.

 

The main registers you need are these:

 

  • ChargeStage= [4120]MSB
  • Lifetime kW-Hours= (([4127] << 16) + [4126]) kWh
  • Infoflags = (([4131] << 16) + [4130])
  • FloatTimeToday= ([4138]) s
  • KwhToday=    ([4118]) kWh
  • Tbatt=   ([4132] /10) degC
  • Tfet=   ([4133] /10) degC
  • Vbatt= ([4115] /10) V
  • Ibatt= ([4117] /10) A
  • Vpv=    ([4116] /10) V
  • Ipv=    ([4121] /10) A
  • Watts= ([4119]) W

 

If you are a real coder, then youll be lazy and download something to get you started here.

 

 

 

Not much of a power day. If you ever wondered what solar produces on a wet and miserable winters day, there you go.