Main Content

Easy ESP8266 (Arduino Core) Web Controls With Embajax

If you came here, you have probably started playing with an ESP8266 as a web server, before. But if you have not: It’s incredibly easy to implement a webserver on an ESP8266, and you should try this, today! (The hardest part is getting familiar with how to connect and program your ESP8266 - I will give you some links on this in Step 1).
However, once that is accomplished, you don’t want to simply serve static content, you want to display changing information such as temperatures or other sensor readings, and you want to add controls to allow turning on and off lights, etc. The general approach to doing so is using a family of techniques known as “AJAX” or Asynchronous Javascript and XML (where XML is typically replaced with JSON in contemporary applications). That is a relatively straight-forward technique to manage data exchange between a web server (your ESP8266), and a web client (browser on your smartphone or PC). You will not have trouble finding basic examples of controlling a single switch from a single client, for instance. However, once you need to pass information both ways (client to server and back), once you deal with more than one client, once you start worrying about lost network connections, etc. you will start to realize that all of this is more cumbersome than you thought at first.
One popular way out of this mess is Blynk. However, maybe - like me - you are a stubborn old-school fool who fails to see why you would need to sign up to a service, and download an app, when you already have an embedded webserver up and running, and a choice of web browsers on any device.
Fear not! Rolling your own AJAX - all registration free, and based on public standards - has just become easy. I’m going to give you a brief introduction to EmbAJAX, and then you can finally start worrying about what you are going to implement in your IoT project, instead of how.”

Link to article