Raspberry Pi control for meat curing chamber
This uses a raspberry Pi to read temeperature and humidity using a DHT22 sensor and controls a fridge with the following controls:
Temperature Too High - Turn fridge on
Temperature Too Low - Turn fridge off + turn on heater
Humidity Too High - turn on Fridge + Turn on heater if needed
Humidity Too Low - turn off Fridge + Turn on humidifyer
Circulate Air - circulate the air inside fridge
Air_Pump - inject fresh air from outside fridge
Weight 1 - read from load cell_1 using load cell connected to HX711 A-D converter
Weight 2 - read from load cell_2
Weight 3 - read from load cell_3
Weight 4 - read from load cell_4
Using 8 channel relay (5v, 120v) https://www.sainsmart.com/arduino-compatibles-1/relay/8-channel-dc-5v-relay-module-for-arduino-pic-arm-dsp-avr-msp430-ttl-logic.html
HX711 DAC code (thanks ggurov!) https://github.com/ggurov/hx711 The code is in 'c' and I don't believe Python would work due to timing sensitiviies in reading data from the DAC.
The parameters to control the fridge are held in a google sheet (see GSPREAD below).
The output data is held in a google sheet (see gspread below)
PorkPi is monitored with a watchdog (both hard and soft)
PorkPi reports errors / crashes / restarts via email.
PorkPi responds to email commands for restart and shutdown
Files:
/etc/rc.local
- Waits for wireless lan to initiate
- sends email saying rebooted
- starts StartPorkPi.sh shell script using screen (https://www.gnu.org/software/screen/manual/screen.html#Overview) to allow remote login to headless application
- starts StartWeighing.sh shell script using screen (https://www.gnu.org/software/screen/manual/screen.html#Overview) to allow remote login to headless application
./RebootMailer
- send email saying rebooted
./WaitForLan.sh
- loop until get successfulping from WLAN
./PorkPi.sh
- start hardware watchdog
- start software watchdog (PorkPiCheckDog.sh)
- send email saying Porkpi started
- execute python code PorkPi.py
- if crashed, send email saying crashed and restart PorkPi.py
./PorkPiCheckDog.sh
- touch file
- check file has been touched by PorkPi.py recently
- if file has not beentouched recently, reboot
- execute PorkPiCheckEmail.py to check to see if received email for reboot or restart
./PorkPiCheckEmail.py
- If received email from specific account with Subject = reboot, then reboot
- If received email from specific account with Subject = shutdown, then shutdown PorkPi
./StartWeighing.sh
- execute HX711 with parameters to read weight of load cell and write reults to file to be picked up by PorkPi.py
./PorkPi Main python code for PorkPi
GSPREAD Gspread forms integral part of system using google sheets as a gui for input parameters as well as output.
Many thanks to burnash for this great tool https://github.com/burnash/gspread
Setting up the credentials and permissions is a little tricky but persevere.
The google workbook has 5 sheets:
- Dashboard - contains the numerical and graphical status of the curing process, Temperatures, Humidity, Weights etc.
- Params - contains the input parameters to control the PorkPi
- Schedule - contains Temperature and Humidity settings on a daily basis so the chamber can be automatically controlled for a curingperiod
- db - the data read from the DHT22 and HX711 as well as status of devices. This can get very large 5.Batches - a sheet to record information about curing batches
Scripts: Init button calls ClearCCC which deletes the database data Load Cell buttons reset the starting weight for a new batch
Link - need to figure out how to link google sheet here
There is a secondary Dash spreadsheet which links latest data onto a smaller sheet which can be viewed on a cell phone
Link - need to figure out how to link google sheet here