ESP8266 streaming

Discussion about various user interfaces such as web interface, displays and apps
Post Reply
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

ESP8266 streaming

Post by johu »

Don't want to pollute the ESP32 thread so want to discuss real time data streaming using the ESP8266 here. Reason for it is that most people already have an ESP8266 buried in their inverter and likely aren't very keen to swap it for something else because everything needs to be pulled apart.

That said, it seems that the ESP8266 modules I ship seem to not be able to OTA, even though the support is built in. Might be down to the unique way I program them.

Anyway, the idea is rather simple: without further processing stream the serial data received from the STM32 to the first attached client (192.168.4.2).
UDP seems to be the method of choice as it doesn't need to wait for acknowledgements. I have found this: https://fipsok.de/udp

Looks rather simple

Code: Select all

  Udp.beginPacket(unicastIP, PORT);
  Udp.printf("Temperatur: %.2f°C", tempC);
  Udp.endPacket();
I don't aim for user friendliness here. I'd simply browse some URL (/stream) and all its handler does is enable the UDP streaming in the loop function. There is also a function called yield() and I hope it triggers the watchdog so that the ESP doesn't reset. I'd disable the web server during streaming and to get back to normal mode a power cycle would be needed. (What sucks about this is that you can't even adjust parameters). Hmm, maybe the http can remain enabled, lets test this first.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: ESP8266 streaming

Post by mjc506 »

If you UDP, you'll want/need to put some way of making sure packets arrive in order (a simple counter should be enough)

Could probably leave the http server stuff in, and just send the esp into a tight loop (with yield() ) doing the UDP forwarding upon browsing to the page (so you'd need a power cycle to 'recover' and be able to use the web interface again) or even a 192.168.4.2/start and 192.168.4.2/stop for a little more control. Or just a bit of self restraint and don't go clicking through the web interface while streaming :-)

I have had some issues with OTA - works fine on the example (duino) sketches but gets flaky as complexity increases. I suspect I wasn't keeping an eye on timing well enough, or it might have been not stopping processing during upload. Not cracked that one yet...
Post Reply