-
Notifications
You must be signed in to change notification settings - Fork 0
damico/j-rpi-therm-d
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
GOAL =========================== Make an autonomous and reliable device based on Raspberry Pi board to monitor temperature and send results to an url throught a Wifi connection. The temperature sensor for this device must be based on DS18B20 (http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf) and use a 1-wire connection. Once the device is ready and powered it should be able to: a) Auto-connect to a Wifi Access Point with a PSK encryption; b) Auto-load the kernel modules required by temperature sensor; c) Auto-start an OS service which loads an application that catches the temperature measurement and sends to an url. This service must be in init.d with support to start and stop commands. NOTE 1: In order to get Raspberry Pi working with wifi, out-of-the-box without a need for extra power supply, like a powered usb hub, I've choosen the [D-link USB Wifi adaptor Nano Dwa-131], which worked perfect! NOTE 2: In order to get Raspberry Pi working with DS18B20 thought 1-wire connection you will need a Linux kernel with w1-gpio and w1-therm modules. For that I've used, Adafruit Occidentalis Linux distro, based on Raspbian Wheezy [http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/occidentalis-v0-dot-2]; A picture of a working device can be seen here: https://picasaweb.google.com/lh/photo/Cd9MyKwdP7FKVZ821SIfhtMTjNZETYmyPJy0liipFm0?feat=directlink The application that catches the temperature measurement and sends to an url, must log all its behaviors and possible exceptions. Also the application must be configurable with the following parameters: a) therm.file.path = /sys/bus/w1/devices/28-000003973b49/w1_slave [Path of sensor device. DO NOT USE wildcards] b) read.cycle = 60000 [Interval between each measurement in milliseconds] c) therm.url.var1 = v1 [HTTP GET Request parameter which will be used to store the temperature] d) therm.url.var2 = v2 [HTTP GET Request parameter which will be used to store the location of measurement] e) therm.location = room5 [Location of measurement] f) therm.url = http://your-domain/thermd/store.php [URL that will be requested through GET and send data from var1 and var2] CONFIGURATION INSTRUCTIONS: =========================== 1) Set wlan interface to auto connect: nano /etc/network/interfaces allow-hotplug wlan1 auto wlan1 iface wlan1 inet dhcp wpa-ssid "<YOUR-SSID>" wpa-psk "<YOUR-PASSWD>" 2) Test modules: modprobe w1-gpio modprobe w1-therm 3) Check loaded modules: lsmod | grep w1 4) Test temperature sensor: cat /sys/bus/w1/devices/28-*/w1_slave It should give a response like that: b2 01 4b 46 7f ff 0e 10 8c : crc=8c YES b2 01 4b 46 7f ff 0e 10 8c t=27125 5) Get the correct device file name: ls /sys/bus/w1/devices/* The response will be something like: 28-000003973b49 w1_master_attempts w1_master_search driver w1_master_max_slave_count w1_master_slave_count power w1_master_name w1_master_slaves subsystem w1_master_pointer w1_master_timeout uevent w1_master_pullup w1_master_add w1_master_remove Where the device file is 28-000003973b49 At the end, the correct address of sensor will be: /sys/bus/w1/devices/28-000003973b49/w1_slave Test it again: cat /sys/bus/w1/devices/28-000003973b49/w1_slave 6) Add modules for auto loading; echo "w1-gpio" >> /etc/modules echo "w1-therm" >> /etc/modules 5) Create application directories: mkdir /etc/j-rpi-therm-d mkdir /var/log/j-rpi-therm-d 6) Create application log file: touch /var/log/j-rpi-therm-d/j-rpi-therm-d.log 7) Copy application runtime/conf files: Copy conf.properties /etc/j-rpi-therm-d Copy j-rpi-therm-d.jar to /usr/lib Copy j-rpi-therm-d-exec.sh to /usr/bin Copy j-rpi-therm-d-kill.sh to /usr/bin Copy j-rpi-therm-d to /etc/init.d/ 8) Give permissions chmod +x /usr/bin/j-rpi-therm-d-exec.sh chmod +x /usr/bin/j-rpi-therm-d-kill.sh chmod 755 /etc/init.d/j-rpi-therm-d 9) Edit conf.properties (see example bellow): therm.file.path = /sys/bus/w1/devices/28-000003973b49/w1_slave read.cycle = 60000 therm.url.var1 = v1 therm.url.var2 = v2 therm.location = room5 therm.url = http://your-domain/thermd/store.php 10) Add service to be started automatically: update-rc.d j-rpi-therm-d defaults
About
This is a small app for Temperature measurement, written in Java, to run inside Raspberry Pi board
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published