Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Greenhouse telemetry. Monitoring the greenhouse and the weather with a view towards automation

NotificationsYou must be signed in to change notification settings

rossdrew/greenhouse-telemetry

Repository files navigation

Some code experimenting with greenhouse telemetry and featured in myGreenhouse blog series

Grafana Screenshot Sample

Controller

  • Rasberry Pi 3 Model B v1.2
  • Programmed in Python (may change later)

Progress

UsingTrello to keep track of work

Temp/Humidity

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 Temp/Humidity

Local weather data is retrieved fromOpenWeatherMap API and recorded to DB for each reading for comparison.

Recording

Data is recorded to a local InfluxDB

Sample Weather JSON Data

{"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}

Setup

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
Start InfluxDD
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
Start Grafana
sudo systemctl start grafana-server

or automatically run on startup

sudo systemctlenable grafana-server

Should be running on :3000

Setup a Python environment
python3 -m venv .venv.venv/bin/pip3 install -r requirements.txt

Developing / Debugging

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

Running

Setup config

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>

Setup Database

Delete and recreate a new InfluxDb database

python init_db.py

Running Telemetry

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.

Experimental Control

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.

Plans

  • Add power generation and usage monitoring
  • Add light sensors, window state/control and perhaps automated watering
  • Add camera

[8]ページ先頭

©2009-2025 Movatter.jp