NilsDeckert / Spacebucket

"A spacebucketis is an enclosed growth chamber that can be used to garden many kinds of plants. It is a versatile gardening tool that can be adapted to the users needs. Every variable of the bucket environment can be tweaked and upgraded at any time." -spacebuckets.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spacebucket

Building a fully automated spacebucket using a Raspberry Pi 2 and Raspberry Pi Zero W.

Have a look at the wiki for a more detailed insight into the idea

For this project I'm using two Raspberry Pis, a Zero W (publisher) to capture sensor data and to pass it to the Pi 2 (subscriber). The Raspberry Pi 2 then processes the received data, controls fans and light accordingly and uploads the data to a database for later use (e.g. visualizing it in a graph).

Imgur

Table of contents

  1. Introduction

  2. Getting started / Setup

  3. Usage


Getting started

Note: As of right now, the following part is not complete by any means and will be updated every now and then. How ever, I am listing useful ressources I used in the wiki for anyone who wants to try or has a similar project. Cheers!

Prerequisites / Setup


Publisher:

Temperature and humidity sensor:

The DHT11-sensor uses the Adafruit_Python_DHT library. To use it you have to install the python-dev module first:

sudo apt-get install build-essential python-dev

then download the library and install it

git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT/
sudo python setup.py install

mqtt:

sudo pip3 install paho-mqtt

MySQL:

python3 -m pip install mysql-connector 

Subscriber:

433MHz transmitter

To use the 433MHz transmitter install 433Utils by Ninjablocks:

git clone --recursive https://github.com/ninjablocks/433Utils.git
cd 433Utils/RPi_utils
make all

and then compile the outlet.cpp:

cd ../../
sudo g++ -DRPI /433Utils/rc-switch/RCSwitch.cpp outlet.cpp -o outlet -lwiringPi

mqtt:

sudo pip3 install paho-mqtt

MySQL:

python3 -m pip install mysql-connector 

Files on the publisher:

  • mqtt_publisher.py
  • pw.py

Files on the subscriber:

  • mqtt_subscriber.py
  • outlet.cpp
  • emailinfo.py
  • pw.py

pw.py

Change the pw.py on both devices to fit your database

Usage

If you've set up the software and the hardware correctly, start the software on both devices:

Subscriber:

sudo python3 mqtt_subscriber.py

Publisher:

sudo python3 mqtt_publisher.py

Command line arguments:

When starting the scripts you can use command line arguments:

sudo python3 mqtt_subscriber.py -h
usage: mqtt_subscriber.py [-h] [-d]

optional arguments:
  -h, --help   show this help message and exit
  -d, --debug  Toggle debug output

Commands:

With the publisher program running, you can also use commands to interven in the program:

To list all available commands type:

help

To read the current sensor data and send it to the subscriber, use

force measure

The cycle in which the software measures the data will not be shifted by this

You can manually adjust the fanspeed using:

fanspeed

followed by a number between 0 and 1000 in the next line.

With debug mode enabled, you can use

simulate temperature

and

simulate humidity

followed by a number of choice to simulate the corresponding value and send it to the subscriber

About

"A spacebucketis is an enclosed growth chamber that can be used to garden many kinds of plants. It is a versatile gardening tool that can be adapted to the users needs. Every variable of the bucket environment can be tweaked and upgraded at any time." -spacebuckets.com


Languages

Language:Python 96.5%Language:C++ 3.5%