Skip to main content

Sense Hat WebThing

Project description

SENSE-HAT WEBTHING

GitHub forks PyPi Legal Mastodon Follow

ABOUT

Addon adapter for Mozilla IoT Gateway using python module to handle I2C sensors and GPIOs of Raspberry Pi's extension board "SenseHat".

sense-hat-webthing

USAGE

PREREQUISITES

Install mozilla WebThing gateway on RaspberryPI (It was made for https://github.com/mozilla-iot/gateway/releases/download/0.12.0/gateway-0.12.0.img.zip )

INSTALL

From "Settings" add-on menu:

  • Add "and enable add-on
  • Then add "SenseHat" from the things dashboard.

CALIBRATE

For using Inertial measurement unit (IMU sensors), calibration will help to get more accurate measurements.

sudo apt-get install librtimulib-utils

cd ~/.config/sense_hat/
mv -f RTIMULib.ini RTIMULib.ini.orig
RTIMULibCal

#| RTIMULibCal - using RTIMULib.ini
#| Settings file not found. Using defaults and creating settings file
#| Detected LSM9DS1 at standard/standard address
#| Using fusion algorithm RTQF
#| min/max compass calibration not in use
#| Ellipsoid compass calibration not in use
#| Accel calibration not in use
#| LSM9DS1 init complete
#| Options are: 
#| m - calibrate magnetometer with min/max
#| e - calibrate magnetometer with ellipsoid (do min/max first)
#| a - calibrate accelerometers
#| (...)

grep '=' RTIMULib.ini

If done correctly north should be indicated by edge where power LED is located the compass value is actually the "yaw" value, while "pitch" is around this same edge. Remaining "roll" value can be changed by rotating on longest middle axis of board.

AUTOMATE

Once added in gateway, it can be used along the rule engine:

sense-hat-webthing

DEVELOP

# From Settings / Developer / Enable SSH
# https://sensehat.mozilla-iot.org/settings/developer
ssh pi@gateway.local # password=raspberry
sudo systemctl stop mozilla-iot-gateway
rm -rf ~/.mozilla-iot/addons/sense-hat-*
cd ~/.mozilla-iot/addons/
git clone https://github.com/rzr/sense-hat-webthing sense-hat-adapter
make -C sense-hat-adapter help prep start # unprep # to restore
sudo systemctl restart mozilla-iot-gateway
sudo journalctl -f -xu mozilla-iot-gateway.service

From "/things" webpage "SenseHat" can be added (+, Add, Done)

Note that instead of restarting gateway, from Web UI, any addon can disabled and enabled again.

EXTRA: EXAMPLES

More examples can be also used as standone webthing server:

cd example
# If on debian, it will be faster:
sudo apt-get install python3-sense-hat 
pip3 install webthing 
# Or if not on debian:
# pip3 install -r requirements.txt 
./sense-hat-single-thing.py

Then add thing using "URL" adapter it should be discovered as (http://localhost:8888)

Same procedure for other exampl, like multiple things which is handling orientation sensor.

MORE

For reference the following items are supported:

Thanks to Geof Cohler (@gcohler) for support.

RESOURCES

sense-hat-webthing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sense-hat-webthing-0.0.7.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

sense_hat_webthing-0.0.7-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file sense-hat-webthing-0.0.7.tar.gz.

File metadata

  • Download URL: sense-hat-webthing-0.0.7.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for sense-hat-webthing-0.0.7.tar.gz
Algorithm Hash digest
SHA256 62bd28b2bbb2d44f5186a955782d02d20510dafe8bb5c95f5cc9957ca9546c04
MD5 32f37abc608ebd713e06ad25d5ade7d3
BLAKE2b-256 ebff87cbe08a284cbfdeb19808b3a54a0daf68c32646ff01258f956d2e4371b1

See more details on using hashes here.

File details

Details for the file sense_hat_webthing-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: sense_hat_webthing-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for sense_hat_webthing-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d154bff19702a1e546dea32d10711c6118c360e37c83e21558d6411959842662
MD5 63e9a2c69f98accea8c007cc1e9d8ac0
BLAKE2b-256 7bf8613364615dd6726e6637d48080b10672d977858a40983999898d3807458c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page