T ThinkEdge Learn

Mesh Networking: How Nodes Relay Data for Each Other

In a mesh, no node is the centre. Every node can forward packets for the others, so coverage grows one hop at a time instead of one router at a time.

mesh network mesh networking esp32 mesh ble mesh
Maker Hardware and IoT · Explains the trade-off between coverage and latency honestly

How a mesh actually forms

When a node switches on, it listens. Neighbours notice it, and after a short exchange each one builds a picture of who is within range and how strong that link is. That picture is the mesh. There is usually no central controller deciding the topology, and there may not even be a fixed list of routes, because the network is allowed to change as nodes move or die.

The forwarding method that Bluetooth Mesh uses is managed flooding. A node that needs to send a message broadcasts it with a hop limit, usually 3 to 127, and a sequence number. Any node that receives it checks two things: has it seen this sequence number before, and is the hop count still above zero. If both are true it rebroadcasts it, which means the message spreads outwards in every direction until it reaches the edge of the network. The important consequence is that reliability and cost are traded against each other. A flooded message is sent many times, so delivery is very likely, but every node in the path spends airtime retransmitting it, and the latency grows with the number of hops. ESP-MESH takes a different approach on Wi-Fi, building a tree of parent and child nodes, which is more efficient in a fixed building and less forgiving of nodes that move.

What a mesh costs you

Coverage is the obvious win. A node that cannot reach the gateway can still reach a node that can, so a building with five nodes can cover areas that two nodes cannot. This is why mesh is the standard answer for a sensor deployment across a large site.

Latency and power are the costs. Every relay is also a receiver, and a receiver is the most power-hungry state a radio has. A mains-powered relay node is easy. A battery node acting as a relay will not last. This is why most real deployments put the relays on the mains and keep the battery nodes as leaves, and why the profile of each node matters more in a mesh than in a star. There is a failure mode worth naming, because it surprises people: in a flooding mesh, a node can be perfectly healthy and still useless if every route to the gateway happens to pass through one node that is offline. The fix is redundancy. Overlap coverage so no single node is a bridge, and check that the network still reaches the gateway after you pull any one node out of it.

Step by step

  1. Build a two-node link first

    Get one message crossing between two boards with no router involved. This is the whole idea in its simplest form, and it should work before you add complexity.

  2. Add a third node and watch the hop count

    Print the hop count on each message as the topology changes. Seeing it rise and fall as nodes move is what makes the concept real.

  3. Measure the range of one hop

    Walk two nodes apart until messages stop arriving, and note the distance in different rooms. Indoors, expect tens of metres rather than hundreds.

  4. Simulate a node failure

    Switch off a middle node and watch the network route around it, or fail to. This is the redundancy conversation, and it is the one that matters for reliability.

  5. Power a relay node from the mains

    Compare the current draw of a relay node on battery and on USB power. The difference justifies the whole architecture in one measurement.

  6. Scale to a small deployment

    Add nodes around a room, log the hop count and the message loss over a day, and plot it. Real mesh data is never as tidy as the diagram.

What you'll need

ItemQtyWhy
ESP32 DevKit boards4Four boards give a network with enough nodes for a genuine relay to be needed.
ESP32-S3 or ESP32-C3 node2A second chip family to compare against, and a lower power option for a battery leaf node.
DHT22 temperature sensor4Each node needs to originate its own reading, otherwise you are only testing the forwarder.
5 V USB power supply with a short cable2Mains power for the relay nodes, which is where a relay belongs in a real deployment.
18650 cell and protected holder2For the leaf nodes, so you can compare battery life between a leaf and a relay.
Breadboard and jumper wires1 setYou will rewire nodes constantly as you test the topology.

Practise it before you build it

Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the LED on screen and the readings change when you change the wiring — no hardware, no burnt components.

Common questions

How many nodes can a mesh network handle?

The radio link and the flooding overhead set the limit rather than a hard number. In a classroom build, twenty to fifty nodes over a building is comfortable, and the real constraint is airtime: every flooded message is retransmitted by several nodes, so a chatty network saturates the channel. Keep reports infrequent and the mesh stays healthy.

Is BLE Mesh or ESP-NOW better for a school project?

ESP-NOW is simpler and quicker to get running, because it is just Wi-Fi peer to peer with a fixed peer list. Bluetooth Mesh is the standardised option with defined models for lighting, sensors and actuators, and it is what you would use if the project may grow into a real product. For a first build, ESP-NOW teaches the same idea with less setup.

What is the biggest problem with mesh networks?

Power. A relaying node is a receiver most of the time, and that is where the current goes. Design with mains-powered relays and battery-powered leaves, and the network is reliable. Design with everything on batteries and the mesh collapses within weeks, usually at the node that happened to be a relay.

Related guides

LoRa and LoRaWAN: The Physics of Long Range, Low Power RadioLoRa is the radio, LoRaWAN is the network. Real link budgets, airtimes, the Indian 865 to 867 MHz band and the sensors you can send over it. ESP32 Microcontroller: The One With the Radio OnboardThe ESP32 is a 3.3 V microcontroller with Wi-Fi and Bluetooth built in. What it really is, how it differs from an Arduino Uno, and where it fits in IoT builds. ESP32 IoT Projects: From a Single Sensor to a Live DashboardFive ESP32 IoT projects that teach sensors, MQTT publishing, deep sleep and reconnection, each staged so the logic runs in a browser simulator first. Smart Lighting: The Driver, the Controller and the RadioSmart lighting is a driver, a controller and a radio. Learn PWM, current limits, MOSFET switching and flicker, then build a lamp you can query.

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.