Mini data logger Raspberry Pi Zero / Annex

Place your projects here
Post Reply
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Mini data logger Raspberry Pi Zero / Annex

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Mini data logger Raspberry Pi Zero / Annex

Post by cicciocb »

Super 👍
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Re: Mini data logger Raspberry Pi Zero / Annex

Post 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
You do not have the required permissions to view the files attached to this post.
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 65 times
Been thanked: 23 times

Re: Mini data logger Raspberry Pi Zero / Annex

Post 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
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
Post Reply