Controlling my Arduino using ESP8266 and web app

My project consists of a Arduino-powered blinds controller connected to the internet using an ESP8266. The idea is to be able to control the device through a web app. Right now I'm stuck on a general approach for how to do this and would like some suggestions or guidance.

I currently have two rough ideas in mind, but not sure if either is effective or even feasible. I intend to use the ESP in station (client) mode so that it has internet access through the local wireless network.

  1. On the Arduino, send a GET request to the web app using AT+CIPSEND and wait for response from the web app telling the device to adjust the blinds, open and close, etc. After receiving a response, immediately send another request. The main problem would be potential timeouts because we don't know when the user might send a command to the device. Even if there were no timeouts, this method seems awfully inefficient and maybe wasteful on power (just speculating).

  2. Set up a TCP server on the ESP8266 using the command AT+CIPSERVER, and treat incoming commands from the web app as client connections. I know you can do this sort of thing using the ESP8266WiFi and ESP8266WebServer libraries, but it seems to me that those require the code to run on the ESP8266 itself. I need the code to run on the Arduino because the ESP8266 doesn't have enough GPIO pins. I'm not entirely sure if the libraries' client-handling functionality can be replicated through AT commands alone; if not, then I would have to abandon this approach.

Which approach do you think is better? Is either one missing a key detail that would make it impossible? Do you have better ideas in mind?


  1. is possible, but can you make request from Internet to esp8266?

btw: why two mcu?. esp8266 can control some relays