Creating an Optimized Mesh Network Using ESP32 Modules and ESP-NOW

Creating and Destroying – the Routine of a White Hat Computer Engineer



The Project Idea

During a previous internship at IT cyber-security provider Tripwire, I learned about the dangers of using unencrypted communications while creating an HTTPS driven Webcam RC Car Drone. At the end of the project, the drone was pen-tested by several cyber-security engineers, after which I could claim it to be unhackable. During my junior year of college, I was also involved in designing a hobbyist solution for autonomous battery replacement in hex/quad-copter drones.

Due to the nature of this Servant Engineering project, I became even more interested in WiFi controlled devices and RC drones. I wanted to learn more about the topic by making my own self-designed projects. I set a goal to create a cheap RC Webcam Car Drone, which I could drive all around my university campus. But this goal alone wasn’t enough. I also wanted it to be as secure as possible. Sure, I could just focus on improving the range of operation, but wouldn’t it be more fun if I could also challenge my CS friends by claiming it to be unhackable?

The Criteria
  • Cost - I don’t come from a wealthy family, so I want to design electronics that are accessible no matter your income level
  • Reach - I would like to be able to control my drone across a university campus

  • Bandwidth - Fast enough to stream low latency live camera capture

  • Security - Thinking ahead, I want this system to be useful for something serious. I value the level of security SSL provides, so I want to get as close to it as possible.
My Attempts So Far
My first attempt was to see if I could take advantage of my campus’ enterprise WiFi network to control an RC car with my phone. I used a Raspberry Pi Zero W ($10) and a camera module ($7), along with an H-Bridge Motor Driver ($2) to revive a broken RC car. This idea, however, failed in a few ways. While I was able to control my drone all the way across campus, as soon as I drove the drone from one relay to another, I lost connection due to a change in IP address. I was able to reconnect only after finding out the new IP address of the drone. Other downsides included an uncomfortable latency and network instability. This attempt wasn’t working for me, so I moved on to look for other solutions.

One way I could have tried to fix this would have been to buy a drone FPV camera and receiver and learn to use TLS to control the car, but using two different wireless connections at the same time wasn’t my cup of tea.

Then, I came up with the idea to create my own router and extend the reach with portable DIY WiFi repeaters. I was quickly discouraged, however, after figuring out that a long chain of WiFi repeaters would introduce an unacceptable amount of latency.

Later I discovered a new feature called ESP-NOW. It has the advantages of low power consumption, no overhead, near instant transmission, no need for a router, and built-in point-to-point encryption. The downside is a limited amount of peer nodes. ESP-NOW supports 10 encrypted peers at most or 6 encrypted peers with SoftAP enabled. These limitations are, however, acceptable for this project.

In my current internship with www.FiveWireLogic.com, they challenged me to define and build a project I found interesting. I believe creating an optimized mesh network will prove to be a difficult task, so to facilitate my learning I will be using the Five Wire toolset which includes a logic analyzer.

The mesh node network will consist of powerful but cheap ESP32 modules using the ESP-NOW functionality. To take it a step further, I will attempt to utilize the built-in ULP core of the ESP32 to save as much energy as possible while the mesh network is on standby. Once the mesh has been fully tested, I will use it to drive a simple RC car drone and attempt to pen-test it to discover any vulnerabilities.



Component Selection


  • 5x ESP32 - The Nodes of the mesh
  • 2x ESP32 Programing Fixture - To program and test the Nodes

  • 1x DHT11 Temperature and Humidity Sensor - For testing arbitrary sensor data transmission

  • 1x IR Receiver Module - For testing arbitrary sensor data transmission

  • 1x IR Remote - To test the IR Receiver Module

  • 1x RC522 RFID Module - For testing arbitrary sensor data transmission.

  • 1x Active Buzzer - For auditory feedback

  • 1x Passive Buzzer

  • 1x 5V Relay - To simulate IoT home device control

  • 1x Ultrasonic Sensor - For arbitrary sensor data transmission

  • 1x 10DoF Sensor - For arbitrary sensor data transmission

  • 1x Raspberry Pi Zero W - The heart of the Webcam Drone

  • 1x USB Camera - The eyes of the Webcam Drone

  • 1x Dual H-Bridge Motor Driver - For driving Drone’s motors

  • 1x 5V Regulator - For Raspberry Pi power input

  • 5x 3.3V Regulator - For ESP32 power input

  • 5x 3.7V Li-Ion Batteries - For node power input

  • 5x 4.2V Charger - For node battery charging

  • Buttons, LEDs, passive components, etc.


How I Will Use Five Wire

During my project, I will use Five Wire to troubleshoot module connections and debug communication protocols. During the development of the ESP-NOW, I will use the logic analyzer module of the FiveWire to probe multiple mesh nodes to monitor the timing and synchronizing of packet transfers. FiveWire will also be handy in decrypting IR and RFID messages for easy code setup.

Next Steps
  • Breadboard two bare-bone ESP32 circuits to begin developing using ESP-NOW.

  • Simulate and diagnose the ESP-NOW operation with FiveWire to figure out the detailed timings and limitations of the protocol.

  • Attach a simple temperature sensor on one node and a screen on another to create a first proof of concept sensor data transmission.
Written by David Mishchenko
Five Wire Intern
Senior at George Fox University Studying Computer Engineering

Blog entry information

Author
FiveWire
Views
517
Last update

More entries in General

Share this entry

Top