I working with several Arduino boards and now I need to control them via a web interface and in particular, I want to activate GPIO.
I have two ideas:
- Each Arduino acts as web server and I can control the GPIO via the Arduino web page. Basically one browser tab for each Arduino.
- Use the MQTT protocol to exchange message with the Arduino boards. Furthermore I think to use an raspberry as web server and as MQTT broker. Each Arduino board is subscribed to a specific topic and through a web page, hosted on the raspberry, I can control the Arduino GPIOs.
The first solution I very quickly and simple.
Regarding the second option, I don't know how to send MQTT message via a web page. I read that I need to use Web socket. Is it right? Need I to write code in JavaScript or what?
My second question is: Can the MQTT broker manage both MQTT and MQTT over Web socket at the same time? Otherwise I need to use the Web socket also on Arduino.
Another option is to built a Python script with GUI that allow to send MQTT messages to Arduino.
Is there a best way?