top of page

Search Results

163 results found with an empty search

  • IoT Canvas Gauge based Garbage Monitor using OLED and Ultrasonic sensor

    Here to make an IoT based garbage bin level monitoring system. In this level monitoring using canvas gauge in HTML page and OLED. The real time garbage fill level can be monitored via internet. The IOT system uses non-contact method (ultrasonic sensor based) for measuring garbage level and it can detect solid, semi-solid and liquid waste level up to 20cm and capable of 400cm. Circuit diagram Components required NodeMCU ESP826612E Ultrasonic Distance Sensor HC-SR04 OLED SSD1306 - 4 PIN I2C 128X64 Display Module 0.96 Jumper wires HC-SR04 This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. There are only four pins that you need to worry about on the HC-SR04: VCC (Power) to NodeMCU VinPin Trig (Trigger) to NodeMCU D5 Pin Echo (Receive) to NodeMCU D6 Pin GND (Ground) to NodeMCU GND Pin. OLED SSD1306-I2C 128X64 Display Module 0.96 inch This is a 0.96 inch Blue-Yellow OLED display module. The display module can be interfaced with any microcontroller using SPI/IIC protocols. It is having a resolution of 128x64. The package includes display board,display, 4 pin male header presoldered to board. OLED (Organic Light-Emitting Diode) is a self light-emitting technology composed of a thin, multi-layered organic film placed between an anode and cathode. In contrast to LCD technology, OLED does not require a backlight. OLED possesses high application potential for virtually all types of displays and is regarded as the ultimate technology for the next generation of flat-panel displays. Specifications : Viewing angle : greater than 160 degrees Supported platforms : for arduino, 51 series, MSP430 series, STIM32 / 2, SCR chips Low power consumption : 0.04W during normal operation Support wide voltage : 3.3V-5V DC Driver IC : SSD1306 Communication : IIC, only two I / O ports No font : The software takes word modulo Backlight : OLED self light, no backlight Interface: VCC: 3.3-5V GND: Ground SCL: Serial Clock SDA: Serial Installing the ESP8266 Arduino Library Installing SSD1306 OLED Library – ESP8266 There are several libraries available to control the OLED display with the ESP8266. In this tutorial we’ll use two Adafruit libraries: Adafruit_SSD1306 library Download Adafruit_GFX library. Download Subscribe and Download code. Follow the next steps to install those libraries. 1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open. 2. Type “SSD1306” in the search box and install the Adafruit SSD1306 library version 1.2.9 library from Adafruit. 3. After installing the SSD1306 library from Adafruit GFX version 1.4.13 in the search box and install the library. 4. After installing the libraries, restart your Arduino IDE. After installing the required libraries, copy the following code to your Arduino IDE. Arduino Code Subscribe and Download code. Download code

  • IoT Web server Based Magic Cup Tilt Position Monitor

    In this tutorial we will learn how to interface an IoT Based Tilt Position Monitoring canvas gauge using Nodemcu ESP826612E and KY-017 Mercury Magic Cup Tilt Switch Module. This Mercury Switch is an electronic device used to detect the orientation or tilting of an object and provides digital output based on the orientation. It behaves like a normal ON – OFF switch that is controlled by tilting. Tilt sensor consists of a mercury ball and two contacts in a sealed Bulp, in which the mercury ball will short the leads based on the orientation. Components Required ESP8266 NodeMCU Dev Board KY-017 - Magic Cup Tilt switch (Mercury) Circuit diagram KY-017 - Magic Cup Tilt switch (Mercury) Magic Light Cup Module is a board which has a led and a mercury tilt switch. Using PWM to drive the LEDs on the module you can achieve the effect of light being “magically” transferred from one module to the other when tilting them. In short, it’s 2 components combined, a mercury tilt switch and a led. On tilting the module mercury inside small tube connect the switching point and make switch ON while tilting it to other side move the mercury and it disconnects the circuit and switch get OFF. The module operates on 5V DC supply. So the magic in the name of this module is because when you tilt the switch, the led will turn on and off. And Of course, it is also possible to connect it to the NodeMCU. Pin Connection with Node MCU: Connect G to a GND port of your NodeMCU Connect + to a 3.3v port of your NodeMCU Connect S to a digital port on your NodeMCU (in my example port D5) Connect L to a digital port on your NodeMCU (in my example port 3.3V) working Principle Not Tilted When the sensor is in “Not Tilted” position, the mercury ball will be at the bottom and shorting the contacts as shown in the image below. This will turn ON the LED and the output will be LOW. Tilted When the sensor is in “Tilted” position, the mercury ball will move away from the contacts as shown in the image below. This will turn OFF the LED and the output will be HIGH. Subscribe and Download code. Arduino Code #include #include #include //Include File System Headers const char* htmlfile = "/index.html"; //WiFi Connection configuration const char* ssid = "TP-Link_3200"; //Your Wifi SSID const char* password = "9500112137"; //Your Wiffi PAssword ESP8266WebServer server(80); void handleADC(){ if (digitalRead(14) == 1) { delay(300); } else (digitalRead(14) == 0); { delay(300); } String adc = String(digitalRead(14)); Serial.println(adc); server.send(200, "text/plane",adc); //sends data to server } void handleRoot(){ server.sendHeader("Location", "/index.html",true); //Redirect to our html web page 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"; for (uint8_t i=0; i

  • IoT Web Server Based Object Distance Meter using Ultrasonic sensor

    In this tutorial we build a Ultrasonic sensor to measure Object distance using NodeMCU ESP8266 12E dev Board. Circuit diagram Components required NodeMCU ESP826612E Ultrasonic Distance Sensor HC-SR04 Jumper wires HC-SR04 This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. There are only four pins that you need to worry about on the HC-SR04: VCC (Power) to NodeMCU VinPin Trig (Trigger) to NodeMCU D1 Pin Echo (Receive) to NodeMCU D2 Pin GND (Ground) to NodeMCU GND Pin. You will find this sensor very easy to set up and use for your next range-finding project! This sensor has additional control circuitry that can prevent inconsistent "bouncy" data depending on the application. Installing the ESP8266 Arduino Library Download Ultrasonic library Download code Subscribe and Download code. In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded. After installing the required libraries, copy the following code to your Arduino IDE. Subscribe and Download code. Arduino Code #include #include #include //Include File System Headers #include Ultrasonic ultrasonic(D1, D2); //D1 trig, D2=echo int distance; const char* htmlfile = "/index.html"; //WiFi Connection configuration const char* ssid = "TP-Link_3200"; //Your Wifi SSID const char* password = "9500112137"; //Your wifi password ESP8266WebServer server(80); void handleADC(){ distance = ultrasonic.read(); String adc = String(distance); Serial.print("Cm : "); Serial.println(adc); server.send(200, "text/plane",adc); //sends data to server } void handleRoot(){ server.sendHeader("Location", "/index.html",true); //Redirect to our html web page 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"; for (uint8_t i=0; i

  • IoT Web Server Based LM35 Temperature Gauge

    In this tutorial we will show how to build ESP8266 and interface LM35 Precision Centigrade Temperature sensor with html canvas gauge display. This project uses ESP8266 NodeMCU device that easily connects to existing WiFi network & creates a Web Server. When any connected device accesses this web server, ESP8266 reads in temperature from LM35 Temperature sensors & sends it to the web browser. In this project temperature range reads trimmed from 0°C to 100°C (Actual -55°C to 150°C). Components Required NodeMCU ESP8266 12E Dev Board LM35 sensor Module Circuit Diagram LM35 Precision Centigrade Temperature Sensor The LM35 series are precision integrated-circuit temperature devices with an output voltage linearly proportional to the Centigrade temperature. The LM35 device has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from the output to obtain convenient Centigrade scaling. The LM35 device does not require any external calibration or trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a full −55°C to 150°C temperature range. Lower cost is assured by trimming and calibration at the wafer level. The low-output impedance, linear output, and precise inherent calibration of the LM35 device makes interfacing to readout or control circuitry especially easy. The device is used with single power supplies, or with plus and minus supplies. As the LM35 device draws only 60 μA from the supply, it has very low self-heating of less than 0.1°C in still air. The LM35 device is rated to operate over a −55°C to 150°C temperature range, while the LM35C device is rated for a −40°C to 110°C range (−10° with improved accuracy). The LM35-series devices are available packaged in hermetic TO transistor packages, while the LM35C, LM35CA, and LM35D devices are available in the plastic TO-92 transistor package. The LM35D device is available in an 8-lead surface-mount small-outline package and a plastic TO-220 package. Features • Calibrated Directly in Celsius (Centigrade) • Linear + 10-mV/°C Scale Factor • 0.5°C Ensured Accuracy (at 25°C) • Rated for Full −55°C to 150°C Range • Suitable for Remote Applications • Low-Cost Due to Wafer-Level Trimming • Operates From 4 V to 30 V • Less Than 60-μA Current Drain • Low Self-Heating, 0.08°C in Still Air • Non-Linearity Only ±¼°C Typical • Low-Impedance Output, 0.1 Ω for 1-mA Load Full Range calibration Temperature Sensor Output Voltage Linearity LM35 (LM35DZ) proportional to temperature in Celsius (ºC)10mV/ºC LM335 proportional to temperature in Kelvin (ºK)10mV/ºK LM34 proportional to temperature in Fahrenheit (ºF)10mV/ºF In this project LM35DZ is used to measure temperature range from 0ºC to 100ºC. For example, if the LM35 outputs a voltage of 245 mV, that means we have a temperature value of 24.5ºC. For example2, if the LM35 outputs a voltage of 1000 mV (1V), that means we have a temperature value of 100ºC. NodeMCU NodeMCU ESP8266-12E MCU is a development board with one analogue and many general-purpose input output (GPIO) pins. It has 4MB flash memory, and can operate at a default clock frequency of 80MHz. In this project, analog pin A0 of NodeMCU is used to read analog signal of LM35 Precision Centigrade Temperature Sensor. Analog Reading ESP8266 ADC pins have 10-bit resolution by default. These pins read voltage between 0 and 3.3V and then return a value between 0 and 1023. ESP32 ADC pins have 12-bit resolution by default. These pins read voltage between 0 and 3.3V and then return a value between 0 and 4095 Arduino ADC pins have 10-bit resolution by default. These pins read voltage between 0 and 5V and then return a value between 0 and 1023. Subscribe and Download code. Download code Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address

  • IoT Web Server Based Gauss Meter

    In this tutorial we build a Linear Magnetic Hall sensor to measure magnetic fields using NodeMCU based Web Server. Here to measure the strength of magnetic fields range from 0 to 1 Gauss or 1000 milliGauss. What is the Hall Effect? If electric current flows through a conductor, a magnetic field is employed perpendicular to the current direction. This magnetic field exerts a diagonal force on the moving charge carriers which tends to push them to one side of the conductor. Because there is a potential difference due to the pushed outwards charge carries a measurable voltage between the two sides of the conductor is produced, the so called Hall voltage. This effect is called the Hall Effect after E. H. Hall who discovered it in 1879. The effect is depending on the thickness of the conductor. Therefore the conductor should be very thin. Components Required ESP8266 NodeMCU Dev Board KY-024 - Linear Magnetic Hall sensor Circuit diagram KY-024 - Linear Magnetic Hall sensor A magnetic field is detected by the sensor and will be printed as an analog voltage value. You can control the sensitivity of the sensor with the potentiometer. Digital out: If a magnetic field is detected by the sensor, a signal will be printed here Analog out: Direct measurement of the sensor unit LED1: Shows that the sensor is supplied with voltage LED2: Shows that the sensor detects a magnetic field NodeMCU NodeMCU ESP8266-12E MCU is a development board with one analogue and many general-purpose input output (GPIO) pins. It has 4MB flash memory, and can operate at a default clock frequency of 80MHz. In this project, analog pin A0 of NodeMCU is used to read analog signal of KY-024 Linear Hall sensor. Arduino Code Download code Subscribe and Download code. Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address

  • IoT Web Server Based Sound Pollution Monitor

    In this tutorial we will make a IoT Based Sound decibel Level Monitoring using Nodemcu ESP826612E and KY-037 high Sensitivity Sound Microphone Sensor Detection Module. A sound level meter is used for acoustic (sound that travels through the air) measurements. The best type of microphone for sound level meters is the condenser microphone, which combines precision with stability and reliability. The diaphragm of the microphone responds to changes in air pressure caused by sound waves. That is why the instrument is sometimes referred to as a Sound Pressure Level Meter. Decibel meter are commonly used in noise pollution studies for the quantification of different kinds of noise, especially for industrial, environmental, mining and aircraft noise. The reading from a sound level meter does not correlate well to human-perceived loudness, which is better measured by a loudness meter. Specific loudness is a compressive nonlinearity and varies at certain levels and at certain frequencies. These metrics can also be calculated in a number of different ways. Components Required ESP8266 NodeMCU Dev Board KY-037 - Sound Microphone Sensor Circuit diagram KY-037 Sound Detection Module Sensor for Intelligent Vehicle Compatible With Arduino is a Single channel signal output Sensor. The output is effective to the low-level sound signal with good fidelity, When there is sound, outputs low level and signal light. sound detection module has two outputs: 1. AO, analog output, real-time output voltage signal of the microphone 2. DO, when the sound intensity reaches a certain threshold, the output high and low signal NodeMCU NodeMCU ESP8266-12E MCU is a development board with one analogue and many general-purpose input output (GPIO) pins. It has 4MB flash memory, and can operate at a default clock frequency of 80MHz. In this project, analog pin A0 of NodeMCU is used to read analog signal of Sound sensor. Arduino Code Download code Subscribe and Download code. Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address

  • NodeMCU Based DS18B20 Temperature server

    In this tutorial we will show how to build ESP8266 and interface DS18B20 temperature sensor and LCD display. This project uses ESP8266 NodeMCU device that easily connects to existing WiFi network & creates a Web Server. When any connected device accesses this web server, ESP8266 reads in temperature from DS18B20 Temperature sensors & sends it to the web browser. Circuit diagram Components Required ESP8266 12E DS18B20 with Probe LCD 16X2 with I2C Jumper wire DS18B20 The DS18B20 is a 1-wire programmable Temperature sensor from maxim integrated. It is widely used to measure temperature in hard environments like in chemical solutions, mines or soil etc. The constriction of the sensor is rugged and also can be purchased with a waterproof option making the mounting process easy. It can measure a wide range of temperature from -55°C to +125° with a decent accuracy of ±5°C. Each sensor has a unique address and requires only one pin of the MCU to transfer data so it a very good choice for measuring temperature at multiple points without compromising much of your digital pins on the microcontroller. How to use the DS18B20 Sensor The sensor works with the method of 1-Wire communication. It requires only the data pin connected to the microcontroller with a pull up resistor and the other two pins are used for power as shown below. The pull-up resistor is used to keep the line in high state when the bus is not in use. The temperature value measured by the sensor will be stored in a 2-byte register inside the sensor. This data can be read by the using the 1- wire method by sending in a sequence of data. There are two types of commands that are to be sent to read the values, one is a ROM command and the other is function command. The address value of each ROM memory along with the sequence is given in the datasheet below. You have to read through it to understand how to communicate with the sensor. If you are planning to interface it with Arduino, then you need not worry about all these. You can develop the readily available library and use the in-built functions to access the data. Applications Measuring temperature at hard environments Liquid temperature measurement Applications where temperature has to be measured at multiple points DS18B20 Sensor Specifications Programmable Digital Temperature Sensor Communicates using 1-Wire method Operating voltage: 3V to 5V Temperature Range: -55°C to +125°C Accuracy: ±0.5°C Output Resolution: 9-bit to 12-bit (programmable) Unique 64-bit address enables multiplexing Conversion time: 750ms at 12-bit Programmable alarm options Available as To-92, SOP and even as a waterproof sensor Installing the ESPAsyncWebServer library The ESPAsyncWebServer library is not available to install in the Arduino IDE Library Manager. So, you need to install it manually. Click here to download the https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip library. You should have a .zip folder in your Downloads folder Unzip the .zip folder and you should get ESPAsyncWebServer-master folder Rename your folder from ESPAsyncWebServer-master to ESPAsyncWebServer Move the ESPAsyncWebServer folder to your Arduino IDE installation libraries folder Subscribe and Download code. Installing Libraries for DS18B20 To interface with the DS18B20 temperature sensor, you need to install the One Wire library by Paul Stoffregen and the Dallas Temperature library. Follow the next steps to install those libraries. 1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open. 2. Type “onewire” in the search box and install the OneWire library by Paul Stoffregen. 3. Then, search for “Dallas” and install the Dallas Temperature library by Miles Burton. After installing the libraries, restart your Arduino IDE. Subscribe and Download code. Arduino Code #ifdef ESP32 #include #include #else #include #include #include #include #include #endif #include #include #include LiquidCrystal_I2C lcd(0x27,16,2); // Data wire is connected to GPIO 4 #define ONE_WIRE_BUS 2 // Setup a oneWire instance to communicate with any OneWire devices OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature sensor DallasTemperature sensors(&oneWire); // Replace with your network credentials const char* ssid = "TP-Link_3200"; //YOUR WIFI ssid const char* password = "9500112137"; //YOUR WIFI PASSWORD // Create AsyncWebServer object on port 80 AsyncWebServer server(80); String readDSTemperatureC() { // Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus sensors.requestTemperatures(); float tempC = sensors.getTempCByIndex(0); if(tempC == -127.00) { Serial.println("Failed to read from DS18B20 sensor"); return "--"; } else { Serial.print("Temperature Celsius: "); Serial.println(tempC); lcd.setCursor(0,0); lcd.print(" Celsius: "); lcd.setCursor(11,0); lcd.print(tempC); } return String(tempC); } String readDSTemperatureF() { // Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus sensors.requestTemperatures(); float tempF = sensors.getTempFByIndex(0); if(int(tempF) == -196){ Serial.println("Failed to read from DS18B20 sensor"); return "--"; } else { Serial.print("Temperature Fahrenheit: "); Serial.println(tempF); lcd.setCursor(0,1); lcd.print("Fahrenheit:"); lcd.setCursor(11,1); lcd.print(tempF); } return String(tempF); } const char index_html[] PROGMEM = R"rawliteral( NodeMCU Based DS18B20 WebServer Temperature %TEMPERATUREC% °Celsius Temperature %TEMPERATUREF% °Farenheit )rawliteral"; // Replaces placeholder with DHT values String processor(const String& var){ //Serial.println(var); if(var == "TEMPERATUREC"){ return readDSTemperatureC(); } else if(var == "TEMPERATUREF"){ return readDSTemperatureF(); } return String(); } void setup(){ // Serial port for debugging purposes Serial.begin(115200); Serial.println(); lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); // Start up the DS18B20 library sensors.begin(); // Connect to Wi-Fi WiFi.begin(ssid, password); Serial.println("Connecting to WiFi"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); // Print ESP Local IP Address Serial.println(WiFi.localIP()); // Route for root / web page server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/html", index_html, processor); }); server.on("/temperaturec", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/plain", readDSTemperatureC().c_str()); }); server.on("/temperaturef", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/plain", readDSTemperatureF().c_str()); }); // Start server server.begin(); } void loop(){ } Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address. After That Open web address and Type IP address in address bar and get result.

  • IoT Based RGB LED control

    In this project to learn making of IOT based RGB LED Controller using ESP8266 Webserver with color picker. Circuit diagram Components required ESP826612E RGB LED common cathode LCD 16X2 with I2C Jumper wires RGB LED A RGB LED is commonly used component in electronics, generally, as it is used for indication purpose. You can use RGB LED in various projects like portable flashlight, LED indicator etc. An RGB LED can also be used for work according to condition like for condition 1st Red will glow, for condition 2nd green will glow and for condition 3rd blue will glow. We can use three different LED to perform the same task but this will increase the size of circuit and took more space on PCB or perf board. Pin Configuration Pin No. Pin Name Description 1 R This terminal used for glowing LED in Red color 2 Gnd Common Cathode terminal (Ground) 3 G This terminal used for glowing LED in Green color 4 B This terminal used for glowing LED in Blue color Applications Industrial Application Portable Flashlight/ torchlight Light guides Decorative Lighting LCD backlight Multi-color Light Installing the ESP8266 Arduino Library LiquidCrystal_I2C.h : you need to Download and install the LiquidCrystal_I2C library. In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded. After installing the required libraries, copy the following code to your Arduino IDE. Subscribe and Download code. Subscribe and Download code. Arduino Code #include #include #include #include LiquidCrystal_I2C lcd(0x27,16,2); const char* ssid = "TP-Link_3200"; //Your WIFI SSID const char* password = "9500112137"; //your WIFI Password const int redLED = 14; const int greenLED = 12; const int blueLED = 13; ESP8266WebServer webServer(80); String webpage = "" "" "" "" ""; ////////////////////////////////////////////////////////////////////////////////////////////////// void handleRoot() { // Serial.println("handle root.."); String red = webServer.arg(0); // read RGB arguments String green = webServer.arg(1); String blue = webServer.arg(2); if((red != "") && (green != "") && (blue != "")) { analogWrite(redLED, 1023 - red.toInt()); analogWrite(greenLED, 1023 - green.toInt()); analogWrite(blueLED, 1023 - blue.toInt()); } lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.setCursor(0,0); lcd.print("Red Blue Green"); lcd.setCursor(0,1); lcd.print(red.toInt()); lcd.setCursor(6,1); lcd.print(green.toInt()); lcd.setCursor(12,1); lcd.print(blue.toInt()); webServer.send(200, "text/html", webpage); } void setup() { lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); pinMode(redLED, OUTPUT); pinMode(greenLED, OUTPUT); pinMode(blueLED, OUTPUT); analogWrite(redLED, 0); analogWrite(greenLED, 0); analogWrite(blueLED, 0); delay(1000); Serial.begin(115200); Serial.println(); WiFi.begin(ssid, password); Serial.println(""); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.print("IP address:"); Serial.println(WiFi.localIP()); webServer.on("/", handleRoot); webServer.begin(); testRGB(); } void loop() { //dnsServer.processNextRequest(); webServer.handleClient(); lcd.setCursor(0,0); lcd.print("Red Blue Green"); } void testRGB() { // fade in and out of Red, Green, Blue analogWrite(redLED, 0); // R off analogWrite(greenLED, 0); // G off analogWrite(blueLED, 0); // B off fade(redLED); // R fade(greenLED); // G fade(blueLED); // B } void fade(int pin) { for (int u = 0; u < 1024; u++) { analogWrite(pin, u); delay(1); } for (int u = 0; u < 1024; u++) { analogWrite(pin, 1023 - u); delay(1); } } Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address. After That Open web address and Type IP address in address bar and get result.

  • WebServer Based Youtube channel videos

    In this tutorial , I 'll Publish how to set up a you tube channel videos in web sever using ESP8266 12E. In this tutorial we are making ESP8266 Async Web server with HTML web page. ESP8266 connects to WiFi Network and we get web page in our phone and PC which is connected to same WiFi network. Refer Previous tutorial about elfsight widgets. https://www.dofbot.com/post/esp8266-weather-station-indoor-outdoor Subscribe and Download code. ESP8266 Asynchronous Web Server To build the web server we’ll use the ESPAsyncWebServer library that provides an easy way to build an asynchronous web server. Building an asynchronous web server has several advantages. We recommend taking a quick look at the library documentation on its GitHub page. Installing the ESPAsyncWebServer library The ESPAsyncWebServer library is not available to install in the Arduino IDE Library Manager. So, you need to install it manually. Click here to download the https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip library. You should have a .zip folder in your Downloads folder Unzip the .zip folder and you should get ESPAsyncWebServer-master folder Rename your folder from ESPAsyncWebServer-master to ESPAsyncWebServer Move the ESPAsyncWebServer folder to your Arduino IDE installation libraries folder Installing the ESPAsync TCP Library The ESPAsyncWebServer library requires the ESPAsyncTCP library to work. Follow the next steps to install that library: Click here to download the https://github.com/me-no-dev/ESPAsyncTCP/archive/master.zip library. You should have a .zip folder in your Downloads folder Unzip the .zip folder and you should get ESPAsyncTCP-master folder Rename your folder from ESPAsyncTCP-master to ESPAsyncTCP Move the ESPAsyncTCP folder to your Arduino IDE installation libraries folder After installing the libraries, restart your Arduino IDE. Subscribe and Download code. Subscribe and Download code. Arduino code // Import required libraries #include #include #include #include #include // Replace with your network credentials const char* ssid = "TP-Link_3200"; // Your WIFI SSID const char* password = "9500112137"; //Your WIFI Password // Create AsyncWebServer object on port 80 AsyncWebServer server(80); // Updates DHT readings every 10 seconds const long interval = 10000; const char index_html[] PROGMEM = R"rawliteral( ESP8266 Web Server Subscribe to Dofbot YouTube Channel )rawliteral"; void setup(){ // Serial port for debugging purposes Serial.begin(115200); // Connect to Wi-Fi WiFi.begin(ssid, password); Serial.println("Connecting to WiFi"); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("."); } // Print ESP8266 Local IP Address Serial.println(WiFi.localIP()); // Route for root / web page server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/html", index_html); }); // Start server server.begin(); } void loop(){ unsigned long currentMillis = millis(); } Now, upload the code to your ESP8266. Make sure you have the right board and COM port selected. After uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP8266 reset button. The ESP8266 IP address should be printed in the serial monitor and get result in web page.

  • IoT Cloud Smart Garbage Monitoring System with Email, SMS Notification

    In this tutorial, The Internet of Things (IoT) based garbage Waste Bin level monitoring and LCD Interface. and to build an IoT system using ESP8266 12E, myDevices Cayenne. One of the main concerns with our environment has been solid waste management which impacts the health and environment of our society. The detection, monitoring and management of wastes is one of the primary problems of the present era. The traditional way of manually monitoring the wastes in waste bins is a cumbersome process and utilizes more human effort, time and cost which can easily be avoided with our present technologies. This is our solution, a method in which waste management is automated. This is our IoT Garbage Monitoring system, an innovative way that will help to keep the cities clean and healthy. Follow on to see how you could make an impact to help clean your community, home or even surroundings, taking us a step closer to a better way of living Circuit Diagram Components Required HC SR04- Ultrasonic sensor 16x2.I2c- LCD display ESP8266 12e- nodeMCU HC-SR04 Ultrasonic Sensor - Working As shown above the HC-SR04 Ultrasonic (US) sensor is a 4 pin module, whose pin names are Vcc, Trigger, Echo and Ground respectively. This sensor is a very popular sensor used in many applications where measuring distance or sensing objects are required. The module has two eyes like projects in the front which forms the Ultrasonic transmitter and Receiver. The sensor works with the simple high school formula that Distance = Speed × Time The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air and when it gets objected by any material it gets reflected back toward the sensor this reflected wave is observed by the Ultrasonic receiver module as shown in the picture below Now, to calculate the distance using the above formulae, we should know the Speed and time. Since we are using the Ultrasonic wave we know the universal speed of US wave at room conditions which is 330m/s. The circuitry inbuilt on the module will calculate the time taken for the US wave to come back and turns on the echo pin high for that same particular amount of time, this way we can also know the time taken. Now simply calculate the distance using a microcontroller or microprocessor. How to use the HC-SR04 Ultrasonic Sensor HC-SR04 distance sensor is commonly used with both microcontroller and microprocessor platforms like Arduino, ARM, PIC, Raspberry Pie etc. The following guide is universally since it has to be followed irrespective of the type of computational device used. Power the Sensor using a regulated +5V through the Vcc ad Ground pins of the sensor. The current consumed by the sensor is less than 15mA and hence can be directly powered by the on board 5V pins (If available). The Trigger and the Echo pins are both I/O pins and hence they can be connected to I/O pins of the microcontroller. To start the measurement, the trigger pin has to be made high for 10uS and then turned off. This action will trigger an ultrasonic wave at frequency of 40Hz from the transmitter and the receiver will wait for the wave to return. Once the wave is returned after it getting reflected by any object the Echo pin goes high for a particular amount of time which will be equal to the time taken for the wave to return back to the sensor. The amount of time during which the Echo pin stays high is measured by the MCU/MPU as it gives the information about the time taken for the wave to return back to the Sensor. Using this information the distance is measured as explained in the above heading. Applications Used to avoid and detect obstacles with robots like biped robot, obstacle avoider robot, path finding robot etc. Used to measure the distance within a wide range of 2cm to 400cm Can be used to map the objects surrounding the sensor by rotating it Depth of certain places like wells, pits etc can be measured since the waves can penetrate through water Installing Libraries Download Ultrasonic Library LiquidCrystal_I2C.h : you need to Download and install the LiquidCrystal_I2C library. In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded. After installing the required libraries, copy the following code to your Arduino IDE. Subscribe and Download code. arduino code: #include #include #include LiquidCrystal_I2C lcd(0x27,16,2); #include char ssid[] = "TP-Link_3200"; // your SSID char password[]="9500112137"; // your password // Cayenne authentication info. This should be obtained from the Cayenne Dashboard. char username[] = "2031dd30-5414-11eb-b767-3f1a8f1211ba"; char mqtt_password[] = "f2ce829d98df3a768328ac6936eae9fd47d28289"; char client_id[] = "3cd74400-6dde-11eb-8779-7d56e82df461"; #define MAX_HEIGHT 20 // your bin height int Percentage; UltraSonicDistanceSensor distanceSensor(D5,D6); //D1 trig, D2=ech void setup(void){ Serial.begin(115200); Cayenne.begin(username,mqtt_password,client_id,ssid,password);// starting cayenne delay(1000); lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); } void loop(){ Cayenne.loop(); float actualCM=1*distanceSensor.measureDistanceCm(); // Serial.println(actualCM); Percentage=(MAX_HEIGHT-actualCM)/(MAX_HEIGHT-5)*100 ; Serial.println(Percentage); lcd.clear(); lcd.setCursor(0,0); lcd.print(" IOT Smart BIN "); lcd.setCursor(0,1); lcd.print("Waste Fill:"); lcd.setCursor(11,1); lcd.print(Percentage); lcd.setCursor(13,1); lcd.print(" % "); delay(1000); Cayenne.virtualWrite(1, Percentage); if(Percentage>=100) { lcd.setCursor(11,1); lcd.print("FULL "); delay(1000); } } Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address. Hardware interfacing with Cayenne IoT platform To interface the circuit with the IoT platform, open this link on any browser. Refer previous Tutorial for more details https://www.dofbot.com/post/cayenne-iot-based-weather-monitor

  • NodeMCU Interfaced Capacitive Touch (TTP224)

    In this tutorial to interface the Capacitive Touch buttons module with ESP8266 12E Node MCU and an example we Connect a LCD display. The TTP224 module it has 4 pins for the different outputs, they are digital, and for the power it can be powered by 3.3V or 5V from the Arduino. The module has 4 built-in LEDs, they light up whenever the respective button is touched The TTP224 touch controller is the exact non-contact alternative to traditional button switches. Components Required TTP224 Capacitive Touch Module ESP8266 12E LCD 16X2 with I2c Module TTP224 TTP224 is a four-channel touch detector IC that could be used as a 4-touch key driver. It is a useful interface when replaced with a traditional button key. It has a low power consumption with a wide range of operating voltage. TTP224 has an auto-calibration feature for life and it has a re-calibration period of about 4.0 seconds. The sensitivity can be adjusted using an external capacitor of 0 to 50 pF, 4 input features fewer component counts during the integration in the system. Features and Specification of TTP224 Four-channel touch key sensing 2.5V - 5.5V Operating Voltage Operating current 2.5uA typically in low power mode. Maximum operating current 9.0uA at Fast mode. Response time - 100ms at fast mode and 200ms at low power mode. Adjustable sensitivity using an external capacitor (0-50 pF) Stable touch detection of the human body All output modes can be configurable for high or active low by pad options. Direct mode and Toggle mode selection pin available Auro calibration feature for life. The re-calibration period is about 4.0sec when the key has not been touch. Provides one output pin TPQ0D that has no diode protection circuit inbuilt and it is active low Provides fast mode and low power mode selection by pad optional (LPMB pin). Provides direct mode or toggle mode, CMOS output, or open-drain output. active high or active low by option (TOG/AHLF/OD pin). Circuit Connection TTP224 out1 to out4 Pins are interfaced with D5 through D8 of NodeMCU TTP224 VCC Pin are interfaced with Vin of NodeMCU. TTP224 GND Pin are interfaced with GND of NodeMCU LCD VCC Pin are interfaced with Vin of NodeMCU. LCD GND Pin are interfaced with GND of NodeMCU LCD SCL Pin are interfaced with D1 of NodeMCU. LCD SDA Pin are interfaced with D2 of NodeMCU. Subscribe and Download code. arduino code //WWW.DOFBOT.COM #include LiquidCrystal_I2C lcd(0x27,16,2); void setup() { Serial.begin(9600); // input pins pinMode(14, INPUT); // TTP224 out1 pinMode(12, INPUT); // TTP224 out2 pinMode(13, INPUT); // TTP224 out3 pinMode(15, INPUT); // TTP224 out4 lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.setCursor(0,0); lcd.print(" TTP224 Module "); } void loop() { if(digitalRead(14)){ Serial.println("LED D1 ON"); // Turn the LED ON lcd.setCursor(0,1); lcd.print(" KEY1 Touched "); }else{ Serial.println("LED D1 OFF"); } // button 2 action if(digitalRead(12)){ Serial.println("LED D2 ON"); // Turn the LED ON lcd.setCursor(0,1); lcd.print(" KEY2 Touched "); }else{ Serial.println("LED D2 OFF"); } if(digitalRead(13)){ Serial.println("LED D3 ON"); // Turn the LED ON lcd.setCursor(0,1); lcd.print(" KEY3 Touched "); }else{ Serial.println("LED D3 OFF"); } if(digitalRead(15)){ Serial.println("LED D4 ON"); // Turn the LED ON lcd.setCursor(0,1); lcd.print(" KEY4 Touched "); }else{ Serial.println("LED D4 OFF"); } }

  • NodeMCU Interfaced Knocking Sensor KY-031

    In this project, we will learn about Knock Sensor or Vibration Sensor (sometimes called as Tap Sensor) and how a Knock Sensor works and finally how to Interface a Knock Sensor with NodeMCU 12E and control a Relay. Components Required NodeMCU EsP8266 12E Knock Sensor KY-031 Knock Sensor KY-031 As the name suggests the Knock Sensor Module produces the Digital output on the detection of Knock i.e. vibration stroke. Further, the change in voltage level can be manipulated to produce the desired output and can be used in a variety of applications. Specifications and Features: Detect shocks with the spring and send a signal to Controller Board Operating voltage: 3.3V-5V Digital output Relay 1 channel module This is 1 Channel 5V Relay Board Module For Arduino PIC AVR DSP ARM. A wide range of microcontrollers such as Arduino, AVR, PIC, ARM and so on can control it. Each one needs 15mA - 20mA driver current and Equipped with high current relay: DC 5V / 10A, AC 250V / 10A Standard interface that can be compatible with microcontroller. Specification and Features : 1 channel relay board Operating Voltage 5V Max Current : 20mA Relay Contact Current Capacity at AC250V: 10A Relay Contact Current Capacity at DC5V: 10A One normally closed contact and one normally open contact Triode drive, increasing relay coil High impedance controller pin Pull-down circuit for avoidance of malfunction Power supply indicator lamp Control indicator lamp Indicator for Relay output status Can Be controlled various appliances & other Equipment With Large current. Standard TTL Level logic controlled (AVR, Arduino, 8051, PIC, ARM) The module is compliant with international safety standards, control and load areas isolation trenches; Connections with NodeMCU EsP8266 12E: Sensor signal S Pin are connected to D5 Pin of NodeMCU Sensor + Pin are connected to Vin Pin of NodeMCU Sensor - Pin are connected to Gnd Pin of NodeMCU Relay + Pin are connected to 3.3V Pin of NodeMCU Relay - Pin are connected to Gnd Pin of NodeMCU Relay IN Pin are connected to D6 Pin of NodeMCU Subscribe and Download code. Arduino Code const int TapSensorPin = D5; // the pin that the pushbutton is attached to const int RelayPin = D6; // the pin that the LED is attached to // Variables will change: int buttonPushCounter = 0; // counter for the number of button presses int buttonState = 0; // current state of the button int lastButtonState = 0; // previous state of the button int val = 0; void setup() { Serial.begin(9600); pinMode(TapSensorPin, INPUT); // initialize the LED as an output: pinMode(RelayPin, OUTPUT); // initialize serial communication: } void loop() { // read the pushbutton input pin: val = digitalRead(RelayPin); // read the input pin digitalWrite(RelayPin, val); // sets the LED to the button's value buttonState = digitalRead(TapSensorPin); buttonState = digitalRead(TapSensorPin); // compare the buttonState to its previous state if (buttonState != lastButtonState) { // if the state has changed, increment the counter if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: buttonPushCounter++; Serial.println("ON"); Serial.print("number of button pushes: "); Serial.println(buttonPushCounter); Serial.println(val); delay(100); } else { // if the current state is LOW then the button Serial.println("OFF"); Serial.println(val); delay(100); } } // save the current state as the last state, //for next time through the loop lastButtonState = buttonState; if (buttonPushCounter % 5 == 0) { // change 5 to your desired (Knock)knocking counter to Relay on digitalWrite(RelayPin, HIGH); } else { digitalWrite(RelayPin, LOW); } }

bottom of page