Giter Site home page Giter Site logo

matwerber1 / arduino-heltec-esp32-aws-iot-shock-sensor Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.45 MB

An Arduino project for the Heltec ESP32 deb board that publishes messages to AWS IoT when a shock sensor on the board detects movement.

C 76.67% C++ 23.33%

arduino-heltec-esp32-aws-iot-shock-sensor's Introduction

Arduino + Heltec ESP 32 + AWS IoT - Shock Sensor

This is a simple Arduino project that uses this Heltec ESP 32 board with a built-in OLED display.

I've wired the board with a shock sensor from this kit and an LED with a 100 ohm resistor.

When a shock (movement) is detected, the LED turns on and publishes a message to AWS IoT Core.

Inspired by this blog:

Notes

  1. The Heltec board does require some soldering.

  2. Be sure to install the MQTT client from Arduino Library Manager authored by Joel Gaehwiler. There are a lot of MQTT libraries for Arduino, and not all of them seem to support certificate-based authentication / mTLS needed by AWS IoT Core.

  3. I've since added a DHT11 temp/humidity sensor that publishes these sensor values to AWS IoT shadow every few seconds. This is not yet reflected in the examples below.

  4. Also since added a third LED that is meant to be toggled on/off using the AWS IoT device shadow.

  5. At the moment, this is hacked together from various examples. Excuse the mess in main.c.

Demo

Once the board turns on, it connects to WiFi and AWS IoT, and then waits for either the sensor to activate from motion or an incoming MQTT message from AWS IOT:

If I physically move the board, the sensor activates, triggers a red LED, and publishes an MQTT message to the esp32/shockAlert topic in AWS IoT:

Using the "Test" section of the AWS IoT Console to subscribe to this topic and see the message come in almost immediately:

I can also use the IoT Console to publish messages. In this case, the device subscribes itself to the esp32/alert topic:

And finally, the device is subscribed to the topic and will activate a yellow LED and show the received message on the OLED dispay:

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.