A Raspberry Pi Zero controller for a refrigerator compressor. Also includes configuration for Telegraf to send data to Azure Monitor Metrics (which can be displayed with Grafana or Azure Monitor Workbooks).
- Install Raspberry Pi OS Lite to SD Card.
- In
/boot:- Add empty
sshfile. - Add
wpa_supplicant.confwith wifi SSID and PSK. - Add
dtoverlay=w1-gpiotoconfig.txt.
- Add empty
- Boot Pi and SSH in with default user
pipasswordraspberry. - Change password and add authorized ssh key.
- Install Telgraf
- Add a
resource_idto attach metrics intelegraf.confcopy it to/etc/telegraf. - Fill in
azuremonitor.envand copy it to/etc/telegraf.- The service principal needs "Monitoring Metrics Publisher" role on the resource in
resource_idabove. - Run
chmod 600 azuremonitor.env.
- The service principal needs "Monitoring Metrics Publisher" role on the resource in
- Copy
10-azuremonitor.confinto new directory/etc/systemd/system/telegraf.service.d. - Run
sudo systemctl enable telegraf,sudo systemctl start telegraf.
- Add a
- Install Picool
- Copy
picoolbinary andinflux_temps.shinto new directory/opt/picoolandchmod 755them. - Fill in
picool.envand copy it into/etc. - Copy
picool.serviceinto/etc/systemd/system. - Run
sudo systemctl daemon-reload,sudo systemctl enable picool,sudo systemctl start picool.
- Copy
sudo apt install gcc-arm-linux-gnueabi
rustup target add arm-unknown-linux-gnueabi
cargo build --target arm-unknown-linux-gnueabi --releaseAssumes a temperature sensor and a relay for the compressor power is connected.
# picool <PATH TO TEMPERATURE FILE> <RELAY CONTROL GPIO PIN>
./picool "/sys/bus/w1/devices/28-00112233445566/temperature" 17Run cargo run --features demo-mode. This does not do any actual I/O and simulates the sensor.

