- Notifications
You must be signed in to change notification settings - Fork1
Greenhouse telemetry. Monitoring the greenhouse and the weather with a view towards automation
rossdrew/greenhouse-telemetry
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Some code experimenting with greenhouse telemetry and featured in myGreenhouse blog series
- Rasberry Pi 3 Model B v1.2
- Programmed in Python (may change later)
UsingTrello to keep track of work
We are using theAM2302 wired as follows
VCC -> Pi Pin 1GND -> Pi Pin 6DATA -> Pi Pin 7
and theAdafruit Python Drivers which can be set up as follows
(1) Clone the drivers repo
git clone https://github.com/adafruit/Adafruit_Python_DHT.gitcd Adafruit_Python_DHT
(2) Make sure python is up to date
sudo apt-get upgradesudo apt-get install build-essential python-dev
(3) Install the Adafruit drivers
sudo python setup.py install
(4) Run the test to make sure it worked
cd examplessudo ./AdafruitDHT.py 2302 4
Local weather data is retrieved fromOpenWeatherMap API and recorded to DB for each reading for comparison.
Data is recorded to a local InfluxDB
{"coord": {"lon":-0,"lat":0},"weather": [{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"base":"stations","main": {"temp":10.49,"pressure":1014,"humidity":66,"temp_min":8,"temp_max":12.22},"visibility":10000,"wind": {"speed":3.1,"deg":240},"clouds": {"all":75},"dt":1559121266,"sys": {"type":1,"id":1442,"message":0.0063,"country":"GB","sunrise":1559101162,"sunset":1559162573},"timezone":3600,"id":1,"name":"Location","cod":1}
InstallInfluxDB:
curl -sL https://repos.influxdata.com/influxdb.key| sudo apt-key add -lsb_release -a
And with the Linux release codename
sudo apt install apt-transport-httpsecho"deb https://repos.influxdata.com/debian <CODENAME> stable"| sudo tee /etc/apt/sources.list.d/influxdb.listsudo apt updatesudo apt-get install influxdb
sudo service influxdb start
or automatically run on startup
sudo systemctlenable influxdb
InstallGrafana
wget https://dl.grafana.com/oss/release/grafana_6.6.0_armhf.debsudo dpkg -i grafana_6.6.0_armhf.deb
sudo systemctl start grafana-server
or automatically run on startup
sudo systemctlenable grafana-server
Should be running on :3000
python3 -m venv .venv.venv/bin/pip3 install -r requirements.txt
Install sshfs, link development machine to Pi by mounting the source directory and open in development environment
dnf install sshfsmkdir /mnt/pi/ghsshfs pi@<PI_IP>:/mnt/pi/gh /home/src/pi/gh
You will need to fill config.properties with
[Deploy]name = "my deployment name"[AM2302]pin = <pin thhat AM2302 is attached to>[Weather]location = <location for querying>open_weather_map_app_id = <your personal app.id>
Delete and recreate a new InfluxDb database
python init_db.py
Run the peripheral read loop
python read_cycle.py
which will start to fill up a specified InfluxDB
Running in a test environment (not on a Raspberry Pi with a AM2302 sensor) will require swapping out the used ofTestClimateDataSource
for theAM2302DataSource
. I'm yet to figure out a nice way to automate this.
There's a simple control cycle in place in run_greenhouse.py. This will turn a light on during daylight hours and keep track of soil moisture. It also has the ability to turn on water which hasn't been included in the cycle quite yet.
- Add power generation and usage monitoring
- Add light sensors, window state/control and perhaps automated watering
- Add camera
About
Greenhouse telemetry. Monitoring the greenhouse and the weather with a view towards automation