Control a project via web



  • Hello community,
    I bought an M5StackFire and would like to implement the following project to learn.
    I would like to expand the "earth" project. The project is to measure the earth's moisture and control an irrigation pump via a relay. This seems easy with Blockly and I understand the Pyton code, I'm just waiting for the units from China :-).
    The difficult part: I want to control it via the web. I would like to see on a website how the moisture developed during the day and when the pump was running.

    How can I implement web monitoring? I want to access the M5Stack over the IP (WLAN) and see the current values ​​from every device in the LAN.

    It would be nice if someone could show me an example of how I can access via web.



  • @svennib in theory, you could achieve this using a combination of the ESP Now and Expermental remote functions but in practice, I'm just to get the expermental remote functions to work.



  • You could use a MQTT protocol and a MQTT server. For example adafruit.io. If you want send data to server you use in uiflow Advanced->MQTT->publish topic to store data in feed. This feed with your data you can display as text, gauge , button or bargraph with historical values from realtime to one month back. To control relay you could use another feed who will be store state of your relay and you could be change this via web browser from any place on earth where is internet access. This relay state you can read via Advanced->MQTT->mqtt subscribe. The feeds you can display as dashboard whose you can arrange as you like.



  • as @robalstona mentioned, MQTT is a great suggestion and already has the blocks for it in uiFlow. Another option is Blynk, which gives you the ability to easily create a widget-based smartphone app where you can view it from anywhere, graph the data, create custom timer schedules, etc. Check out these threads on the topic:

    http://forum.m5stack.com/topic/575/blynk-on-m5stack-via-uiflow-and-block-maker
    http://forum.m5stack.com/topic/1056/adding-external-libraries-via-uiflow



  • Let me add some about remote.
    If you like a hard way with expose the device over wan look at
    https://github.com/jczic/MicroWebSrv

    Its web server. I think you can easy do all what you want on esp32. Via UiFlow you can add pure python code. Also files could be stored on SD.

    Soon i will valide this on m5stick grey.

    The idea with get all and show via wan is not so secure.

    I did in past POC with 2 core units and 2 sticksc.
    3 units report env, light, pm2.5 and soil humi over espnow to one core main unit.
    Main unit was a kind of the dash unit, with show all nice and clear raw data taken from slave units.

    This was a concept with works good, espnow is given you realtime data.

    But the to push all in level up you have to use build in webservice or push all up to some hosted unit.

    For example if you have hosting or in local lan any machine with could host this https://github.com/emoncms/emoncms
    You can push all into nice dash cms with i am using for another iot project.
    Data could be posted via Html post with API key.



  • Happy New Year to all.
    It's a lot of stuff for someone who long ago programmed with Turbopascal and Visual Basic as a hobby :-) .
    Thank you, these are interesting ideas and of course I still have a lot to learn. Doesn't appear easy, but is interesting. I hope the units will arrive soon and I have time to review all of this.
    I experimented with MQTT via CloudMQTT and it worked. Maybe I'll try to build a website and display the CloudMQTT data about it, but for that I have to learn a little bit HTML.

    Can anyone recommend a good book to start with Micropython that includes a reference book?

    Thanks SvenniB



  • This book really helped me alot. The author Rui Santos has written lots of great micropython tutorials online and this ebook is a combination of all that knowledge https://randomnerdtutorials.com/micropython-programming-with-esp32-and-esp8266/



  • @svennib said in Control a project via web:

    MQTT

    This is a tutorial about UIFlow and MQTT and CloudMQTT: https://www.youtube.com/watch?v=5RozKI-3i4Q