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
ssh
file. - Add
wpa_supplicant.conf
with wifi SSID and PSK. - Add
dtoverlay=w1-gpio
toconfig.txt
.
- Add empty
- Boot Pi and SSH in with default user
pi
passwordraspberry
. - Change password and add authorized ssh key.
- Install Telgraf
- Add a
resource_id
to attach metrics intelegraf.conf
copy it to/etc/telegraf
. - Fill in
azuremonitor.env
and copy it to/etc/telegraf
.- The service principal needs "Monitoring Metrics Publisher" role on the resource in
resource_id
above. - Run
chmod 600 azuremonitor.env
.
- The service principal needs "Monitoring Metrics Publisher" role on the resource in
- Copy
10-azuremonitor.conf
into new directory/etc/systemd/system/telegraf.service.d
. - Run
sudo systemctl enable telegraf
,sudo systemctl start telegraf
.
- Add a
- Install Picool
- Copy
picool
binary andinflux_temps.sh
into new directory/opt/picool
andchmod 755
them. - Fill in
picool.env
and copy it into/etc
. - Copy
picool.service
into/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 --release
Assumes 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" 17
Run cargo run --features demo-mode
. This does not do any actual I/O and simulates the sensor.