A GrowController that measures temperature and humidity. A dehumidifyer can be managed by an active solenoid. The project is based on a RaspberryPI 2B and DHT22 sensor.
- Create a new python env to manage python modules
python -m venv /path/to/new/virtual/environment
- Install dependencies using requirements.txt
pip install -r requirements.txt
We use a systemd service in order to start the script as soon as the PI boots up.
- Create a unit file to define the custom service
sudo nano /lib/systemd/system/GrowController.service
- Add following text, make sure to replace
userwith your local user
[Unit]
Description=My GrowController Service
After=multi-user.target
[Service]
Type=idle
WorkingDirectory=/home/user/Programming/GrowController/SensorBox
ExecStart=/home/user/Programming/GrowController/env/bin/python3.11 /home/user/Programming/GrowController/SensorBox/humidity.py > /home/user/Programming/logs/GrowController.log 2>&1
Restart=always
[Install]
WantedBy=multi-user.target
- Add permissions on the unit file
sudo chmod 644 /lib/systemd/system/GrowController.service
- Configure systemd and reboot
sudo systemctl daemon-reload
sudo systemctl enable GrowController.service
sudo reboot
- To check if the service is running use
sudo systemctl status GrowController.service