For programming microcontroller I used cpp and for front end I used HTML and pure JS. The cpp parts connects the nodemcu to wireless network at home. So this gives nodemcu an IP address which we can navigate to open a page displaying temperature, humidity and two buttons for lights and fan in room. I also programmed microcontroller to return data in json format, so that I can use Ajax call on the page to update data displayed asynchronously. Unlike ethernet shield I used in plant watering system that creates server object of Ethernet class provided by the Ethernet library for Arduino, nodemcu uses ESP8266 wifi controller for which I used ESP8266WebServer class to created server object at port 80.
So you might be thinking what is nodemcu - NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module.
I have been playing with microcontrollers for quite some time now. At home in Bangalore I have a automatic plant watering system setup. This week I was on vacation back in my hometown. I already wanted to do some automation, so before I started journey from bangalore I ordered NodeMCU V1.0 Amica Rev.2 which is ESP8266 based wifi microcontroller. So I spent some time hooking up main lines with the nodemcu which is connected to relay board and DHT11 shown below.
before I connected the wires coming out from relays I spent quite a good amount of time to write code that would display temperature , humidity and buttons to turn on/off lights and fan.
For programming microcontroller I used cpp and for front end I used HTML and pure JS. The cpp parts connects the nodemcu to wireless network at home. So this gives nodemcu an IP address which we can navigate to open a page displaying temperature, humidity and two buttons for lights and fan in room. I also programmed microcontroller to return data in json format, so that I can use Ajax call on the page to update data displayed asynchronously. Unlike ethernet shield I used in plant watering system that creates server object of Ethernet class provided by the Ethernet library for Arduino, nodemcu uses ESP8266 wifi controller for which I used ESP8266WebServer class to created server object at port 80.
Have a look here at the GitHub repo where I am keeping my code.
now after coding I hooked the wires from relay to the switches and there it is. Powered NodeMCU with adapter and now I can access the webpage with temperature humidity and buttons to turn on/off light and fan of my room from any phone at home or over the Internet.
have a look at the page that gets rendered of nodemcu use to display temperature, humidity and control lights and fan
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
Custom Search
Other Blogs & PagesGit Commands Animation & VFX SitesA MUST READ for Ani/VFX Artistsawakened by thoughts,
|