reaper7 / SDM_Energy_Meter

reading SDM72 SDM120 SDM220 SDM230 SDM630 modbus energy meters from arduino (esp8266, esp32, avr)
247 stars 97 forks source link

Multiple meter #61

Closed jsim20 closed 2 years ago

jsim20 commented 2 years ago

I know this has been covered before, however it doesn't seem to be working in my case.

I'm trying to wire 3 meters in series. I've given the meters the addresses 001, 002, 003.

I've adapted the code to suit as per the guidance:

` Serial.print("Total usage 1: "); Serial.print(sdm.readVal(SDM_TOTAL_ACTIVE_ENERGY), 0x01); Serial.println("kWh");

Serial.print("Total usage 2: "); Serial.print(sdm.readVal(SDM_TOTAL_ACTIVE_ENERGY), 0x02); Serial.println("kWh");

Serial.print("Total usage 3: "); Serial.print(sdm.readVal(SDM_TOTAL_ACTIVE_ENERGY), 0x03); Serial.println("kWh");`

What's very strange is that it just seems to be taking the reading off meter 1. However changing the meter address from 1, 2, 3, instead just seems to be changing the precision of the meter reading of meter 1....!

08:23:14.456 -> Total usage 1: 4.9kWh 08:23:14.951 -> Total usage 2: 4.85kWh 08:23:15.479 -> Total usage 3: 4.853kWh

Can anyone help?

jsim20 commented 2 years ago

....complete rooky mistake my apologies:

Serial.print("Total usage 1: "); Serial.print(sdm.readVal(SDM_TOTAL_ACTIVE_ENERGY, 0x01), 1); Serial.println("kWh");