Close

Firmware using ESPNOW seems to be working well

A project log for EVPR: Electric Variable Pitch Rotor

An electrically actuated variable pitch rotor with a wireless interface

Peter McCloudPeter McCloud 02/08/2018 at 06:300 Comments

Most of the recent work has focused on the Fiirmware,  particularly the protocol for communicating the servo positions between the master and the slaves. TCP was used for the prior iteration of the firmware, but led to less than satisfactory performance. Spurred on by @Jarrett's suggestion, I wrote a version of the firmware using the ESPNOW protocol. While it using wireless data, it doesn't require a WiFi network, but instead uses  IEEE 802.11 Action Vendor frames (as I don't follow this either, assume *magic*). The idea is that the ESPNOW protocol requires less overhead than sending UDP or TCP packets over a WiFI network that has to be established.

So now the master node reads the servo positions from the flight contoller via UART and broadcasts the servo positions for all of the slave nodes over a single packet. Each slave node receives the packet and only uses the data for the servo it requires. This simplifies the work done on the master node, since using sockets over WiFi required a separate connection for each rotor.

Testing thus far shows that the connections appear reliable. out of 9000 packets sent at a rate of 50 Hz, the slave node missed only three packets (0.03%). The servo movements are visibly improved from before, with none of the jerkiness. I've gone ahead and merged the updated firmware into the master branch.

As always, there's more work to do. The slaves are setup to send out a heartbeat packet every second, and the master node is setup to receive them, but nothing is currently been done with the information. Eventually the idea is to have the master get a status confirmation of the rotors and sharing that information with the flight controller to prevent arming the vehicle with less than the required number of working rotors.  There are a few other error checking tidbits to add to make the system as safe and reliable as possible.

Discussions