M5Stack: WebServer using ESPAsyncWebServer



  • Hello,

    I am new to development with M5Stack (and also microcontrollers in general). Normally I work on PC applications, so please be gentle :D

    I am working on a project where I am measuring some Data. Measuring the Data works fine. I am also writing the Data to a .csv File on the M5Stacks SD-Card, which works fine as well. Furthermore I need to use an I/O Expander (https://shop.m5stack.com/products/official-extend-serial-i-o-unit?variant=16804807311450) and a Sensor to measure AirQuality (https://www.reichelt.de/de/de/entwicklerboards-sensor-fuer-luftqualitaet-ccs811-debo-sens-ccs811-p253655.html?r=1).

    Now I want to display the Data on a WebServer. Therefore I did implement a WebPage using HMTL, Javascript and CSS. To host the WebServer I decided to use the ESPAsyncWebServer (See: https://github.com/me-no-dev/ESPAsyncWebServer). I tested it in an own project (just the WebServer and some dummy Data) and everything works fine. When I integrate the WebServer project into my main Project some strange things are happening. Here is a list of behaviors that I did not expect to occur:

    • 1: The ESPAsyncWebServer seems to be pressing the M5Stack's ButtonA (even in the project where just the WebServer is running with sample Data). This is bad because I have programmed some actions based on pressed ButtonA. This also just seems to happen with ButtonA (not B and C). Is this reproducable? Has anyone a solution for this?

    • 2: The I/O Expander works fine for inputs but does not want to write outputs. The Outputs are written to HIGH and when measuring the Voltage there are 3.3 V. When connecting the output to a an actor (Relay switching input) the Voltage drops to 0 V and the actor does not work. Without the WebServer integrated into the project this works fine as well. NOTE: This behavior continues even when the WebServer is removed from the Project. I have to open a new Project with just the I/O Expander running and do a write to every Pin I want to use as Output and then it works fine again. Any Idea why???

    I am basically looking for a solution to use the HTML, javascript and css files located on the SD-Card to display a Website. In my javascript code I use the data stored in the .csv File on the SD-Card (and also bootstrap.css and plotly.js). So I need a way to access these files. The only way I found was to use the ESPAsyncWebServer. If you have any Idea to get this working or a different way on solving this please let me know. If you need additional information do not hesitate to ask for it.



  • Hello @User1234567

    1: The ESPAsyncWebServer seems to be pressing the M5Stack's ButtonA.

    M5.BtnA.wasPressed() conflicts with WiFi
    https://forum.m5stack.com/topic/3262/m5-btna-waspressed-conflicts-with-wifi



  • Hello @macsbug,

    thank you very much! The workaround described in https://forum.m5stack.com/topic/3262/m5-btna-waspressed-conflicts-with-wifi did solve all my problems (even the second one).