Skip to content

Mongoose OS project with ADC and MQTT functionality

License

Notifications You must be signed in to change notification settings

tailucas/adc-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License

About The Project

See my write-up on IoT with Mongoose OS. Here you can find a brief write-up about my projects based on Mongoose OS and my general experience with this IoT platform.

This is a Mongoose OS project containing a configuration template and code written in the so-called minimal JavaScript or mJS.

How it works

This project makes use of a choice between GPIO and analog-to-digital (ADC) inputs as sensory inputs for a security appliance. The project configuration should give some hints as to its use. Configuration key prefixes app.input provide labels that are then used in MQTT messages.

Given the simplicity of the program and the constraints of mJS, you will notice overt duplication of logic for each of the required input channels.

Basic operation

At startup, the inputs are initialized based on the selected choice of ADC mode or GPIO mode. I was experimenting with the difference between the approach of sampling effective electrical resistance versus pulling the GPIO channels. Since the code was written, I decided to leave both in this implementation. Fork what works for you.

Two timers are started. The first timer is responsible for sampling the inputs at a configured rate, applying some trigger de-duplication logic, and then the second is responsible for sending heartbeat messages in the absence of any input deemed in an active state. If a sampled input is outside of the configured threshold, then an MQTT message is sent which contains some summary information about all inputs, including the one that is in an active state.

The use of the onboard LED pin provides useful feedback for when a given input has been deemed triggered.

(back to top)

Built With

Technologies that help make this project useful:

Espressif Mongoose OS MQTT

(back to top)

Getting Started

Here is some detail about the intended use of this project.

Prerequisites

Your development environment needs to have the mos tool available to build firmware binaries and for first-time configuration of the device. Mongoose OS has a good getting started guide with installation instructions.

(back to top)

Usage

The Mongoose OS documentation provides a detailed but concise instruction on how to use the mos tool to build the binaries that can then either be flashed directly to a USB-connected IoT device or that can be uploaded to the mDash site and delivered as an OTA update.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)

Hits

About

Mongoose OS project with ADC and MQTT functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published