Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
169 lines (134 sloc) 4.96 KB
Øyvind Aardal
Hardware [SENS]
Sensor-device with "light-to-voltage" converter used to count pulses on a
energy meter similar to this:
The TSL257 is fastened over the impulse diode with "McGyver tape" to avoid
stray light and to ensure secure fastening. The Arduino and Xbee is located
outside the "fusebox" and a regular 4-wire telephone cable is used to connect
the TSL257 to the Arduino (3 wires).
Arduino Uno R3
Wireless Proto Shield
DFrobots SD module
Xbee 1mw 802.15.4
### Wiring of sensor module [SENS]
TSL257 OUT to Arduino pin 3
SD module as described in DFR0071_Wiring.JPG
Xbee mounted on Wireless Proto Shield
Hardware [ENGW]
Arduino Uno R3
Wireless Proto Shield
Xbee 1mw 802.15.4
Arduino Ethernet Shield
### Wiring of xbee to ethernet gw [ENGW]
Ethernet Shield and Xbee Shield stacked
Hardware [ENVM]
Arduino Uno R3
Arduino Wireless Proto Shield
Xbee 1mw 802.15.4
Sparkfun TMP102 breakout
Any old LDR (approx 30k) and a 1k resistor
### Wiring of Environmental Monitor
(Based on
Connected with CAT5 cable as follows:
A5->Brown->SCL, GND->Brown/White->GND
A4->Blue->SDA, 5V->Blue/White->V+
GND->Orange->ADD0, (not connected)->Orange/White->ALT
LDR (not polarized)
Between Resistor and Green/White->A3
Hardware [LAMP]
Any LAMP server - could be a Synology NAS (my setup) or e.g. a Amazon EC2
server (small ... free for a year).
Data Dictionary for MySQL database "power" on localhost
You must have db config file "dbconfig.php" in same dir as sql*.php:
$user="insert database username";
$password="insert password for user";
$database="database name";
$table="meter table name";
Table comments: power meter loggdata
Column Type Null Default
----------- ----------- ------- -----------------
timestamp timestamp No CURRENT_TIMESTAMP
count int(11) No
kwhh float No
Table comments: lysmåling ute
Column Type Null Default
----------- ----------- ------- -----------------
timestamp timestamp No CURRENT_TIMESTAMP
value float No
Table comments: utetemperatur
Column Type Null Default
----------- ----------- ------- -----------------
timestamp timestamp No CURRENT_TIMESTAMP
value float No
Revision History
20.03.2012 Added database description
Modified environmental sensor to save data to separate tables to make life
easyer for my Synology 410 - it was peaking CPU due to inefficient queries
07.03.2012 Fixed minor bugs and added support for "temp" table on MySQL server
Also modified the gw to support "wellformed" GETs that will be
sent directly to the LAMP server.
Fixed graphs so that they grow correctly if missing datapoints.
Added environmental monitor that logs light and temperature
29.02.2012 Added MySQL support. web/sql*.php is called from index.php
Added Xbee to Ethernet GW
05.02.2012 Revised web pages to dynamically update without reload - still rough
but closer...
01.02.2012 Added web pages in php using Google Chart. Inspired by code created
01.02.2012 Initial version - experimental level - all input highly appreciated
* Revise SENS to send "correct" syntax to the GW. Now the transform to save
data to the MySQL db is done in the GW and it should be transparent.
* Revise SENS to employ /utc/ time broadcast by ENGW and timestamp reports
* Really need to add DHCP and DNS support for the GW to avoid hardcoded IPs
* lots more...
Known issues
* When computer sleeps and resumes, page should reload to catch up the line-
graph - now it just continues multiple reads is hogging memory and cpu on
my LAMP server (Synology 411j) - should only parse new stuff since last
load and update graphs
* If there's not enough data last 24 hours, the graph doesn't grow. The same
number of data points is kept, should grow until 24 hours total is reached.
(Resolved 07.03.2012)