Close
0%
0%

EspNow Managed flooding mesh network

EspNow managed flooding mesh network with mqtt support.

Similar projects worth following
Managed flooding mesh library for Esp32/Esp2866/Esp01 with mqtt. The library works on EspNow broadcast.
Project includes:
* Mesh usb adapter codes (for esp32/esp2866).
* Mesh gateway codes (Convert messages between mesh network and MQTT broker)
* Slave node example codes (Slave node can read sensors, control switches/lights or something else)

Includes:

  • Mesh usb adapter codes (for esp32/esp2866).
  • Mesh gateway codes (Convert messages between mesh network and MQTT broker)
  • Slave node example codes (Slave node can read sensors, control switches/lights or something else)

Features:

  • Works on EspNow broadcast
  • Nearly instant connection after poweron
  • Maximum number of slave nodes: unlimited
  • Flooding mesh support
  • a message cache. If a received packet is already found in the cache --> it will not be retransmitted or handled again
  • Mesh nodes use MQTT service (subscribe/publish)
  • Master node (USBAdapter=ESP32 or ESP2866) is connected to RaspberryPi's USB port
  • Each Nodes can communicate with each other
  • ESP32, ESP2866, ESP01
  • Ping about 40-60ms
  • ttl support
  • Battery node support
  • AES128
  • Retransmission support
  • Request/Reply support
  • Send and pray support (Send a message to all nodes without reply/ack)
  • Easy to configure (just set channel, secure keys and bsid)
  • Simple mqqt interface. All nodes can use mqtt services via master node (subsribe,unsubscribe,publish,get).
  • MQTT local cache on raspberry
  • Arduino
____________________________________
(                                    )
|                                    |
(            Internet                )
|                                    |
(____________________________________)
                     ^
                     |MQTT
                     |
+--------------------|-------+
| RaspberryPi        V       |
|-------------+   +--+-------|
| MeshGateway |<->| MQTT     |     +-------------------------------------+
|             |   | broker   |     |    ESPNOW mesh network              |
+-----+-------+---+----------+     |                             Node6   |
      ^                            |     Node1        Node3              |
      |    USB(SerialData)         |  +------------+   Node3     Node5   |
      +------------------------------>| USBAdapter |           Node4     |
                                   |  | (Master)   |  NodeX    Node7     |
                                   |  +------------+                     |
                                   +-------------------------------------+

Flooding mesh network

In this network example ttl must be >= 5

               SlaveNode
                   |
                   |         Message from master to BatteryNode
                   |   ---------------------------+
                   | ttl=5               ttl=4    |
SlaveNode-------MasterNode-------------SlaveNode  |
                   |                     |        |
                   |                     |        |
                   |                     |        |
                   |                     |        |
               SlaveNode                 |        |
                   |                     |        |
                   |                     |        |
                   |                     |        +------------------------------------------------>
                   |                     | ttl=3         ttl=2              ttl=1
SlaveNode-------SlaveNode-------------SlaveNode-------SlaveNode-------------SlaveNode---------BatteryNode
   |               |                     |
   |               |                     |
   |               |                     |
   |               |                     |
   +-----------SlaveNode-----------------+

Message relay

The Master sends a request to the farthest node and the farthest node replies. 

alt text

Arduino libraries (dependencies):

Slave Node examples

Early demo video

Mesh usb adapter

Mesh slave node codes

MeshGateway software for RaspberryPi (conversation between mesh and mqtt broker)

Slave node code example

Slave node updates the button's state to topic device1/switch/led/value. The led state can be controlled with topic device1/switch/led/set on/off.

#include <EspNowFloodingMesh.h>
#include<SimpleMqtt.h>

/********NODE SETUP********/
#define ESP_NOW_CHANNEL 1
const char deviceName[] = "device1";
unsigned char secredKey[16] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
unsigned char iv[16] = {0xb2, 0x4b, 0xf2, 0xf7, 0x7a, 0xc5, 0xec, 0x0c, 0x5e, 0x1f, 0x4d, 0xc1, 0xae, 0x46, 0x5e, 0x75};
const int ttl = 3;
const int bsid = 0x112233;
/*****************************/...
Read more »

  • 1 × RaspberryPi
  • 1 × ESP32 (as usb adapter to mesh network)
  • 1 × ESP01 mesh node device
  • 1 × ESP2866 mesh node device

View all instructions

Enjoy this project?

Share

Discussions

Ale o co chodzi wrote 12/17/2023 at 15:54 point

add any messenger

tox, matrix, jabber etc.

  Are you sure? yes | no

vidax wrote 09/13/2019 at 10:05 point

This is great stuff. I started the project and will let you know how it goes. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates