This Rails application is used to provide temperature and humidity logging as JSON API from Raspberry Pi equipped with DHT22 (AM2302) temperature sensor.
Things you need:
-
Raspberry Pi
-
DHT22 sensor connected to GPIO pin 4
-
Debian and Ruby on Rails installed on SD card
-
PostgreSQL
-
Installed bcm2835 lib from: www.airspayce.com/mikem/bcm2835
Setup (on your Raspberry PI):
-
“git clone” this repository in /home/pi/Projects/ or any other directory (but change config/schedule.rb accordingly)
-
run “bundle install” to install gems
-
run “whenever –update-crontab” to set up cron jobs
-
run “rake db:create db:migrate” to set up database
-
reboot Raspberry Pi
Usage:
Current status from sensor should be available, check your.raspberry.IP/current and your.raspberry.IP/statuses
Sensor readings will be saved to database automatically via Crontab jobs every 3 minutes (if readings have changed). Application is started on every boot, so after setup you can leave an forget about it :)
If you are not a computer:
-
visit smart-garden-client.herokuapp.com and use graphical interface, just put in sensor location.
Future plans:
-
make whole app as an image to put directly on RasperryPi’s SD (zero setup)
-
handle dynamic IP’s with dynamic dns service