29-404, LPU, Jal-Del G.T. Road - Phagwara, PB, India
09:30 am – 05:30 pm

IoT-based HTTP Webserver (DIY)

Published On: Monday, February 18, 2019 35107 views

Hello Everyone!

 In this post I am going to talk about an Internet of Things (IoT) project which demonstrates the HTTP web-server functionality (just like regular web-servers which run on powerful desktops) on way less powerful hardware. I chose NodeMCU board based on ESP8266 microchip which integrates GPIO, PWM, IIC, 1-Wire and ADC all in one board! It has USB-TTL included with plug & play and has around 10 GPIOs where every GPIO can be PWM or I2C... Well, without getting too nerdy about it, let me explain what I did with it.

 Any IoT device should be designed with a Service-oriented Architecture (SoA) to offer its core functionality to the end-users. If you look around any smart device usually comes with some way of communicating through either via Bluetooth or WiFi, so I was thinking maybe to use NodeMCU to act as a HTTP webserver since it comes with inbuilt WiFi, and let a service designed for the end-users to trigger an event on the device itself. In my case, i decided to use a small inbuilt LED which is conveniently placed on the NodeMCU board itself which comes prebuilt with the board.

 Thereafter it took me a couple of hours to put together and test code using the Arduino IDE and used serial monitor tool to review the internet communication activity on the NodeMCU, which to less of my surprise it just worked!  

 The code enables persistence for auto-connection to the given WiFi Router using pre-supplied login credentials for obtaining an Internet Protocol (IP) address. This means that the moment there is power, the IoT device would auto-connect or keep trying unless it does that! Having an IP address and the whole system listening on port 80 means any third-party device or system can connect to it and exchange information or data. In my case, I just used my laptop’s web-browser to connect to the NodeMCU’s IP address and be presented with following screen:


Turning on the LED on board was simply a matter of a click on the button!


Thank you for reading and I hope you’ll find this post useful and in case if you have any questions then please feel free to drop a comment below!

Post by: Sarabpreet Singh
Contact author: click here

Key Words

device inbuilt system Hello Thing image latin which fareast theme mean design Service auto minor bidi board GPIO HTTP Internet WiFi talk just post less about server functionality user project powerful language NodeMCU code address connect around scv1 Everyone asset