Page 1 of 1

Mini data logger Raspberry Pi Zero / Annex

Posted: Thu Apr 27, 2023 1:02 pm
by peridot
RPI Zero running EmonCMS software with all the data collection processing handled by Annex via MQTT to Emoncms. Annex also controlling power / UPS / shutdown etc. Few charts attached of data collected, House Power and Network RSSI.
IMG_20230427_171740355 (Custom).jpg
Inputs (Custom).png
Power (Custom).png
Network Rssi (Custom).png

Re: Mini data logger Raspberry Pi Zero / Annex

Posted: Thu Apr 27, 2023 4:15 pm
by cicciocb
Super 👍

Re: Mini data logger Raspberry Pi Zero / Annex

Posted: Fri Apr 28, 2023 1:12 am
by peridot
Here Annex is combining the data from a Fronius Solar controller (Annex makes the API request) with the data from the energy meter (pulse detector as CT sensors are not easy to install in Australia due to the construction of the Electricity Meter Box). Annex is then making the Grid power calculations/values and then sending all this data as a MQTT post (mqtt server runs on the Pi as part of the EmonCms install)
House Power (Small).png
House power feeds (Small).png

Snippets of the Annex Code

Code: [Local Link Removed for Guests]

Sub gridpower
wlog "Gridpower"
  Local gridwatts,ginpower,goutpower,rndom
  gridwatts=upower
  'upower=(upower*3600)/10
  
  'check for solar contribution
  If gridwatts>0 Then
    'smooth upower,s3(),3
    ginpower=upower
    goutpower=0
    'upower=Int(upower)+spower  'add solar to grid power for total usage
    upower=Int(upower)  'Grud usage only
  Else                    'no grid input so solar is greater than usage
    ' print "Calc Power Usage.."
    'so apply just an average as usage and the balance as grid out
    rndom=Rnd(100) + gridavg
    'print "Random:"; random
    'smooth rndom,s1(),6
    upower=Int(rndom)
    'print "smooth:";  upower
    ginpower=upower-spower
    checkpos ginpower
    goutpower=spower-upower
    checkpos goutpower
  End If
  wlog "latest watts:";upower
  wlog "latest Solar:";spower
  wlog "to Grid:";goutpower
  wlog "from Grid:";ginpower
  power$="{"+q$+"power"+q$+":"+Str$(upower)+","+q$+"solar"+q$+":"+Str$(spower)+","+q$+"gridout"+q$+":"+Str$(goutpower)+","+q$+"gridin"+q$+":"+Str$(ginpower)+","+q$+"gridavg"+q$+":"+Str$(gridavg)+"}"
  'wlog power$
'
  wlog mqtt.publish("emon/STA1", power$)
 End Sub
 
 sub fronius
 wgetasync ("192.168.0.41/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData",80)
 end sub 
 
 answer_done:
  'wlog WGETRESULT$
  'Body.Data.PAC.Value
 ret$=json$(WGETRESULT$,"PAC.Value")
if ret$ <> "not found" then
sw$=ret$
sw$=replace$(sw$,": ","")
wlog "Solar ";sw$
 end if
  Return

Re: Mini data logger Raspberry Pi Zero / Annex

Posted: Mon Sep 25, 2023 11:36 pm
by RonS
thanks for sharing peridot
very interesting for me at the moment - I'm working on a similar project - reading out my "Hoymiles DTU" (AHOY- DTU) with the aim of controlling the microinverter - but I started today with coding - the first steps were already successful - I can read out the data with WGET

it should also be possible to read out a "shelly power meter" and thus control the power generation of the microinverter without feeding "back into the grid" 8-)

Of course, the data should then also be displayed on a nice VGA screen :roll:

have a nice day
Ron