Fridge Fleet Monitor
LoRa-based temperature, humidity and door open/close state for a fleet of refrigerators.
To run this project yourself you'll need to:
- Acquire the necessary hardware.
- Set Up a LoRaWAN Gateway.
- Flash the project's firmware.
- Connect all hardware.
- Install the hardware.
- Test everything out.
Hardware
The following hardware is required to run the Fridge Fleet Monitor.
- Blues Starter Kit for LoRaWAN
- Raspberry Pi Pico
- Adafruit magnetic contact switch (door sensor) x 2
- DHT-11 Temperature and Humidity Sensor
- 10k Resistor
LoRaWAN Gateway Setup
Before you can use the Notecard LoRa you need to have a LoRaWAN gateway that is provisioned to The Things Network. To make this easy you can use the Blues Indoor LoRaWAN Gateway. To get this set up follow the setup instructions
Firmware
This project runs on CircuitPython so you need to install it onto your Raspberry Pi Pico. Follow the instructions from Adafruit: Installing CircuitPython
Once this is installed, the Pico will present as a mass storage device that you can install libraries and firmware onto. First install the note-python library, and then the Adafruit CircuitPython DHT Library.
Finally, update the ProductUID value in this repository’s code.py
file, and copy that file onto the Pico.
Hardware Setup
Place your Raspberry Pi on a breadboard, with the USB socket sticking out to the right. Make the following connections:
Pico Power:
- GND on Pico (Pin 38) to Breadboard Ground Rail
- 3V3 OUT on Pico (Pin 36) to Breadboad +VE Rail
Door Sensor:
- GP28 on Pico (Pin 34) to 10K Resistor
- 10K resistor to Breadboard +VE Rail
- GP28 on Pico (Pin 34) to Magnetic Door Sensor
- GND Rail on Breadboard to Magnetic Door Sensor
DHT11 Sensor:
- DHT11 may have 3 or 4 pins. If there is 4, one is left disconncted.
- DHT11 Data Pin to Pico GP22 (Pin 29)
- DHT11 GND Pin to Breadboad GND Rail
- DHT11 VDD Pin to Breadboard +VE Rail
Notecarrier:
- Notecarrier can be connected with a Qwiic cable.
- Qwiic Black (GND) to Breadboard GND Rail
- Qwiic Blue (SDA) to Pico GP4 (Pin 6)
- Qwiic Yellow (SCL) to Pico GP5 (Pin 7)
Do not connect the Red cable of the Qwiic connector. If you wish to power the Pico from the Notecarrier (which makes sense after testing) connect VMAIN on the Notecarrier to VSYS (Pin 39) on the Pico.
See the image below for a diagram of the connections required.
Breadboard Connections
Hardware Installation
With the hardware assembled and the proper code on the Pico, attach the temperature sensor inside the fridge you wish to monitor. Be careful to route the wires so they do not affect the seal of the door.
To attach the sensor inside the fridge, use Command Strips or some other adhesive strip attached to the back of the sensor, and wipe down the area to place with node with rubbing alcohol prior to attaching for best adhesion.
DHT11 Sensor installed in a refrigeration unit.
Likewise, to install the door sensors, attach each piece of the sensor on one side of the door via Command Strips and ensure they line up as closely as possible. See the image below.
Testing
Ensure your Notecarrier is powered with a battery or via a USB power supply.
Connect the Raspberry Pi Pico to your computer with a USB Cable, ensuring you have no power cable between the Notecarrier and the Pico to prevent damage.
Open a Serial Terminal Emulator to view the log output from the Pico code. You should see output similar to below:
Open the fridge door. In the console you should see the message 'Door Wakeup. Door Value: True' and 'Door Open'. In addition, you should see an event in the Blues Notehub with a filename of door.qo
with the body of {"open":true}
Close the fridge door. In the console you should see the message 'Door Closed'. In addition, you should see an event in the Blues Notehub with a filename of door.qo
with the body of {"closed":true}
Additionally you should see an event in Notehub with the filename of readings.qo
and a body similar to {"humidity":48,"temperature":22}
. This is the relative humidity percentage and the temperature in Celsius. This event should be sent by default every 60 minutes.
Further Development
If you wish to develop this project further, here are some suggestions.
Firstly, the DHT11 sensor is cheap and accessible, but not necessarily the most accurate. Consider replacing it the BME280, which also connects via I2C, so it will share the same connections as the Notecarrier. There is a CircutPython Library available for the BME280 as well.
Secondly, a great addition to the functionality would be to add and send Note if the fridge door is left open for a configurable time. I will leave this as an exercise to the user on how to add this feature, but it should be quite simple with the existing code.
Blues Community
We’d love to hear about you and your project on the Blues Community Forum!