Giter Site home page Giter Site logo

srmurali002 / esp-sensor-mesh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jtwaleson/esp-sensor-mesh

0.0 2.0 0.0 368 KB

An ESP8266 based simplified mesh network for sending sensor data out to the world

License: MIT License

Arduino 100.00%

esp-sensor-mesh's Introduction

esp-sensor-mesh

Warning: This is a hobby project and a work in progress.

Software to build a sensor network consisting of just ESP8266 modules (these are 3$ wifi microcontrollers) and one or more wifi base stations at the edges. The ESP modules take readings from attached sensors, and forward the data to modules that are closer to the edge of the network. The modules at the edges forward the sensor readings to a server (for example an mqtt broker). This should allow you to build robust sensor networks stretching multiple kilometers at little cost.

Typical MESH networks are great on paper but difficult and error prone in practice. Why is this project different? By limiting the possibilities. Nodes can not talk to other nodes. Messaging is one directional. No addressing. The only supported operation is data flowing up towards the edge of the network, into the Cloud or whatever you have listening at the edge, as an exception on this, OTA is supported.

Design goals:

  • self-reliant: power (solar?) + ESP8266 is all you need, no existing infrastructure
  • one directional: sensor data should flow out of the network, no commands coming into the network (unless I find a way to do this, udp broadcast maybe?)
  • OTA: despite the one directionality principle above, OTA should be possible
  • dynamic: adding a module, an extra base station or removing a module will automatically trigger a network reconfiguration
  • semi-reliable: during short periods of network reconfiguration, messages should not be lost (message delivery to the next hop is guaranteed)
  • short messages: sensor readings should be less than 1000 bytes per message, this is not meant for sending photo or video as everything needs to be buffered in memory
  • asynchronous: modules don't have a live tcp connection with the internet, they can just deliver data to the next hop
  • scalable: when the network is saturated with messages, add more WiFi base stations at other corners of the network to scale up

Why:

  • fun

How:

  • modules are both access point and client ("station" in wifi terms) simultaneously
  • each module advertises itself as ESPMESH-[Distance-to-edge]-[Firmware version]
  • sensor traffic only flows upstream (towards the WiFi base stations)
  • modules with a lower firmware can download the firmware from modules advertising a higher firmware

My setup:

Disclaimer:

  • this is my first ESP project
  • this project is not affiliated with any ESP related company maker in any way (except that I bought the modules from one of them)

Help needed

I need help with getting OTA working, especially reading your own firmware and serving it as an HTTP response.

Technical details

Data flowing out of the network

Simplified view, the SSIDs only have the distance to the base network, not the firmware version. The arrows show how sensor data is flowing out of the network:

sensor data out of network

OTA (Over the Air updates)

If you are serious about IOT you know that automatic OTA updates are a must, both to shorten development times and for flexibility in production deployments.

OTA updates flow through the network like a virus. Simply update one module which will advertise the new firmware in the SSID (firmwares are numbered sequentially), in this case the firmware of the module in the bottom is bumped from v0 to v1:

upgrade one firmware manually

All nearby modules with a lower firmware number will connect to the network of a higher firmware, download its firmware and apply it to itself:

nearby nodes will connect and download it's firmware

Now the next modules will start the update process:

firmware is spread to 3 nodes now, the rest will follow

In the diagram above the upper nodes won't be reached but that's a detail.

Basic algorithm

D = distance from the edge N = firmware version

If board sees a (hardcoded) base station (such as your home wifi router), it will connect to the base station and advertise itself as ESPMESH-0-[N].

If no base station seen, it will connect to the ESPMESH node with the lowest advertised distance to the edge (D). It will advertise itself as ESPMESH-[D + 1]-[N].

Each module will set up an internal network 192.168.D.1/24. An HTTP server listens on traffic from connected clients (which have a higher D value) and forwards it to nodes with a lower D value, or if at the edge, to a (hardcoded in your firmware) url on your home network or on the Internet.

esp-sensor-mesh's People

Contributors

jtwaleson avatar

Watchers

James Cloos avatar Muralidhar Reddy Challa 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.