Running A Web Server On The ESP8266

We’ve written lot about the ESP8266 lately, but people keep finding more awesome uses for this inexpensive module. [Martin] decided that using the ESP8266 with an external microcontroller was overkill, and decided to implement his project entirely on the module with a built-in web server.

[Martin] started out with the ESP8266 web server firmware developed by [sprite_tm]. This firmware provides a basic web server that supports multiple connections and simple CGI scripts right on the module. The web server firmware opens up a ton of possibilities with CGI scripting. When booting up in AP mode, you can even connect the ESP8266 to another access point right from the your browser.

[Martin] decided to connect a DHT22 temperature/humidity sensor to the module as a proof of concept. He used a DHT22 library written for the ESP8266 to read data from the sensor, and wrote a CGI script to display the data on a web page. [Martin] also added buttons to control a GPIO pin as a proof of concept. He posted his source code and a binary (see the end of his post) so you can try out his application and mod it for your own project.

20 thoughts on “Running A Web Server On The ESP8266

  1. So, I can just hook this thing up to a battery and carry a website with me in my pocket?

    The pranks!

    1, Load up with shock image of choice.
    2, Set up unprotected network with name of local coffee shop.
    3, ????
    4, Profit!

    Best $10 I’ve ever spent.

    1. You can get little ‘mobile router sticks’ for about $10-15 from ebay/aliexpress with an ethernet and USB port on the ends and WiFi that run openWRT to do this. They already have rechargable LiPos inside and would be just as portable and probably cheaper than an ESP8266+battery+regulator+switch+case.

      The ESP8266 is more useful if you want to include it as part of a project.

        1. Mine say ‘1800mah 3G Mobile AP’ on them. But ‘3G mobile router’ should turn up some results. You’ll have to do your own research to see which ones support openwrt, or pay the premium for one with it already installed.

          I was told these tiny router sticks all use the same chipset so just bought the cheapest I could find which happen to be wrt5350f. I’m not sure if they are _ALL_ openwrt compatible but perhaps it would be a fun hacking adventure to make one compatible if it is not.

          Some of the cheaper ones on eBay did mention openwrt in the description though.

  2. I have a small pile of these now (different models, some with more IO, some with less, some with insane bugs in the design like not routing any GPIO at all). They’re interesting, but the lack of information about them is a little frustrating at times. If you pick up some of them, look very closely at the pinout and sanity check it for yourself, some look the same but have the power pins in different places than others.

    1. Same. I have not touched mine in days as I’m not a pioneer but more a tinkerer. For Tinkering I need parts that I can stack together and code a bit of glued between the modules to prove my concept. The ESP8266 is a pain to talk to and integrate into a complex enviroment with all his limitations and special needs. I will just gladly wait until someone with an affinity for coding libs will contribute his time and publish something usefull and then hit the donation button of this guy.

      1. Even the AT commands are a bit baffling. i was going to go the cheap route (mentally) and just use them as a dumb proxy for data, but it seems even that is a little bit harder than I originally hoped it would be. Seems pretty wasteful to have such a powerful processor idling while an 8bit processor does the actual grunt work, too.

  3. Incredible !
    You’re right : rt5350f sticks are available at very low price ($9 without battery, $11 with ; check on AliExpress)
    Thanks for the information, this is what i searched for a very long time.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.