Coder Social home page Coder Social logo

innovation-monitor-mobile's Introduction

InnovationMonitor aka BeerMonitor

This project combines IoT, Serverless, and Mobile into a nice packaged solution that you can leverage to monitor temperature, pressure, images, and video of an industrial process โ€“ in this case, beer.

Consists of the following:

Here's a look at the app:

And the high-level architecture diagram:

App Features

  • Monitor internal (beer) and external (ambient) temperature
  • Monitor ambient humidity and pressure
  • Use AI / Custom Vision Service to determine if your beer is fermenting
  • Take a picture of your fermentation
  • Take a video of your fermentation

This guide will break each repo down individually and guide you to the various resources needed to build the project. Let's get started!

The IoT Project

This is broken down into 4 parts:

  • Getting set up and configuring the BME280
  • Setting up the camera
  • Setting up the additional temperature sensor
  • Building the relay and light

IoT Part 1: Setting up the BME280

This project uses the code in this repo to get set up and connect the BME280 (temp, pressure, humidity) sensor. I highly recommend you visit that repo for the latest maintained version of the sample. I've included the instructions at the time of writing for convenience.

This repo contains the source code to help you get started with Azure IoT using the Microsoft IoT Pack for Raspberry Pi 3 Starter Kit. You will find the full tutorial on Docs.microsoft.com.

This repo contains a python application that runs on Raspberry Pi 3 with a BME280 temperature&humidity sensor, and then sends these data to your IoT hub. At the same time, this application receives Cloud-to-Device messages from your IoT hub, and takes actions according to the C2D command.

Step 1: Set up your Pi

Enable SSH on your Pi

Follow this page to enable SSH on your Pi.

Enable I2C on your Pi

Follow this page to enable I2C on your Pi

Step 2: Connect your sensor with your Pi

Connect with a physical BME280 sensor and LED

You can follow the image to connect your BME280 and an LED with your Raspberry Pi 3.

DON'T HAVE A PHYSICAL BME280?

You can use the application to simulate temperature&humidity data and send to your IoT hub.

  1. Open the config.py file.
  2. Change the SIMULATED_DATA value from False to True.

Step 3: Download and setup referenced modules

  1. Clone the client application to local:

    sudo apt-get install git-core
    
    git clone https://github.com/Azure-Samples/iot-hub-python-raspberrypi-client-app.git
    
    
  2. Because the Azure IoT SDKs for Python are wrappers on top of the [SDKs for C][azure-iot-sdk-c], you will need to compile the C libraries if you want or need to generate the Python libraries from source code.

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

    In the above script, we run ./setup.sh without parameter, so the shell will automatically detect and use the version of python installed (Search sequence 2.7->3.4->3.5). Alternatively, you can use a parameter to specify the python version which you want to use like this: sudo ./setup.sh [--python-version|-p] [2.7|3.4|3.5]

    Known build issues:

    1.) On building the Python client library (iothub_client.so) on Linux devices that have less than 1GB RAM, you may see build getting stuck at 98% while building iothub_client_python.cpp as shown below

    [ 98%] Building CXX object python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o

    If you run into this issue check the memory consumption of the device using free -m command in another terminal window during that time. If you are running out of memory while compiling iothub_client_python.cpp file you may have to temporarily increase the swap space to get more available memory to successfully build the Python client side device SDK library.

Step 4: Run your client application

Run the client application, you'll need to provide your Azure IoT hub device connection string. Note your connection string should be quoted in the command:

python app.py '<your Azure IoT hub device connection string>'

If you use the python 3, then you can use the command below:

python3 app.py '<your Azure IoT hub device connection string>'

If the application works normally then you will see the screen like this:

IoT Part 2: Set up the camera and upload to Azure

IoT Part 3: Set up the other temperature sensor

  • Follow this tutorial. Note that I did not use the Pi Cobbler jumper cable.

IoT Part 4: Build the relay and wire it up

The Functions Project

Up next, we'll get some Azure Functions running to your IoT Hub.

The project repo is located here.

Each of these functions is responsible for a different aspect of functionality within the mobile app.

  • GetInternalTemp
  • GetTempHumidity
  • TakeInternalTemp
  • TakePicture
  • TakeTempHumidity
  • Take Video
  • TempHumidityEventTrigger

The Mobile Project

Finally, we get to see all of our hard work in action.

Clone the innovation-monitor-mobile repo and enter your API keys into the Constants/Constants.cs folder and also search for any TODO: items and make sure those are filled out.

public class Constants
    {
        public const string StorageConnection = "Link to your storage connection";

        public const string TakePictureURL = "Link to your TakePicture Function URL";
        public const string TakeVideoURL = "Link to your TakeVideo Function URL";
        public const string TakeTempHumidityURL = "Link to your TakeTempHumidity URL";
        public const string GetTempHumidityURL = "Link to your GetTempHumidity URL";

        public const string GetTempHumidityAPI = "/GetTempHumidity?code=your-key-here";
        public const string TakeTempHumidityAPI = "/TakeTempHumidity?code=your-key-here";
    }

Deploy the app to a device or simulator and you should be good to go!

innovation-monitor-mobile's People

Contributors

ianleatherbury avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.