High-level framework for easy control of multiple devices connected to the Raspberry Pi and Arduino via GPIO
GPL-3.0 License
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:
and devices:
LOW
output state; turned off – default and HIGH
output states)HIGH
output state; turned off – default and LOW
output states)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
devices:
-
_id: dev_1
description: Main water pump
type_name: relay
control: arduino
arduino_port: /dev/ttyUSB0
pins:
power:
type: digital
number: 4
Put all seed info into the yml
file (see e.g. seed.example.yml) and use DB
class to import it into the CouchDB
:
from boxus import DB
db = DB()
db.seed('/path/to/seed.yml')
Then easily read all your sensors and save data into the CouchDB
from boxus import DB, Sensor
db = DB()
sensors = Sensor.all(db)
for s in sensors:
s.read()
turn on/off your devices
from boxus import DB, Device
db = DB()
dev = Device.find(db, 'dev_1')
dev.on()
dev.off()
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)
MacOS
brew install couchdb
or Linux
sudo apt-get install couchdb
git clone https://github.com/boxus-plants/boxus.git
cd boxus
pip install -e .
pip install boxus