Skip to content

This is a reworked version of the heating-tempflow project I created earlier. In this version, I'm using C# modules that are hosted in Azure IoT Edge on a Raspberry Pi to read out temperature sensors that are connected to a Raspberry Pi. The measurements will be visualized by an Azure TimeSeries Insights resource.

Notifications You must be signed in to change notification settings

fgheysels/heating-tempflow-iotedge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heating Tempflow on Azure IoT Edge

Introduction

This project is a reworked version of 'Heating tempflow'. In the original project, I've used a Python script to read out temperature sensors and posted the values to an InfluxDB instance that was running on the Raspberry Pi itself, the values where visualized using Grafana.

In this version of the project, I'm making use of Azure IoT Edge. A custom module (container) is hosted in Azure IoT Edge that reads the temperature from the HS18B2 temperature sensors. The data is transmitted to an Azure IoT Hub instance and will be visualized by an Azure Time Series Insights resource.

Documentation

This section contains more information on the steps that I've taken to get this working

Key take-aways

Reading the temperature from the sensor devices

The DS18B2 temperature-sensors are connected to the Raspberry Pi and the measured temperature can be retrieved by reading a file that is present in the /sys/devices directory.

Since the IoT Edge module that is responsible for reading out those sensors is running in a container, it has offcourse no direct access to those resources on the host. To enable the IoT Edge module to access that directory, a bind mount has been specified so that the IoT Edge module can read files from the /sys/devices directory. The bind has been created by specifying it in the createOptions section of that module:

"DS18B2TemperatureReader": {
  "version": "1.1",
  "type": "docker",
  "status": "running",
  "restartPolicy": "always",
  "settings": {
  "image": "${MODULES.DS18B2TemperatureReader}",
  "createOptions": {
    "HostConfig":{
      "Mounts": [
                  {
                    "Type": "bind",
                    "Target": "/w1devices",
                    "Source": "/sys/devices/w1_bus_master1"
                  }
                ]
    }
  }
}

Now, it is possible to access files that are present on the host in the /sys/devices directory by referring to them from the IoT Edge module via the /w1devices path, for instance:

var sensorContent = File.ReadAllText("/w1devices/28-/w1_slave");

where `` is the sensor-id.

Image format for Raspberry Pi

Since the Raspberry Pi 3 that I'm using is running a 32 bit version of Raspbian, the Docker images of the IoT Edge modules must be 32 bit ARM containers.

About

This is a reworked version of the heating-tempflow project I created earlier. In this version, I'm using C# modules that are hosted in Azure IoT Edge on a Raspberry Pi to read out temperature sensors that are connected to a Raspberry Pi. The measurements will be visualized by an Azure TimeSeries Insights resource.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages