Skip to content

jcocchi/HumiditySensor

Repository files navigation

Humidity and Light Sensor App

Project is built primarily from the Azure IoT Hub Sample for Python and was modified to use the Adafruit ADS1015 ADC (analog to digital converter) with external sensors connected to it instead of the Adafruit BME280 temperature and humidity sensor.

The code assumes you have your own soil humidity sensor and photoresitor light sensor connected to the ADC 0 and 1 channels respectively. A sample setup is shown below.

RaspberryPi Setup

Setup Instructions

Clone this project onto your RaspberryPi and install the Azure IoT SDK for Python using the setup.sh script. From the terminal on your pi run the following commands.

cd ./iot-hub-python-raspberrypi-client-app
sudo chmod u+x setup.sh
sudo ./setup.sh

Note: These setup instructions are taken from the Azure IoT Hub Sample for Python. That repo has more information about potential issues during the installation.

Running Instructions

To run this app you need to provide your Azure IoT Hub device connection string as an environment variable as shown in the terminal command below.

sudo python app.py '<Azure IoT Hub device connection string>'

Note: Your connection string must be in quotes to be recognized properly.

The messages being sent to IoT Hub are formatted as shown below.

    {
        deviceId: "Raspberry Pi - Python",
        light: <sensorValue>,
        hum: <sensorValue>
    }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published