Jackpot to FluidDial Pendant - wireless connection via ESP-NOW

Hi All,

(UPDATE! There’s now an official implementation, so check that out! FluidDial/docs/ESP-NOW.md at main · figamore/FluidDial · GitHub )

(Update: How is this different than the websocket implementation mentioned below? ESP-NOW is radio-to-radio protocol of its own. So the flaky-ass wifi network you’re running can die, and the FluidDial still works. This adds a third transport layer: now there’s UART (serial,) WiFi (websockets,) and ESP-NOW (serial over ESP-NOW radio protocol). I didn’t know if it was possible to have both a wifi connection AND ESP-NOW but, magically, it does work. The whole point of having a pendant for me was this direct connection reliability, as my machines love to disconnect for WiFi especially in AP mode, in search of the precious Internet)

With FluidNC 4.0.3 the async web server got me thinking… with ESP-NOW ( ESP-NOW Wireless Communication Protocol | Espressif Systems ) I could maybe do wireless serial comms over ESP-NOW to the FluidDial and the Jackpot. And do it simultaneously with the web UI which uses Wifi through my home router. Would it work? Was it crazy? Yes?

(That is the new FigUI GitHub - figamore/FigUI: Next-generation Web UI for FluidNC · GitHub running on my fork of the newest v4.0.3 FluidNC) Basically to make the FluidDial work you’ll just need a USB power supply and the green/red buttons, and add this to your config.yaml:

espnow_channel:
  report_interval_ms: 100

Also, change this from I2S_STATIC to I2S:

stepping: 
  engine: I2S


To think of how many poor FluidDials met their maker due to accidental wiring mishaps… I dedicate this to their memory! It checks the UART first so it uses your RJ12 connection/hard wiring by default, so you can have both.

Hardware required is just the FluidDial and the buttons. I only have a Jackpot v1, but I assume it’ll work on the newer ones? If they mysteriously arrived at my doorstep I’d eagerly test!

I’ve only done initial testing but the code is available below. I’ll let the FluidNC team know but they may not have any interest since they have the websocket implementation (which, as I outline above, relies on a wifi connection.)

Oh and the ka-chunk in the video was something falling, not me breaking my Lowrider…

Now to make an enclosure that holds a battery… (actually, just a wall wart makes sense for those long sessions.)

Code:

(Be sure to build and upload the filesystem to get the fancy icon)

I thought you cant use ESP-NOW and wifi at the same time ?

I’ve used the wifi connection to jackpot here. but later discovered some stability issues but that could be my wifi

You know the same dev as FigUI already made this wireless?

Oh hah! Well I guess I’ll just enjoy the experience.

Looks like he did a different approach with websockets, while I’m basically using a serial connection over the ESP-NOW protocol. It is broadcast based (latches to the MAC) so dealing with wifi networks is unnecessary.

They have to use the same channel (I handle that) but I haven’t had any issues in my initial testing. The nice thing is that this is a direct connection. In my video the webUI is going over my wifi router, but the pendant is talking over broadcast to the Jackpot directly 2 feet away.

E.g. if my Wi-Fi router goes down the pendant is connected via esp-now and stays connected.

Theoretically - I will test this. But that does make it potentially better than the websocket implementation.

which version/fork of fluiddial and fluidnc do you need ?
I’m going to try it on my battery powered cyd pendant later today

I’m still finalizing a few things but will post the fork soon.

Hmm, I have this remote which uses ESP-NOW. I’ve used it to control WLED.

Hmm.

Ooh! I bought a sack of ESP32-C3’s because I thought I was going to make a virtual serial cable connection, until I realized I didn’t even need them. But esp-now is a party out of the box, so could be fun for lots of things…

I’m glad I didn’t see that Wifi fork of FluidDial because I probably wouldn’t have had any of the fun!

I’ve updated the initial post at the top with the code, if you’re living dangerously. I don’t have a CYD so I only verified my code builds on it (not sure which one you have, so choose it with the _espnow profile.)

Note that I’m making a lot of changes (server/client stuff) but will try to keep the esp-now branch in a working state.

Got some feedback from Mitch and making a few changes to potentially get this into something more widely useful, so might have a use for my sack of esp’s sooner than I thought! Basically broadcast mode for displays and unicast mode for pendants and the like. All outside of the evil WiFi kingdom!

Direct wireless connection with esp…. Sounds like a great option for stability with a pendant. Is there a pairing process for this or can any other esp configured correctly connect?

Weird, can’t delete this reply post… nothing to see here!

There’s no pairing other than turning on the devices one after the other, it’s automatic. ESP-NOW is pretty slick. If the pendant is plugged in to RJ12 it will use that serial connection instead.

Should be interesting if this all works, should have some time this weekend to test it out.

I installed the cyd_buttons_espnow build.

Here is the uart_channel section of my config:

uart1:
  txd_pin: gpio.16
  rxd_pin: gpio.4
  rts_pin: NO_PIN
  baud: 115200
  mode: 8N1

uart2:
  txd_pin: gpio.15
  rxd_pin: gpio.12
  rts_pin: NO_PIN
  cts_pin: NO_PIN
  baud: 1000000
  mode: 8N1

uart_channel2:
  report_interval_ms: 75
  uart_num: 2

espnow_channel:
  report_interval_ms: 100

My Fluid CYD pendant doesn't connect to the Jackpot V2. I get this error:
[MSG:ERR: Ignored key espnow_channel]
[MSG:ERR: Skipping key report_interval_ms indent 2 this indent 0]

I didn’t know if this is ready for prime time testing, still working on docs etc. At a glance it looks like the FluidNC flash didn’t take, I have only added the code to the “wifi” profile so far. Which one does the jackpot v2 use?

I did make a ton of progress today though and ran 4 jobs without issue. I kept reaching for the cable out of habit to prevent snagging during long fast Y moves!

Made some major refactor and safety changes today, staying to come together… FluidDial/README-ESP-NOW.md at esp-now-connection · Coinbird/FluidDial · GitHub

The JP2 just uses different gpios than the JP1. I have both. I just wanted to point that out so you would know that’s why my uarts are using different gpios. I wanted to see where you added the espnow_channel: in your config. I was thinking I probably have it in the wrong place.

Thanks

I don’t touch anything gpio related at all.

The order doesn’t matter in the YAML as long as it’s at the top level of indentation. If it works, you’ll see the espnow logs after you flash your Jackpot. Note-make sure you pull the latest code from my esp-now-connection branch, made a bunch of changes yesterday.

I’ve only tested the wifi Platform.IO profile but wifi_s3 builds too if that’s what your jackpot v2 needs.

Range test is rock solid, so long WiFi! They say 200 meters outside but will never be anything close to that.