Working with BME680 Sensors

Getting Started with BME680 Sensors

image

Hardware requirements:

  • Jetson Nano: 2GB Model ($59)
  • A 5V 4Amp charger
  • 128GB SD card
  • BME680 sensors

Software requirements:

  • Jetson SD card image from NVIDIA
  • Etcher software installed on your system

You can run RedisTimeSeries directly over an IoT Edge device. Follow the below steps to build RedisTimeSeries Docker Image over Jetson Nano:

Verifying Docker version

SSH to 70.167.220.160 and install Docker

pico@pico1:~$ docker version
Client: Docker Engine - Community
 Version:           20.10.3
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        48d30b5
 Built:             Fri Jan 29 14:33:34 2021
 OS/Arch:           linux/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:43:42 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 nvidia:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Verifying if Sensor is detected

i2cdetect -r -y 1
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- --

Building Docker Image for RedisTimeSeries for Jetson Nano

git clone --recursive https://github.com/RedisTimeSeries/RedisTimeSeries.git
cd RedisTimeSeries.git
docker build -t ajeetraina/redistimeseries-jetson . -f Dockerfile.jetson.edge

Running RedisTimeSeries

docker run -dit -p 6379:6379 ajeetraina/redistimeseries-jetson

Verifying if RedisTimeSeries Module is loaded

redis-cli
127.0.0.1:6379> info modules
# Modules
module:name=timeseries,ver=999999,api=1,filters=0,usedby=[],using=[],options=[]
127.0.0.1:6379>

Clone the repository

$ git clone https://github.com/redis-developer/redis-datasets
$ cd redis-datasets/redistimeseries/realtime-sensor-jetson

Running Sensorload Script

sudo python3 sensorloader2.py --host localhost --port 6379

Running Grafana on Jetson Nano

docker run -d -e "GF_INSTALL_PLUGINS=redis-app" -p 3000:3000 grafana/grafana

There you go..

Point your browser to https://<IP_ADDRESS>:3000. Use “admin” as username and password to log in to the Grafana dashboard.

image

Click the Data Sources option on the left side of the Grafana dashboard to add a data source.

image

Under the Add data source option, search for Redis and the Redis data source will appear as shown below:

image image

Supply the name, Redis Enterprise Cloud database endpoint, and password, then click Save & Test.

Click Dashboards to import Redis and Redis Streaming. Click Import for both these options.

image

Click on Redis to see a fancy Grafana dashboard that shows the Redis database information:

image image

Finally, let’s create a sensor dashboard that shows temperature, pressure, and humidity. To start with temperature, first click on + on the left navigation window. Under Create option, Select Dashboard and click on the Add new panel button.

image

A new window will open showing the Query section. Select SensorT from the drop-down menu, choose RedisTimeSeries as type, TS.GET as command and ts”temperature as key.

image

Choose TS.GET as a command.

image

Type ts”temperature as the key.

image

Click Run followed by Save, as shown below:

image

Now you can save the dashboard by your preferred name:

image

Click Save. This will open up a sensor dashboard. You can click on Panel Title and select Edit.

image

Type Temperature and choose Gauge under Visualization.

image

Click Apply and you should be able to see the temperature dashboard as shown here:

image

Follow the same process for pressure (ts:pressure) and humidity (ts:humidity), and add them to the dashboard. You should be able to see the complete dashboard readings for temperature, humidity, and pressure. Looks amazing. Isn’t it?

image


Last modified September 12, 2021 : Update _index.md (3044654)