I am developing a Wifi based Led light (Got Inspired from Philips hue, Lifx). I have little knowledge about web server, clients, Web protocols. I will be using ESP8266 as Controller cum WiFi module.
There are two ways to control Led light over WiFi.
- Locally
- Remotely
Android/iOS app will be handling all the control part.
Which protocols can I use to control Led light, locally? HTTP or Websockets?
Note :- The speed is critical, android/iOS app can send around 50-60 values per second.
Also, which protocol should I go with if Led light is controlled Remotely.? So far, MQTT seems reliable. Any suggestion?
Kindly help!
-
why not use a single protocol for both local and remote - far simpler code - MQTT should sufficeJaromanda X– Jaromanda X2016年07月11日 23:19:53 +00:00Commented Jul 11, 2016 at 23:19
-
What if internet is not working, in that case as well, Local transmission of data will not happen, because MQTT works over Internet. I should have the option of controlling it locally.MICRO– MICRO2016年07月12日 06:48:00 +00:00Commented Jul 12, 2016 at 6:48
-
MQTT works over a network, doesn't have to be "the internet" if you have a local MQTT serverJaromanda X– Jaromanda X2016年07月12日 06:48:44 +00:00Commented Jul 12, 2016 at 6:48
-
But I see what you mean. My setup is more flexible because all my IOT servers are within my LAN - still externally accessible, but all under my control and I have a router that loops back requests for external IP from within the LAN ... so, it just works with one single domain, I don't have to do anything different for external vs internal accessJaromanda X– Jaromanda X2016年07月12日 06:52:12 +00:00Commented Jul 12, 2016 at 6:52
1 Answer 1
UDP :D
Seriously though, ESP8266 is limited in resources, AND you want to send 50-60 updates a second, just UDP will be the most lightweight, and you won't run out of connections (5 I think on ESP), because UDP has no connection state.
This is what was used here to control a RGB strip: https://github.com/cnlohr/esp8266ws2812i2s , it just listens for UDP packets on port 7777, and each packet contains rgb values, one byte for R,G,B, etc.
MQTT is nice, but it doesn't work well for 60hz updates, I Tried :D It resulted in un-smooth animation, and frames out of order.
Explore related questions
See similar questions with these tags.