Boxus
About
Inspired by Ruby on Rails ActiveRecord and powered by Nanpy high-level framework for easy control of multiple devices connected to the Raspberry Pi and Arduino via GPIO. Core of the open DIY project of building automated plants grow pod.
Currently supported out of the box sensors:
- DHT digital temperature and humidity sensor (DHT11 tested)
- Analog soil moisture sensor
Use declarative YAML syntax to specify how your sensors and devices are connected, e.g.:
sensors:
-
_id: sensor_1
description: DHT11 Temperature and humidity sensor
type_name: dht
control: native
measurements:
- temperature
- humidity
pins:
input:
type: digital
number: 4
dht_version: 11
-
_id: sensor_2
description: Moisture sensor
type_name: moisture
control: arduino
arduino_port: /dev/ttyUSB0
measurements:
- moisture
pins:
power:
type: digital
number: 5
input:
type: analog
number: 15
Put all seed info into the yml
file (see e.g. seed.example.yml) and use Manager
class to import it into the CouchDB
:
from boxus import DB, Manager
db = DB()
manager = Manager(db)
manager.seed('/path/to/seed.yml')
Then easily read your sensors and save data into the CouchDB
from boxus import DB, Sensor
db = DB()
sensors = Sensor.all(db.sensors)
for s in sensors:
s.read()
or create a watchdog script (see watchdog.py example) and install CRON job using Manager
:
from boxus import Manager
manager = Manager()
# E.g. every 10 minutes
manager.install_cron('/path/to/python /path/to/watchdog.py', 10)
Installation
Requirements
MacOS
brew install couchdb
or Linux
sudo apt-get install couchdb
The latest development build
git clone https://github.com/boxus-plants/boxus.git
cd boxus
pip install -e .
The latest stable release
pip install boxus
Requirements
Hardware
- Raspberry Pi (Pi 3 tested)
- Arduino (Nano v3 tested)
Software
Required
Optional
- Nanpy Firmware for Arduino for easy Arduino control and analog sensors support
- Adafruit Python DHT library for reading temperature and humidity data from DHT sesnors connected directly to Raspberry Pi