EspNowSkip

From RevSpace
Jump to navigation Jump to search
Project EspNowSkip
350px
Muziekskipknop op basis van ESP-now protocol
Status Initializing
Contact bertrik, jelly
Last Update 2018-05-05


Introduction

This page is about using the ESP8266/ESP32 ESP-Now protocol in the music skip button.

A music skip button has some tricky requirements:

  • you want it to react reasonably quickly, with little latency between pressing the button and skipping to the next song
  • the skip button should be mobile, so it is battery powered

The ESP-now protocol is connectionless, you don't need to set up a session/get an ip-address to communicate between nodes.

Proposed EspNowSkip protocol

For the EspNow skip button it could work something like this:

  • there are two roles:
    • a single central "master" node
    • one or more "slave" skip-buttons
  • when the skip button is pressed, it wakes up from deep sleep and sends an ESP-now "SKIP" message to the last known channel and address of the central node
    • if the skip button doesn't receive an ACK from the central node, it starts a kind of discovery to re-establish the channel and address of the central node
  • the central node sets up an AP by name (e.g. "espnow-revspace") and broadcasts an ESP-now packet regularly (say every 10 seconds).
  • the discovery procedure tries to find the central node by name, this AP name is the only thing that needs to be agreed upon in advance between master and slave code
    • from the AP name, the slave node can determine the wifi channel to use
    • from the AP broadcast packet, the slave node can determine the master MAC address to send to
    • the slave node keeps both wifi channel and MAC address in (emulated) EEPROM and goes back to sleep