Turn ON and turn OFF an LED from Mobile App through NodeMCU

This is a simple method to control an LED connected to NodeMCU from a Mobile device through an app or from the web browser of your mobile device.

LEDcontrolDownload

After installing the library, open the example program from File -> Examples -> LEDcontrol -> LEDcontrol and upload to your NodeMCU. If uploading successful, connect your mobile device to NodeMCU through WiFi.

Read More
Temperature monitoring system over WiFi using NodeMCU and NTC thermistor

Download the TemperatureMonitor library from following link.

TemperatureMonitorDownload

Unzip the library and copy to the Arduino libraries folder. Program compiled and tested successful on Arduino 1.8.12.

Now, open the program from File -> Examples -> TemperatureMonitor -> TemperatureMonitor.

Compile and upload the program to NodeMCU.

Read More
NeoPixel ring colour picker with touch and drag support from Mobile device through NodeMCU over WiFi using javaScript

Arduino Program

#include <Adafruit_NeoPixel.h#ifdef __AVR__ #include <avr/power.h// Required for 16 MHz Adafruit Trinket #endif #define PIN D2 #define NUMPIXELS 16 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 // Time (in milliseconds) to pause between pixels #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location",
Read More
NeoPixel ring colour picker from Mobile device through NodeMCU over WiFi using jQuery

Arduino Program

#include <Adafruit_NeoPixel.h#ifdef __AVR__ #include <avr/power.h// Required for 16 MHz Adafruit Trinket #endif #define PIN D2 #define NUMPIXELS 16 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 // Time (in milliseconds) to pause between pixels #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location",
Read More
Real time data monitoring from NodeMCU through graphical interface using jQuery

Arduino Program

#include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location", "/index.html", true); server.send(302, "text/plane", ""); } void handlePWM() { String PWM = server.arg("pwm"); int p = 1024 - (PWM.toInt()) * 10; Serial.println(p); analogWrite(LED, p); server.send(200, "text/plane", ""); } void getCount() { server.send(200, "text/plain", String(count).c_str()); Serial.print("Sending "); Serial.print(count); Serial.println(" to the client device...");
Read More
Web interface from NodeMCU – Part 5, jQuery and Bootstrap on NodeMCU

Arduino Program

#include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location", "/index.html", true); server.send(302, "text/plane", ""); } void handleWebRequests() { if(loadFromSpiffs(server.uri())) return; String message = "File not detected\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET)?"GET":"POST"; message += "\nArguments: "; message += server.args(); message += "\n";
Read More
Web interface from NodeMCU – Part 4, Scan and list available WiFi networks

WiFiNewLibrary.h (Download this file from the attachment given below)

WiFiNewLibrary_hDownload

WiFiNewLibrary.cpp

#include "WiFiNewLibrary.h" WiFiNewLibrary::WiFiNewLibrary() { } void WiFiNewLibrary::setupConfigPortal() { server.reset(new ESP8266WebServer(80)); if(_apPassword != NULL) { if(strlen(_apPassword) < 8 || strlen(_apPassword) 63) { Serial.println("Invalid password..."); _apPassword = NULL; } } if(_apPassword != NULL) { WiFi.softAP(_apName, _apPassword); } else { WiFi.softAP(_apName); } Serial.println("AP IP Address"); Serial.println(WiFi.softAPIP()); server -on(String(F("/")).c_str(), std::bind(&WiFiNewLibrary::handleRoot,
Read More
Web interface from NodeMCU – Part 3, List available WiFi networks

WiFiNewLibrary.h (Download from the attachment given below)

WiFiNewLibrary_hDownload

WiFiNewLibrary.cpp

#include "WiFiNewLibrary.h" WiFiNewLibrary::WiFiNewLibrary() { } void WiFiNewLibrary::setupConfigPortal() { server.reset(new ESP8266WebServer(80)); if(_apPassword != NULL) { if(strlen(_apPassword) < 8 || strlen(_apPassword) 63) { Serial.println("Invalid password..."); _apPassword = NULL; } } if(_apPassword != NULL) { WiFi.softAP(_apName, _apPassword); } else { WiFi.softAP(_apName); } Serial.println("AP IP Address"); Serial.println(WiFi.softAPIP()); server -on(String(F("/")).c_str(), std::bind(&WiFiNewLibrary::handleRoot, this)); server -on(String(F("/wifi")).c_str(), std::bind(&WiFiNewLibrary::handleWiFi, this, true)); server -begin();
Read More
Web interface from NodeMCU – Part 2, Scan WiFi networks

WiFiNewLibrary.h

#ifndef WiFiNewLibrary_h #define WiFiNewLibrary_h #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <memoryextern "C" { #include "user_interface.h" } const char HTTP_HEADER[] PROGMEM = "<!DOCTYPE html<html lang=\"en\"<head<meta charset=\"UTF-8\"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/<title{v}</title"; const char HTTP_STYLE[] PROGMEM = "<style.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;background-color: #58d68d;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} </style"; const char HTTP_HEADER_END[] PROGMEM = "</head<body<div style='text-align:left;display:inline-block;min-width:260px;'"; const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"<buttonConfigure WiFi</button</form<br/<form action=\"/i\" method=\"get\"<buttonESP8266 Info</button</form<br/<form action=\"/r\" method=\"post\"<buttonReset ESP8266</button</form";
Read More
Web interface from NodeMCU – Part 1, Basic interface

WiFiNewLibrary.h

#ifndef WiFiNewLibrary_h #define WiFiNewLibrary_h #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <memoryextern "C" { #include "user_interface.h" } const char HTTP_HEADER[] PROGMEM = "<!DOCTYPE html<html lang=\"en\"<head<meta charset=\"UTF-8\"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/<title{v}</title"; const char HTTP_STYLE[] PROGMEM = "<style.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;background-color: #58d68d;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} </style"; const char HTTP_HEADER_END[] PROGMEM = "</head<body<div style='text-align:left;display:inline-block;min-width:260px;'"; const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"<buttonConfigure WiFi</button</form<br/<form action=\"/i\" method=\"get\"<buttonESP8266 Info</button</form<br/<form action=\"/r\" method=\"post\"<buttonReset ESP8266</button</form";
Read More
X