https://github.com/rzr/generic-sensors-lite
Naive implementation of w3c specs for IoT.js
https://github.com/rzr/generic-sensors-lite
i2c iot sensor w3c-specs webthing-iotjs
Last synced: 2 months ago
JSON representation
Naive implementation of w3c specs for IoT.js
- Host: GitHub
- URL: https://github.com/rzr/generic-sensors-lite
- Owner: rzr
- License: apache-2.0
- Created: 2018-03-08T16:25:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-28T18:20:01.000Z (over 1 year ago)
- Last Synced: 2024-10-23T18:00:33.667Z (9 months ago)
- Topics: i2c, iot, sensor, w3c-specs, webthing-iotjs
- Language: JavaScript
- Homepage: https://purl.org/rzr/sensors
- Size: 497 KB
- Stars: 10
- Watchers: 3
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# GENERIC-SENSORS-LITE #
[](https://GitHub.com/rzr/generic-sensors-lite/network/)
[](LICENSE)
[](https://www.npmjs.com/package/generic-sensors-lite)
[](https://travis-ci.org/rzr/generic-sensors-lite)
[](https://david-dm.org/rzr/generic-sensors-lite)
[](https://app.fossa.io/projects/git%2Bgithub.com%2Frzr%2Fgeneric-sensors-lite?ref=badge_shield)
[](https://kiwiirc.com/client/irc.freenode.net/#iot)[](https://npmjs.org/package/generic-sensors-lite)
## INTRODUCTION: ##
Lightweight implementation of W3C spec, targeting constrained devices.
Several JavaScript runtimes are supported (node.js, IoT.js using JerryScript)
[](https://www.slideshare.net/slideshow/embed_code/key/BGdKOn9HHRF4Oa#webthing-iotjs# "WebThingIotJs")
## USAGE: ##
By default simulator are used and generate random values,
but following sensors can be plugged on pins of your favorite single board computer:* BH1650: for measuring illuminance (i2c=0x23)
* BMPx80: for measuring temperature, or any compatible sensor (ie: BMP180, i2c=0x77)
* TCS34725: for measuring colors (i2c=0x29)
* HTU21D: for measuring humidity (i2c=0x40) [Buy](
https://www.amazon.com/HiLetgo%C2%AE-Temperature-Humidity-1-5V-3-6V-Compatible/dp/B00XR7CR1I/ref=rzr-21#
)#### SETUP: ####
Privileged access to hardware resources is also required too (setup or use sudo).
For instance on Raspbian:
```
sudo raspi-config # Enable I2C
ls -l /dev/i2c* || sudo reboot
sudo apt-get install i2c-tools
/usr/sbin/i2cdetect -y 1
#| 0 1 2 3 4 5 6 7 8 9 a b c d e f
#| 00: -- -- -- -- -- -- -- -- -- -- -- -- --
#| 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#| 20: -- -- -- 23 -- -- -- -- -- 29 -- -- -- -- -- --
#| 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#| 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#| 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#| 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#| 70: -- -- -- -- -- -- -- 77
```#### USING NODE.JS: ####
```
git clone --recursive https://github.com/rzr/generic-sensors-lite
cd generic-sensors-litenpm install
npm start
#| node example/index.js
#| (...)
#| {"illuminance": 123.}
#| (...)
#| {"celsius": 42.}
#| (...)
(...)```
#### USING IOT.JS ####
First install IoT.js as explained at:
-
For Debian and derived (Ubuntu, Rasbian, Armbian):
```sh
curl https://raw.githubusercontent.com/rzr/iotjs-express/master/extra/tools/iotjs/setup.sh \
| bash -x -e
```For constrained environments:
```
make start
#| (...)
#| iotjs example/index.js
#| (...)
#| {"illuminance": 123.}
#| (...)
#| {"celsius": 42.}
#| (...)
```Note: It has been verified on GNU/Linux not TizenRT yet (TODO).
#### USING NODE.JS ####
```sh
node lib/ambientlight "{ \"controller\": \"bh1750\"}"
```### DEMO: ###
[](
https://player.vimeo.com/video/279677314#web-of-things-agriculture-20180712rzr.webm
"Video Demo"
)An extra example is provided to show integration in WebThings project.
Sensors are powered by webthing-iotjs and monitored on dashboard as progressive web app (PWA).Usage:
```sh
make runtime=iotjs start
make -C example/webthing runtime=iotjs start
#| (...)
log: Serving: http://localhost:8888/properties
#| (...)curl http://localhost:8888/properties
#| { (...) "illuminance":123., "celsius":42., "color":"#c0a175" (...) }
```Respectively node could be supported too,
just adapt to webthing-node API instead of webthing-iotjs (TODO):```sh
make -C example/webthing runtime=node start
#| (...)
```## RESOURCES: ##
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*## LICENSE: ##
[](https://app.fossa.io/projects/git%2Bgithub.com%2Frzr%2Fgeneric-sensors-lite?ref=badge_large)