diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/hardware/emonTH_V2_0_1_gerbers.zip b/hardware/emonTH_V2_0_1_gerbers.zip new file mode 100644 index 0000000..19e65f8 Binary files /dev/null and b/hardware/emonTH_V2_0_1_gerbers.zip differ diff --git a/sensor_test/readme.md b/sensor_test/readme.md new file mode 100644 index 0000000..e2c2851 --- /dev/null +++ b/sensor_test/readme.md @@ -0,0 +1,29 @@ +# Temperature & Humidity Sensor Evaluation and Testing + + + +| Metric | [HTU21D](https://octopart.com/htu21d-measurement+specialties-30374934) |[Si72021](https://octopart.com/si7021-a20-im-silicon+labs-52675246)| DHT22 | DHT22 vs HTU21D Difference| [BME280](https://octopart.com/bme280-bosch-52931981) | +| ------------- | ------------- |------------- | ------------- | ------------- | ------------- | +| Cost in 1k off | £1.42 (July16) |£2.15| £4.57 (July16) | 3.2 times cheaper (£3.15 less!) | £3.07 | +| Vcc | 2.1v - 3.6V | 1.9V - 3.6V | 3.3-6V | | 1.71 V - 3.6V | +| Humidity accuracy | ±2% RH | ±2% RH | ±2%RH | n/a | ±3%RH | +| Humidity Range | 0-100% RH | 0-100% RH | 0-100% RH | n/a| 0-100% RH | +| Temperature accuracy | ±0.3°C | ±0.4°C| ±0.5°C | 40% more accurate | ±0.5 - ±1.0 | +| Temperature Range | -40°C +125°C | -40°C +125°C | -40°C +80°C | 56% more accurate | -40°C +80°C | +| Sleep Current | 0.02uA | 0.06uA | 15uA | 750 times less power | 0.1uA - 0.3uA | +| Measurement Current | 0.045mA | 0.09 mA | 0.5mA | 11 times less power | 0.714mA - 0.350mA | +| Measurement time | 0.01s - 0.0026s | 0.01s - 0.0026s | 2s | 200 times faster | 0.013s | +| Energy consumed per sample | 0.00045mW || 1mW | 2222 times less power | | +| Time sampling per day* | 14.4s || 2800s | | | +| Time sleeping per day* | 86386s || 83600s | | | +| Energy consumed per day* | 2.36mW [1] || 2836mW [2] | 1201 times less energy per day! | | + + +## Energy consumed per day* + +- **HTU21D:** (14.4s * 0.045mA) + (86386 * 0.00002mA) = 0.63mW + 1.73mW = **2.36mW** [1] +- **DHT22:** (2800s * 0.55mA) + (86386 * 0.015mA) = 1540mW + 1295.8mW = **2836mW** [2] + +\*Assuming 1 sample per min and sleeping in between samples, 1440 min per day = 86400s per day + +[Adafruit HTU21D Library](https://github.com/adafruit/Adafruit_HTU21DF_Library) diff --git a/sensor_test/si7021/.gitignore b/sensor_test/si7021/.gitignore new file mode 100644 index 0000000..e90612e --- /dev/null +++ b/sensor_test/si7021/.gitignore @@ -0,0 +1 @@ +.pioenvs \ No newline at end of file diff --git a/sensor_test/si7021/.travis.yml b/sensor_test/si7021/.travis.yml new file mode 100644 index 0000000..9171b89 --- /dev/null +++ b/sensor_test/si7021/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/stable/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/stable/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/stable/userguide/cmd_ci.html > +# +# +# Please choice one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N diff --git a/sensor_test/si7021/lib/readme.txt b/sensor_test/si7021/lib/readme.txt new file mode 100644 index 0000000..0d0e7be --- /dev/null +++ b/sensor_test/si7021/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/stable/projectconf.html#lib-install + diff --git a/sensor_test/si7021/platformio.ini b/sensor_test/si7021/platformio.ini new file mode 100644 index 0000000..74794c8 --- /dev/null +++ b/sensor_test/si7021/platformio.ini @@ -0,0 +1,13 @@ +# +# PlatformIO Project Configuration File +# +# Please make sure to read documentation with examples first +# http://docs.platformio.org/en/stable/projectconf.html +# +[env:uno] +platform = atmelavr +framework = arduino +board = uno +lib_install=536 + +# lib 536 : https://github.com/LowPowerLab/SI7021 diff --git a/sensor_test/si7021/src/src.ino b/sensor_test/si7021/src/src.ino new file mode 100644 index 0000000..571446c --- /dev/null +++ b/sensor_test/si7021/src/src.ino @@ -0,0 +1,42 @@ +#include +#include + +SI7021 sensor; + +void setup() { + sensor.begin(); + Serial.begin(9600); + Serial.println("Start Si7201 test"); + // this driver should work for SI7020 and SI7021, this returns 20 or 21 + int deviceid = sensor.getDeviceId(); + Serial.print("ID: "); Serial.println(deviceid); +} + +void loop() { + + // temperature is an integer in hundredths + float temperature = sensor.getCelsiusHundredths(); + temperature = temperature / 100.0; + Serial.print("temp: "); Serial.println(temperature); + + + // humidity is an integer representing percent + float humidity = sensor.getHumidityPercent(); + Serial.print("humidity %: "); Serial.println(humidity); + + // enable internal heater for testing + sensor.setHeater(true); + delay(5000); + sensor.setHeater(false); + + // see if heater changed temperature + temperature = sensor.getCelsiusHundredths(); + temperature = temperature / 100.0; + Serial.print("temp after heating: "); Serial.println(temperature); + + // get humidity and temperature in one shot, saves power because sensor takes temperature when doing humidity anyway + si7021_env data = sensor.getHumidityAndTemperature(); + Serial.print("temp fast: "); Serial.println(data.celsiusHundredths/100.0); + Serial.print("humidity fast: "); Serial.println(data.humidityBasisPoints/100.0); + delay(5000); +} diff --git a/src/src.ino b/src/src.ino index 86b5172..6b73589 100644 --- a/src/src.ino +++ b/src/src.ino @@ -1,10 +1,10 @@ /* - emonTH Low Power DHT22 Humidity & Temperature, DS18B20 Temperature & Pulse counting Node Example + emonTH Low Power SI7021 / DHT22 Humidity & Temperature, DS18B20 Temperature & Pulse counting Node Example - Checkes at startup for presence of a DS18B20 temp sensor , DHT22 (temp + humidity) or both - If it finds both sensors the temperature value will be taken from the DS18B20 (external) and DHT22 (internal) and humidity from DHT22 + Checkes at startup for presence of a DS18B20 temp sensor , DHT22 or SI7021 (temp + humidity) + If it finds both DHT22 or SI7021 & DS18B20 sensors the temperature value will be taken from the DS18B20 (external) and DHT22 / SI7021 (internal) and humidity from DHT22 If it finds only DS18B20 then no humidity value will be reported - If it finds only a DHT22 then both temperature and humidity values will be obtained from this sesor + If it finds only a DHT22 / SI7021 then both temperature and humidity values will be obtained from this sensor Technical hardware documentation wiki: http://wiki.openenergymonitor.org/index.php?title=EmonTH @@ -16,11 +16,10 @@ THIS SKETCH REQUIRES: - Libraries in the standard arduino libraries folder: - - JeeLib https://github.com/jcw/jeelib - - DHT22 Sensor Library https://github.com/adafruit/DHT-sensor-library - be sure to rename the sketch folder to remove the '-' - - OneWire library http://www.pjrc.com/teensy/td_libs_OneWire.html - - DallasTemperature http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_LATEST.zip + Libraries required: + - see platformio.ini + - recommend compiling with platformIO for auto library download + - Arduno IDE can be used to compile but libs will need to be manually downloaded Recommended node ID allocation ----------------------------------------------------------------------------------------------------------- @@ -34,16 +33,16 @@ 31 - Special allocation in JeeLib RFM12 driver - Node31 can communicate with nodes on any network group ------------------------------------------------------------------------------------------------------------- Change log: - v2.1 - Branched from emonTH_DHT22_DS18B20 example, first version of pulse counting version - v2.2 - 60s RF transmit period now uses timer1, pulse events are decoupled from RF transmit - v2.3 - rebuilt based on low power pulse counting code by Eric Amann: http://openenergymonitor.org/emon/node/10834 - v2.4 - 5 min default transmisson time = 300 ms - v2.3 - (12/10/14) don't flash LED on RF transmission to save power - V2.4 - (15/10/15) activate pulse count pin input pullup to stop spurious pulses when no sensor connected - V2.5 - (23/10/15) default nodeID 23 to enable new emonHub.conf decoder for pulseCount packet structure - V2.6 - (24/10/15) Tweek RF transmission timmng to help reduce RF packet loss - V2.7 - (15/09/16) Serial print serial pairs for emonesp compatiable e.g. temp:210,humidity:56 - V3.0 - (15/09/16) Add support for SI7021 sensor (emonTH V2.0 hardware) + V3.0 - (15/09/16) Add support for SI7021 sensor (emonTH V2.0 hardware) + V2.7 - (15/09/16) Serial print serial pairs for emonesp compatiable e.g. temp:210,humidity:56 + V2.6 - (24/10/15) Tweek RF transmission timmng to help reduce RF packet loss + V2.5 - (23/10/15) default nodeID 23 to enable new emonHub.conf decoder for pulseCount packet structure + V2.4 - (15/10/15) activate pulse count pin input pullup to stop spurious pulses when no sensor connected + v2.3.1 - (12/10/14) don't flash LED on RF transmission to save power + v2.3 - rebuilt based on low power pulse counting code by Eric Amann: http://openenergymonitor.org/emon/node/10834 + v2.2 - 60s RF transmit period now uses timer1, pulse events are decoupled from RF transmit + v2.4 - 5 min default transmisson time = 300 ms + v2.1 - Branched from emonTH_DHT22_DS18B20 example, first version of pulse counting version ------------------------------------------------------------------------------------------------------------- emonhub.conf node decoder: See: https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md @@ -58,6 +57,7 @@ scales = 0.1,0.1,0.1,0.1,1 units = C,C,%,V,p */ +// ------------------------------------------------------------------------------------------------------------- const byte version = 30; // firmware version divided by 10 e,g 16 = V1.6 // These variables control the transmit timing of the emonTH