Coder Social home page Coder Social logo

softwareag / cumulocityiot-examples Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 106 KB

Smart Trashcan for Cumulocity IoT as seen at IoT World 2019. This is utilizing a HR-SC-4 ultrasonic sensor on Raspberry Pi.

License: Apache License 2.0

Python 100.00%
cumulocity-iot iot-analytics cumulocity-example raspberry-pi example

cumulocityiot-examples's Introduction

Connected Ultrasonic Smart Trashcan

Smart Trashcan for Cumulocity IoT as seen at IoT World 2019. This is utilizing a HR-SC04 ultrasonic sensor on Raspberry Pi on the Cumulocity IoT Platform

Prerequisites

Pre-requisites:

  • Python (tested on Python 3.6+)
  • 'json', 'requests', 'paho-mqtt' packages installed (e.g. pip install xxx)
  • Cumulocity tenant with Basic Authentication
  • HR-SC04 Ultrasonic Connector hooked to Raspberry Pi using

Hardware

You need the following components:

  • Breadboard
  • HC-SR04 Sensor
  • 1kΩ Resistor
  • 2kΩ Resistor
  • Jumper Wires

The HC-SR04 ultrasonic distance sensor's voltage needs to be regulated from 5V to 3.3V to prevent damage to your hardware. Wire the ultrasonic sensor based on the following circut below: trigger

Script Modifications:

Open the smartTrash.py script, and modify the following:

  • Tenant URL
    This is your own personal C8Y ID

  • clientID
    This could be anything. This is used as a unique identifier for your MQTT messages to be mapped to a device and assist in device creation.

  • tenantID
    Unique system generated ID for your tenant. You can get the tenantID by running the following API Call

	GET /tenant/currentTenant
  • username/password
    Basic Auth is fine for MQTT messages. Although it's not required, you will need to encode it in Base64 if you plan on using the API calls. \

Synatax for Basic Auth in Base64 is as follows:

	Basic tenantID/username:password

Client ID should be unique per device (if you plan on creating multiple devices). This will be used in the MQTT call.

Running

  • Run the python script though your console, ensuring the Python environment and required packages are available in the path.
	>> python ./smartTrash.py

This should automatically trigger device creation in Cumulocity and the distance measurements on the python console should start being posted under the measurements tab under device management application for your specific device. You can then start creating a dashboard and apama analytics rules to further built on this demo.


These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the main project.

cumulocityiot-examples's People

Contributors

adeelchohan avatar techcommunity avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  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.