oled – Blog eTechPath https://blog.etechpath.com Sun, 23 Apr 2023 21:03:56 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.4 https://blog.etechpath.com/wp-content/uploads/2017/08/BrandLogo12-150x150.png oled – Blog eTechPath https://blog.etechpath.com 32 32 DIY Weighing Scale using HX711, OLED i2c display and ESP8266 NodeMCU with Zero Calibration Function https://blog.etechpath.com/diy-weighing-scale-using-hx711-oled-i2c-display-and-esp8266-nodemcu-with-zero-calibration-function/ https://blog.etechpath.com/diy-weighing-scale-using-hx711-oled-i2c-display-and-esp8266-nodemcu-with-zero-calibration-function/#respond Sun, 23 Apr 2023 21:03:26 +0000 https://blog.etechpath.com/?p=1254 Introduction:

In this tutorial you will learn how to interface HX711 loadcell amplifier module with ESP8266 NodeMCU board and getting output on i2c OLED display. Also, we will learn how to add zero push button function to adjust scale offset.

Loadcell:

Load cell is a sensor which converts mechanical force into electronic signal. Where the mechanical force can be tension, pressure, compression or torque. There are many types of load cells are available in the market which can be used as per required application. In this example we are going to use strain gauge load cell for converting mechanical force into electrical signal.

Loadcell consist of several resistive strain gauge sensor elements which changes its resistance when the load is applied and gives output in milli volts when input or excitation voltage is applied to it.
This milli volt output is then amplified to voltage signal to make it compatible with controllers to read and convert to load units.

Things You Will Need:

  • ESP8266 NodeMCU
  • HX711 Amplifier Board
  • 10kg Loadcell
  • i2c OLED Display
  • Connecting Cables

Circuit Diagram:

Code:

Example 1: ln this example we will use Arduino IDE serial monitor window to get output values from the loadcell.

/**
 *
 * Interfacing 10kg loadcell and HX711 amplifier board with ESP8266 NodeMCU
 * Author: Pranay Sawarkar
 * Website: www.eTechPath.com
 * Link: https://blog.etechpath.com/diy-weighing-scale-using-hx711-oled-i2c-display-and-esp8266-nodemcu-with-zero-calibration-function/
 * 
 *
**/

#include <Arduino.h>
#include "HX711.h"

// HX711 circuit wiring
const int Dout_Pin = 14;
const int SCK_Pin = 12;
const int pb1 = 13;            //push button input 
int tarepb = 0;
int newread = 0;
#define CalFactor 235.5    //enter your calibration factor here

HX711 scale;

void setup() {
  Serial.begin(115200);
  scale.begin(Dout_Pin, SCK_Pin);
  pinMode(pb1, INPUT_PULLUP);
  
  Serial.println("Initialization..."); 
  
  scale.set_scale(CalFactor);
  scale.tare();
  delay (200);
  Serial.println("Ready");
  delay (100);
}

void loop() {
  
  tarepb = digitalRead(pb1);
  delay(10);
  if (tarepb == LOW) 
  {
    scale.tare();
    Serial.println("TareDONE");
  }
  else
  { 
  newread = scale.get_units(5);
  Serial.println("Weight: ");
  Serial.println(newread);
  delay(10);
   }
}

Circuit Diagram:

Example 2: In this example we will interface oled display with the existing circuit and print loadcell output values on display.

/**
 *
 * DIY Weighing Scale using HX711, OLED i2c display and ESP8266 NodeMCU with Zero Calibration Function
 * Author: Pranay Sawarkar
 * Website: www.eTechPath.com
 * Link: https://blog.etechpath.com/diy-weighing-scale-using-hx711-oled-i2c-display-and-esp8266-nodemcu-with-zero-calibration-function/
 * 
 *
**/

#include <Arduino.h>
#include <U8g2lib.h>
#include "HX711.h"

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

//select your oled display size
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

// HX711 circuit wiring
const int Dout_Pin = 14;
const int SCK_Pin = 12;
const int pb1 = 13;
//const int pb2 = 5;
int tarepb = 0;
int newread = 0;
#define CalFactor 235.5

//235.5


HX711 scale;

void setup() {
  Serial.begin(115200);
  u8g2.begin();
  scale.begin(Dout_Pin, SCK_Pin);
  pinMode(pb1, INPUT_PULLUP);
  
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_6x10_tf);
  u8g2.drawStr(0, 20, "Initializing...");
  u8g2.sendBuffer();
  
  scale.set_scale(CalFactor);
  scale.tare();
  delay (500);
  u8g2.clearBuffer();
  u8g2.drawStr(0, 20, "Ready");
  u8g2.sendBuffer();
  delay (100);
 
}

void loop() {
  
  tarepb = digitalRead(pb1);
  delay(10);
  if (tarepb == LOW) 
  {
    scale.tare();
    u8g2.clearBuffer();
    u8g2.drawStr(0, 20, "Tare Done");
    Serial.println("TareDONE");
    u8g2.sendBuffer();
  }
  else
  {
  
  newread = scale.get_units(5);
  Serial.println(newread);
  delay(10);

      u8g2.clearBuffer();
      u8g2.setFont(u8g2_font_6x10_tf);
      u8g2.drawStr(0, 20, "Weight: ");
      u8g2.setCursor(45, 20);
      u8g2.print(newread);
      u8g2.sendBuffer();
      delay(10);
    
   }
}

Prototype:

]]>
https://blog.etechpath.com/diy-weighing-scale-using-hx711-oled-i2c-display-and-esp8266-nodemcu-with-zero-calibration-function/feed/ 0
DIY OLED Weighing Scale using 10kg Loadcell with HX711 and Arduino Uno https://blog.etechpath.com/diy-oled-weighing-scale-using-10kg-loadcell-with-hx711-and-arduino-uno/ https://blog.etechpath.com/diy-oled-weighing-scale-using-10kg-loadcell-with-hx711-and-arduino-uno/#respond Fri, 21 Apr 2023 13:00:06 +0000 https://blog.etechpath.com/?p=1240 Introduction:

In this tutorial you will learn how to interface HX711 loadcell amplifier board with Arduino uno and getting output on i2c oled display. Also, we will learn how to add calibration push button to zeroing the scale.

Loadcell:

Load cell is a sensor which converts mechanical force into electronic signal. Where the mechanical force can be tension, pressure, compression or torque. There are many types of load cells are available in the market which can be used as per required application. In this example we are going to use strain gauge load cell for converting mechanical force into electrical signal.

Loadcell consist of several resistive strain gauge sensor elements which changes its resistance when the load is applied and gives output in milli volts when input or excitation voltage is applied to it.
This milli volt output is then amplified to voltage signal to make it compatible with controllers to read and convert to load units.

Things You Will Need:

  • Arduino Uno
  • 10kg Loadcell
  • HX711 ADC amplifier board
  • i2c OLED display

Circuit Diagram:

Code:

Example 1: In this example we will use arduino serial window to get output values from the loadcell.

/**
 *
 * Interfacing 10kg loadcell and HX711 amplifier board with Arduino Uno
 * Author: Pranay Sawarkar
 * Website: www.eTechPath.com
 * Link: https://blog.etechpath.com/diy-oled-weighing-scale-using-10kg-loadcell-with-hx711-and-arduino-uno/
 * 
 *
**/

#include <Arduino.h>
#include "HX711.h"

// HX711 circuit wiring
const int Dout_Pin = 2;
const int SCK_Pin = 3;
const int pb1 = 4;
int tarepb = 0;
int newread = 0;
#define CalFactor 235.5    //enter your calibration factor here

HX711 scale;

void setup() {
  Serial.begin(115200);
  scale.begin(Dout_Pin, SCK_Pin);
  pinMode(pb1, INPUT_PULLUP);
  
  Serial.println("Initialization..."); 
  
  scale.set_scale(CalFactor);
  scale.tare();
  delay (200);
  Serial.println("Ready");
  delay (100);
}

void loop() {
  
  tarepb = digitalRead(pb1);
  delay(10);
  if (tarepb == LOW) 
  {
    scale.tare();
    Serial.println("TareDONE");
  }
  else
  { 
  newread = scale.get_units(5);
  Serial.println("Weight: ");
  Serial.println(newread);
  delay(10);
   }
}

Circuit Diagram:

Example 2: In this example we will interface oled display with the existing circuit and print loadcell output values on it.

/**
 *
 * DIY Weighing scale using 10kg loadcell and HX711 amplifier board with Arduino Uno and OLED display
 * Author: Pranay Sawarkar
 * Website: www.eTechPath.com
 * Link: https://blog.etechpath.com/diy-oled-weighing-scale-using-10kg-loadcell-with-hx711-and-arduino-uno/
 * 
 *
**/

#include <Arduino.h>
#include <U8g2lib.h>
#include "HX711.h"

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

//select your oled display type and size
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

// HX711 circuit wiring
const int Dout_Pin = 2;
const int SCK_Pin = 3;
const int pb1 = 4;
int tarepb = 0;
int newread = 0;
#define CalFactor 235.5   //enter your calibration factor here

HX711 scale;

void setup() {
  Serial.begin(115200);
  u8g2.begin();
  scale.begin(Dout_Pin, SCK_Pin);
  pinMode(pb1, INPUT_PULLUP);
  
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_6x10_tf);
  u8g2.drawStr(0, 20, "Initializing...");
  u8g2.sendBuffer();
  
  scale.set_scale(CalFactor);
  scale.tare();
  delay (500);
  u8g2.clearBuffer();
  u8g2.drawStr(0, 20, "Ready");
  u8g2.sendBuffer();
  delay (100);
 
}

void loop() {
  
  tarepb = digitalRead(pb1);
  delay(10);
  if (tarepb == LOW) 
  {
    scale.tare();
    u8g2.clearBuffer();
    u8g2.drawStr(0, 20, "Tare Done");
    Serial.println("TareDONE");
    u8g2.sendBuffer();
  }
  else
  {
  
  newread = scale.get_units(5);
  Serial.println(newread);
  delay(10);

      u8g2.clearBuffer();
      u8g2.setFont(u8g2_font_6x10_tf);
      u8g2.drawStr(0, 20, "Weight: ");
      u8g2.setCursor(45, 20);
      u8g2.print(newread);
      u8g2.sendBuffer();
      delay(10);
    
   }
}

Prototype:

]]>
https://blog.etechpath.com/diy-oled-weighing-scale-using-10kg-loadcell-with-hx711-and-arduino-uno/feed/ 0
Interfacing MPX5010DP Pressure Sensor with Arduino https://blog.etechpath.com/interfacing-mpx5010dp-pressure-sensor-with-arduino/ https://blog.etechpath.com/interfacing-mpx5010dp-pressure-sensor-with-arduino/#respond Sat, 08 Apr 2023 19:38:36 +0000 https://blog.etechpath.com/?p=1209 Introduction:

In this tutorial we will learn how to interface a MPX5010 pressure sensor with Arduino uno using onboard analog input pin A1 and generate output of sensor on serial monitor for testing then in second example we will print the sensor output on i2c OLED display using u8g2 monochrome graphics library.

MPX5010 Pressure Sensor:

  • Working voltage: 4.75v – 5.25v
  • Working pressure: 0 – 10 kPa
  • Current: 10mA max
  • Working Temperature: -40°C-125°C (0-85°C).
  • Output: 0.2vdc to 4.7vdc

MPX5010 Sensor Output Calculation and Chart:

Things you will need:

  • Arduino Uno or any Arduino board with a spare analog input.
  • MPX5010 pressure sensor.
  • SSD1306 i2c OLED display.

Circuit Diagram:

Example Code 1:

/*
 Project: Interfacing MPX5010DP with Arduino Uno.
 Project Link: 
 Website: www.etechpath.com
 Author: Pranay Sawarkar
*/

#include <Arduino.h>


void setup() {
  // initialize serial communication at 9600 bps
  Serial.begin(9600);
}

void loop() {
  // read the sensor input on analog pin 1
  int sensorValue = analogRead(A1);
  // Convert the analog reading of A1 from 0-1023 to a voltage 0-5V
  float voltage = sensorValue * (5.0 / 1023.0);
  float outputkPa = fmap(voltage, 0.2, 4.7, 0, 10);
  float outputmmH2O = fmap(voltage, 0.2, 4.7, 0, 1019.78);
  // print out the values on serial monitor
  Serial.print("Volt: ");
  Serial.println(voltage);
  Serial.print("kPa: ");
  Serial.println(outputkPa);
  Serial.print("mmH2O: ");
  Serial.println(outputmmH2O);
  Serial.println();
  delay(200);
}

float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Example Code 1 Output:

Installing Required Library:

  • Goto Sketch -> Include Library -> Manage Libraries (or Shortcut Cntl+Shift+I)
  • Search u8g2 in search bar
  • Select library U8g2 by Oliver
  • Select latest version from dropdown menu and install. (For this project we are using version 2.31.2)

Example Code 2:

/*
 Project: Interfacing MPX5010DP with Arduino Uno and OLED i2c display.
 Project Link: 
 Website: www.etechpath.com
 Author: Pranay Sawarkar
*/

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

//select your oled display size
//U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup() {
  // initialize serial communication at 9600 bits per second
  Serial.begin(9600);
  u8g2.begin();
}

void loop() {
  // read the sensor input on analog pin 1
  u8g2.clearBuffer();
  int sensorValue = analogRead(A1);
  // Convert the analog reading of A1 from 0-1023 to a voltage 0-5V
  float voltage = sensorValue * (5.0 / 1023.0);
  float outputkPa = fmap(voltage, 0.2, 4.7, 0, 10);
  //float outputmmH2O = fmap(voltage, 0.2, 4.7, 0, 1019.78);
  delay(50);
  u8g2.setFont(u8g2_font_6x10_tf);
  u8g2.drawStr(0, 10, "volt:");
  u8g2.setCursor(35, 10);
  u8g2.print(voltage);
  Serial.print("Volt: ");
  Serial.println(voltage);
  u8g2.drawStr(0, 22, "kPa:");
  u8g2.setCursor(35, 22);
  u8g2.print(outputkPa);
  Serial.print("kPa: ");
  Serial.println(outputkPa);
  u8g2.sendBuffer();
  delay(50);
  
}

float fmap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Example Code 2 Output:

]]>
https://blog.etechpath.com/interfacing-mpx5010dp-pressure-sensor-with-arduino/feed/ 0
Crypto Currency Ticker Using Esp8266 and OLED display https://blog.etechpath.com/crypto-currency-ticker-using-esp8266-and-oled-display/ https://blog.etechpath.com/crypto-currency-ticker-using-esp8266-and-oled-display/#respond Thu, 13 Jan 2022 12:35:17 +0000 https://blog.etechpath.com/?p=888 Introduction:

Ticker is basically a display which connects with your local WiFi router or access-point and fetch online crypto currency data from api and displays on its screen. In this ticker we are going to use esp8266 nodeMCU and 0.98” OLED display for demonstration.

Things you will need:

  • Node MCU or any ESP8266
  • 0.98 inch OLED display
  • Lipo battery
  • 100k resistors
  • TP4056 module
  • USB to serial programmer in case of standalone Esp8266
  • Arduino IDE – Software
  • Breadboard and connection cables

Circuit Diagram:

Crypto-Ticker-Circuit-Diagram

Code:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Wire.h>
#include <U8g2lib.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

const char* ssid     = "username";
const char* password = "password";

int analogInPin  = A0;    
int sensorValue;   
float calibration = 0.36; 
int bat_percentage;

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "0.in.pool.ntp.org", 5.5*3600, 60000);

#define CG_URL "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cethereum%2Cdogecoin%2Cshiba-inu%2Cpolkadot&vs_currencies=inr%2Cusd&include_last_updated_at=true&include_24hr_change=true"
const char *fingerprint  = "33 C5 7B 69 E6 3B 76 5C 39 3D F1 19 3B 17 68 B8 1B 0A 1F D9";

String payload = "{}";

void setup()
{
  Serial.begin(115200);
  Serial.setDebugOutput(false);
  delay(10);

  u8g2.begin();
  u8g2.enableUTF8Print();

  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_helvB08_tf);

  u8g2.setCursor(1, 15);
  u8g2.print("Connecting to WiFi ");
  u8g2.setCursor(1, 25);
  u8g2.sendBuffer();

  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
    u8g2.print(".");
    u8g2.sendBuffer();
  }
  timeClient.begin();

 Serial.println("");
 Serial.println("WiFi connected");
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());
 u8g2.setCursor(1, 45);
    u8g2.print("Connected to ");
    u8g2.print(ssid);
    u8g2.setCursor(1, 55);
    u8g2.print("IP Address ");
    u8g2.print(WiFi.localIP());
    u8g2.sendBuffer();
    delay(5000);
}

void loop()
{ 
  if (WiFi.status() == WL_CONNECTED)
  {  
    WiFiClientSecure client;
    client.setFingerprint(fingerprint);
    HTTPClient http; 
    delay(200);

    while (!timeClient.update()) {
      timeClient.forceUpdate();
    }
    Serial.println();
    Serial.print("Time     - ");
    Serial.println(timeClient.getFormattedTime());
    
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_helvB18_tf);
    u8g2.setCursor(23, 40);
    u8g2.print(timeClient.getFormattedTime());
    u8g2.drawFrame(110,1,13,6);
    u8g2.drawFrame(123,3,1,2);
    u8g2.drawBox(111,2,bat_percentage,4);
    u8g2.sendBuffer();
    delay (1000);
    
    sensorValue = analogRead(analogInPin);
    float voltage = (((sensorValue * 3.3) / 1024) * 2 + calibration); //multiply by two as voltage divider network is 100K & 100K Resistor

    bat_percentage = mapfloat(voltage, 2.8, 4.2, 0, 11); //2.8V as Battery Cut off Voltage & 4.2V as Maximum Voltage
 
  if (bat_percentage >= 11)
  {
    bat_percentage = 11;
  }
  if (bat_percentage <= 0)
  {
    bat_percentage = 1;
  }
  Serial.print("Analog Value = ");
  Serial.print(sensorValue);
  Serial.print("\t Output Voltage = ");
  Serial.print(voltage);
  Serial.print("\t Battery Percentage = ");
  Serial.println(bat_percentage);
  delay(1000);
  delay (20);
  
    payload = "{}";

    http.begin(client, CG_URL);
    Serial.println();
    Serial.print("Coingecko URL - ");
    Serial.println(CG_URL);

    int httpCode = http.GET();
    
    if (httpCode > 0) { 
      payload = http.getString();
      DynamicJsonDocument doc(800);
      DeserializationError error = deserializeJson(doc, payload);
      if (error) 
      {
        Serial.print(F("deserializeJson() failed: "));
        Serial.println(error.f_str());
        delay(5000);
        return;
      }
     JsonObject bitcoin = doc["bitcoin"];
      double bitcoin_inr = bitcoin["inr"]; 
      double bitcoin_usd_24h_change = bitcoin["usd_24h_change"]; 
      double bitcoin_usd = bitcoin["usd"]; 
     
      JsonObject ethereum = doc["ethereum"];
      double ethereum_inr = ethereum["inr"];
      double ethereum_usd_24h_change = ethereum["usd_24h_change"]; 
      double ethereum_usd = ethereum["usd"]; 
      
      JsonObject dogecoin = doc["dogecoin"];
      double dogecoin_inr = dogecoin["inr"];
      double dogecoin_usd = dogecoin["usd"];
      double dogecoin_usd_24h_change = dogecoin["usd_24h_change"]; 
      long dogecoin_last_updated_at = dogecoin["last_updated_at"]; 

      JsonObject shibainu = doc["shiba-inu"];
      double shibainu_inr = shibainu["inr"]; 
      double shibainu_usd_24h_change = shibainu["usd_24h_change"]; 
      double shibainu_usd = shibainu["usd"]; 

      JsonObject polkadot = doc["polkadot"];
      double polkadot_inr = polkadot["inr"];
      double polkadot_usd_24h_change = polkadot["usd_24h_change"]; 
      double polkadot_usd = polkadot["usd"]; 

      // Edit below your coin holdings here
     double holdings_ethereum  =  0.555;
      double holdings_bitcoin  =  0;
      double holdings_dogecoin =  0.5443;
      double holdings_polkadot    =  0.0324;
      double holdings_shibainu   =  4800000;

      Serial.print("Bitcoin  - $");
      Serial.print("   $");
      Serial.print(bitcoin_usd);
      Serial.println();
      Serial.print("Ethereum  - $");
      Serial.print("   $");
      Serial.print(ethereum_usd);
      Serial.println();
      Serial.print("Dogecoin  - $");
      Serial.print("   $");
      Serial.print(dogecoin_usd);
      Serial.println();
      Serial.print("Polkadot  - $");
      Serial.print("   $");
      Serial.print(polkadot_usd);
      Serial.println();
      Serial.print("shibainu  - $");
      Serial.print("   $");
      Serial.print(shibainu_usd);
      Serial.println();

      double holdings =
        (ethereum_usd   * holdings_ethereum) +
        (bitcoin_usd   * holdings_bitcoin) +
        (dogecoin_usd  * holdings_dogecoin) +
        (polkadot_usd * holdings_polkadot) +
        (shibainu_usd    * holdings_shibainu);

      Serial.println(holdings);
      Serial.println();
      Serial.println();
      Serial.println();
      Serial.println();
  
      draw("BITCOIN - BTC",    bitcoin_usd,   2,  bitcoin_usd_24h_change,   "$");
      draw("ETHEREUM - ETH",   ethereum_usd,  2,  ethereum_usd_24h_change,  "$");
      draw("SHIBA-INU - SHIB", shibainu_usd, 6,  shibainu_usd_24h_change, "$");
      draw("DOGECOIN - DOGE", dogecoin_usd, 4,  dogecoin_usd_24h_change, "$");
      draw("POLKADOT - DOT",     polkadot_usd,  2,  polkadot_usd_24h_change,    "$");
      draw("HOLDINGS  ",       holdings,      0,  0,                        "$");
    }
    http.end();  
  }
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void drawScrollString(int16_t offset, const char *s)
{
  static char buf[36];  // should for screen with up to 256 pixel width
  size_t len;
  size_t char_offset = 0;
  u8g2_uint_t dx = 0;
  size_t visible = 0;
  len = strlen(s);
  if ( offset < 0 )
  {
    char_offset = (-offset) / 8;
    dx = offset + char_offset * 8;
    if ( char_offset >= u8g2.getDisplayWidth() / 8 )
      return;
    visible = u8g2.getDisplayWidth() / 8 - char_offset + 1;
    strncpy(buf, s, visible);
    buf[visible] = '\0';
    u8g2.setFont(u8g2_font_8x13_mf);
    u8g2.drawStr(char_offset * 8 - dx, 62, buf);
  }
  else
  {
    char_offset = offset / 8;
    if ( char_offset >= len )
      return; // nothing visible
    dx = offset - char_offset * 8;
    visible = len - char_offset;
    if ( visible > u8g2.getDisplayWidth() / 8 + 1 )
      visible = u8g2.getDisplayWidth() / 8 + 1;
    strncpy(buf, s + char_offset, visible);
    buf[visible] = '\0';
    u8g2.setFont(u8g2_font_8x13_mf);
    u8g2.drawStr(-dx, 62, buf);
  }
}
void draw(char *s, double coinprice, int prec, double change, String currency)
{
  int16_t offset = -(int16_t)u8g2.getDisplayWidth();
  int16_t len = strlen(s);

  char pricelen[10];
  dtostrf(coinprice, 4, prec, pricelen);
  int xPos = 64 - (((strlen(pricelen)) * 11) / 2);

  for (;;)
  {
    u8g2.clearBuffer();
    u8g2.setFont(u8g2_font_helvB18_tf);
    u8g2.setCursor(xPos - 11, 30);
    u8g2.print(currency);
    u8g2.print(coinprice, prec);

    if (change != 0) {
      u8g2.setFont(u8g2_font_helvB10_tf);
      u8g2.setCursor(38, 47);
      if (change > 0) {
        u8g2.print("+");
      }
      u8g2.print(change, 2);
      u8g2.print("%");
    }

    drawScrollString(offset, s);
     u8g2.drawFrame(110,1,13,6);
    u8g2.drawFrame(123,3,1,2);
    u8g2.drawBox(111,2,bat_percentage,4);
    u8g2.sendBuffer();
    delay(10);
    offset += 2;
    if ( offset > len * 8 + 1 )
      break;
  }
}

Code Explanation:

Edit your router WiFi username and password here

const char* ssid     = "username";
const char* password = "password";

Replace bellow line with your OLED model from u8g2 library if needed

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

Calibration factor need to be adjusted as per resistors value and final output in below line

int analogInPin  = A0;    
int sensorValue;   
float calibration = 0.36; 
int bat_percentage;

Replace multiplication factor value for ntp client as per your local time zone. (GMT+5.5 is for India time)

NTPClient timeClient(ntpUDP, "0.in.pool.ntp.org", 5.5*3600, 60000);

You can change ticker Crypto currencies as per your choice in bellow URL link

#define CG_URL "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cethereum%2Cdogecoin%2Cshiba-inu%2Cpolkadot&vs_currencies=inr%2Cusd&include_last_updated_at=true&include_24hr_change=true"

If your ticker is not working, do check if this is updated fingerprint for coingencko.com. Or you can get updated fingerprint from GRC | SSL TLS HTTPS Web Server Certificate Fingerprints .

const char *fingerprint  = "33 C5 7B 69 E6 3B 76 5C 39 3D F1 19 3B 17 68 B8 1B 0A 1F D9";

Edit your crypt holdings here to get total holdings on crypto-ticker screen.

      double holdings_ethereum  =  0.555;
      double holdings_bitcoin  =  0;
      double holdings_dogecoin =  0.5443;
      double holdings_polkadot    =  0.0324;
      double holdings_shibainu   =  4800000;

Prototype :

.

Downloads:

Video:

]]>
https://blog.etechpath.com/crypto-currency-ticker-using-esp8266-and-oled-display/feed/ 0
Mini GPS Display using Ublox neo-6m module and ESP8266 nodemcu https://blog.etechpath.com/mini-gps-display-using-ublox-neo-6m-module-and-esp8266-nodemcu/ https://blog.etechpath.com/mini-gps-display-using-ublox-neo-6m-module-and-esp8266-nodemcu/#respond Fri, 30 Nov 2018 07:42:12 +0000 https://blog.etechpath.com/?p=681


About:

In this project we will learn how to interface GPS module with esp8266 as main controller to show GPS data on OLED display. We will read and display various elements from GPS like Speed, Clock, Date, Location, Altitude, Trip distance, Number of connected satellites, Cardinals (moving direction), etc. We can use this project in cars or other moving vehicles.

In next update I am planning to build a web-server using esp8266 to receive data from GPS in smart phones and generate geographical location on online 2D maps using longitude and latitude.



Components:

  • ESP8266 NodeMCU board
  • Ublox neo-6m GPS module
  • OLED i2c display 128x64px
  • Momentary push buttons – 2Nos
  • Software : Arduino IDE




Circuit Diagram:

GPS display Project



Code:

/*
 * Project: Mini GPS Display using Ublox neo-6m and ESP8266
 * Author: Pranay SS, eTechPath
 * Website: www.etechpath.com
 * Tutorial Link: 
   
Mini GPS Display using Ublox neo-6m module and ESP8266 nodemcu
* Video Link: https://youtu.be/ExPBmiz1cj0 * */ #include <Arduino.h> #include <U8g2lib.h> #ifdef U8X8_HAVE_HW_SPI #include <SPI.h> #endif #ifdef U8X8_HAVE_HW_I2C #include <Wire.h> #endif #define menu D3 #define enter D4 int key = 0; double Home_LAT = 0; double Home_LNG = 0; //sat20x20px logo U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); static const unsigned char u8g_logo_sat[] U8X8_PROGMEM = { 0x00, 0x01, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x06, 0x00, 0x60, 0x30, 0x00, 0x60, 0x78, 0x00, 0xc0, 0xfc, 0x00, 0x00, 0xfe, 0x01, 0x00, 0xff, 0x01, 0x80, 0xff, 0x00, 0xc0, 0x7f, 0x06, 0xc0, 0x3f, 0x06, 0x80, 0x1f, 0x0c, 0x80, 0x4f, 0x06, 0x19, 0xc6, 0x03, 0x1b, 0x80, 0x01, 0x73, 0x00, 0x00, 0x66, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x70, 0x00, 0x00 }; //wave10px logo static const unsigned char u8g2_logo_wave[] U8X8_PROGMEM ={ 0xE0, 0x03, 0x18, 0x00, 0xC4, 0x01, 0x32, 0x00, 0x8A, 0x01, 0x69, 0x00, 0x25, 0x00, 0x95, 0x01, 0x95, 0x01, 0x01, 0x00, }; //sat40x35px logo // The serial connection to the GPS device #include <SoftwareSerial.h> static const int RXPin = D5, TXPin = D6; static const uint32_t GPSBaud = 9600; SoftwareSerial ss(RXPin, TXPin); //GPS Library #include <TinyGPS++.h> TinyGPSPlus gps; //Program variables double Lat; double Long; double Alt; int day, month, year; //int hour, minute, second; int num_sat, gps_speed; String heading; //SETUP void setup() { pinMode(menu, INPUT_PULLUP); pinMode(enter, INPUT_PULLUP); ss.begin(GPSBaud); u8g2.begin(); //PrintingLoadingPage u8g2.firstPage(); do { print_page1(); } while ( u8g2.nextPage() ); delay(5000); }//END SETUP //LOOP void loop() { Get_GPS(); //Get GPS data if (digitalRead(menu) == LOW) key = (key+1); //else if (digitalRead(menu) == LOW) //key = (key-1); if (key<0 or key>3) key = 0; switch (key) { case 0: u8g2.firstPage(); do { print_Clock(); } while ( u8g2.nextPage() ); delay(10); break; case 1: u8g2.firstPage(); do { print_speed(); } while ( u8g2.nextPage() ); delay(10); break; case 2: u8g2.firstPage(); do { print_location(); } while ( u8g2.nextPage() ); delay(10); break; case 3: u8g2.firstPage(); do { print_Trip(); if (digitalRead(enter) == LOW) { Home_LAT = gps.location.lat(); Home_LNG = gps.location.lng(); } else { u8g2.setFont(u8g2_font_courR08_tr); u8g2.setCursor(0, 64); u8g2.print("Press Enter to reset"); } } while ( u8g2.nextPage() ); delay(10); break; } } //end of loop void print_page1() { u8g2.drawXBMP(0, 0, 20, 20, u8g_logo_sat); u8g2.setFont( u8g2_font_crox1cb_tf); //u8g2.setFont(u8g2_font_helvB12_tf); //u8g2.setFont(u8g2_font_timB12_tf); u8g2.setCursor(45, 20); u8g2.print("MINI GPS"); //u8g2.setFont(u8g2_font_7x13B_tf); u8g2.setFont(u8g2_font_nine_by_five_nbp_tf); u8g2.setCursor(55, 35); u8g2.print("by eTechPath"); u8g2.setFont(u8g2_font_nine_by_five_nbp_tf); u8g2.setCursor(0, 60); u8g2.print("Loading"); u8g2.setFont(u8g2_font_glasstown_nbp_tf); u8g2.setCursor(40, 60); u8g2.print(" . . . . . "); } void print_Clock() { u8g2.setFont(u8g2_font_courB08_tn); u8g2.setCursor(105, 64); u8g2.print( num_sat, 5); u8g2.drawXBMP(118, 54, 10, 10, u8g2_logo_wave); u8g2.setFont(u8g2_font_crox1cb_tf); u8g2.setCursor(20, 10); u8g2.print("GPS CLOCK"); u8g2.drawLine(0,12,128,12); u8g2.setFont(u8g2_font_t0_22b_tn); u8g2.setCursor(20, 42); printTime(gps.time); // u8g.print(gps.date); //Get_Date(); u8g2.setFont(u8g2_font_nine_by_five_nbp_tf); u8g2.setCursor(0, 64); printDate(gps.date); } void print_speed() { u8g2.setFont(u8g2_font_crox1cb_tf); u8g2.setCursor(16, 10); u8g2.print("Speedometer"); u8g2.drawLine(0,15,128,15); u8g2.setFont(u8g2_font_t0_22b_tn); u8g2.setCursor(5, 42); u8g2.print(gps_speed , DEC); u8g2.setFont(u8g2_font_glasstown_nbp_tf); u8g2.setCursor(62, 42); u8g2.print("km/h"); u8g2.setFont(u8g2_font_courB08_tn); u8g2.setCursor(105, 64); u8g2.print( num_sat, 5); u8g2.drawXBMP(118, 54, 10, 10, u8g2_logo_wave); u8g2.setFont(u8g2_font_glasstown_nbp_tf); u8g2.setCursor(0,64); u8g2.print("Direction:"); u8g2.setCursor(45,64); u8g2.print( heading); } void print_location() { u8g2.setFont(u8g2_font_crox1cb_tf); u8g2.setCursor(10, 10); u8g2.print("GPS Location"); u8g2.drawLine(0,12,128,12); u8g2.setFont(u8g2_font_nine_by_five_nbp_tf); u8g2.setCursor(5, 28); u8g2.print("Long: "); u8g2.setCursor(40, 28); u8g2.print( Long, 6); u8g2.setCursor(5, 43); u8g2.print("Lat: "); u8g2.setCursor(40, 43); u8g2.print( Lat, 6); u8g2.setCursor(0, 64); u8g2.print("Alt: "); u8g2.setCursor(20, 64); u8g2.print( Alt, 3); u8g2.setFont(u8g2_font_courB08_tn); u8g2.setCursor(105, 64); u8g2.print( num_sat, 5); u8g2.drawXBMP(118, 54, 10, 10, u8g2_logo_wave); } // This custom version of delay() ensures that the gps object // is being "fed". static void smartDelay(unsigned long ms) { unsigned long start = millis(); do { while (ss.available()) gps.encode(ss.read()); } while (millis() - start < ms); } void Get_GPS() { num_sat = gps.satellites.value(); if (gps.location.isValid() == 1) { Lat = gps.location.lat(); Long = gps.location.lng(); Alt = gps.altitude.meters(); gps_speed = gps.speed.kmph(); heading = gps.cardinal(gps.course.value()); } /* if (gps.date.isValid()) { day = gps.date.day(); month = gps.date.month(); year = gps.date.year(); } if (gps.time.isValid()) { hour = gps.time.hour(); minute = gps.time.minute(); second = gps.time.second(); } */ smartDelay(1000); if (millis() > 5000 && gps.charsProcessed() < 10) { // Serial.println(F("No GPS detected: check wiring.")); } } static void printDate(TinyGPSDate &d) { if (!d.isValid()) { u8g2.print(F("******** ")); } else { char sz[32]; sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year()); u8g2.print(sz); } } static void printTime(TinyGPSTime &t) { if (!t.isValid()) { u8g2.print(F("******** ")); } else { char sz[32]; sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second()); u8g2.print(sz); } // printInt(d.age(), d.isValid(), 5); smartDelay(0); } void print_Trip() { unsigned long distanceKm = (unsigned long)TinyGPSPlus::distanceBetween( gps.location.lat(), gps.location.lng(), Home_LAT, Home_LNG ) / 1000.0; u8g2.setFont(u8g2_font_nine_by_five_nbp_tf); u8g2.setCursor(0, 20); u8g2.print("Trip: "); u8g2.setCursor(50, 20); u8g2.print(distanceKm); u8g2.setCursor(90, 20); u8g2.print("Km"); double courseTo = TinyGPSPlus::courseTo( gps.location.lat(), gps.location.lng(), Home_LAT, Home_LNG ); u8g2.setCursor(0, 30); u8g2.print("Course: "); u8g2.setCursor(60, 30); u8g2.print(courseTo); u8g2.setCursor(90, 30); u8g2.print("Km"); String cardinalTo = TinyGPSPlus::cardinal(courseTo); u8g2.setCursor(0, 40); u8g2.print("Cardinal: "); u8g2.setCursor(60, 40); u8g2.print(cardinalTo); }

 




Prototype:

 



GPS Display Screens:

  

Working Video:




Downloads:




]]>
https://blog.etechpath.com/mini-gps-display-using-ublox-neo-6m-module-and-esp8266-nodemcu/feed/ 0
Digital distance measuring device using ultrasonic sensor SR04, OLED display and Arduino https://blog.etechpath.com/digital-distance-measuring-device-using-ultrasonic-sensor-sr04-oled-display-and-arduino/ https://blog.etechpath.com/digital-distance-measuring-device-using-ultrasonic-sensor-sr04-oled-display-and-arduino/#respond Sat, 05 May 2018 14:48:07 +0000 https://blog.etechpath.com/?p=573 About:

In this project i will explain how to interface SR04 ultrasonic sensor module with Arduino and display result on OLED display.




Components:

Arduino

SR04 Ultrasonic sensor module

OLED display i2c

Wires and basic tools




Circuit Diagram:

Description: 

  1. Connect SR04 ultrasonic sensor power to arduino +5v and GND also connect Trigger and Echo pin to arduino pin 9 and pin 8 as shown in above circuit diagram.
  2. In same way connect OLED power to arduino and connect SCL & SDA of oled display to arduino pin A5 and pin A4.
  3. Download arduino code and all libraries form download section, compile the code and upload it to your arduino.
  4. If you are new to ultrasonic sensors, do visit this post for basic study “SR04 Ultrasonic Sensor Module Basics”





Code:

/******************************************************************
 * Project: Printing utrasonic sensor data on OLED display
 * Author: Pranay Sawarkar
 * Website: www.etechpath.com
 *
 * This example is for a 128x32 pixel monocrome display using i2c
 *
 *****************************************************************/
#include <Ultrasonic.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Ultrasonic ultrasonic(9, 8);
#define OLED_RESET 4   //(optional)
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)     // change it to 64 if you are using 128x64 pixel OLED
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup()
{
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  //display.display();
  //delay(2000);
  display.clearDisplay();
}
void loop ()
{
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Distance: ");
  display.println(ultrasonic.distanceRead());
  display.setCursor(80,0);
  display.print("cm");
  display.display();
  delay(1000);
  display.clearDisplay();
}

 



Downloads:

SR04 Ultrasonic Sensor Module Basics

SR04 Ultrasonic Module Library 

Adafruit GFX Library

Adafruit_SSD1306 OLED Library

Arduino Code

]]>
https://blog.etechpath.com/digital-distance-measuring-device-using-ultrasonic-sensor-sr04-oled-display-and-arduino/feed/ 0
How to operate home appliances wirelessly using ESP8266 and android phone https://blog.etechpath.com/how-to-operate-home-appliances-wirelessly-using-esp8266-and-android-phone/ https://blog.etechpath.com/how-to-operate-home-appliances-wirelessly-using-esp8266-and-android-phone/#respond Fri, 08 Sep 2017 01:37:04 +0000 https://blog.etechpath.com/?p=236 Required Components: 



  1. NodeMCU or any ESP8266
  2. Relay Module
  3. 128×64 OLED display (Optional)
  4. Android Phone

Circuit Diagram :

 

Source Code:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <Adafruit_GFX.h>
#include <ESP_Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

 

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

const char* ssid = "xxxxxxx"; //replace xxxxxxx with your wifi ssid
const char* password = "xxxxxxx"; //replace xxxxxxx with your wifi password

ESP8266WebServer server(80);

const int output1 = 14;
const int output2 = 12;
const int output3 = 13;
const int output4 = 15;

boolean device1 = false;
boolean device2 = false;
boolean device3 = false;
boolean device4 = false;

void handleRoot() {
//digitalWrite(led, 1);
//server.send(200, "text/plain", "hello from esp8266!");
//digitalWrite(led, 0);

String cmd;
cmd += "<!DOCTYPE HTML>\r\n";
cmd += "<html>\r\n";
//cmd += "<header><title>ESP8266 Webserver</title><h1>\"ESP8266 Web Server Control\"</h1></header>";
cmd += "<head>";
cmd += "<meta http-equiv='refresh' content='5'/>";
cmd += "</head>";

if(device1){
cmd +=("<br/>Device1 : ON");
}
else{
cmd +=("<br/>Device1 : OFF");
}

if(device2){
cmd +=("<br/>Device2 : ON");
}
else{
cmd +=("<br/>Device2 : OFF");
}

if(device3){
cmd +=("<br/>Device3 : ON");
}
else{
cmd +=("<br/>Device3 : OFF");
}

if(device4){
cmd +=("<br/>Device4 : ON");
}
else{
cmd +=("<br/>Device4 : OFF");
}

cmd += "<html>\r\n";
server.send(200, "text/html", cmd);
}

void handleNotFound(){

String message = "File Not Found\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<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, "text/plain", message);

}

void setup(void){
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);

digitalWrite(output1, LOW);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);

Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("");

 

// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
//display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
display.begin(SSD1306_SWITCHCAPVCC, 0x78>>1); // init done

display.clearDisplay(); // Clear the buffer.

display.setTextSize(2);
display.setTextColor(WHITE);
//display.setTextColor(BLACK, WHITE); // 'inverted' text
display.setCursor(0,0);
display.println(" ESP8266");

display.setTextSize(3); //Size4 = 5 digit , size3 = 7 digits
//display.setTextColor(BLACK, WHITE); // 'inverted' text
display.setTextColor(WHITE);
display.setCursor(0,18);
display.println("Control");

display.setTextSize(1);
display.setTextColor(WHITE);
//display.setTextColor(BLACK, WHITE); // 'inverted' text
display.setCursor(0,52);
display.println("Version 0.1");

display.display();
delay(2000);

display.clearDisplay();

display.setTextSize(2);
display.setTextColor(WHITE);
//display.setTextColor(BLACK, WHITE); // 'inverted' text
display.setCursor(0,0);
display.println("Connecting");

// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");

display.print(".");
display.display();
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

display.clearDisplay();
display.setTextSize(1); display.setTextColor(WHITE);
display.setCursor(0,0); display.println(ssid);
display.setTextSize(2); display.setTextColor(WHITE);
display.setCursor(0,18); display.println(WiFi.localIP());
//display.setCursor(0,36); display.println(WiFi.localIP());

display.display();

if (MDNS.begin("esp8266")) {
Serial.println("MDNS responder started");
}

server.on("/", handleRoot);

server.on("/status1=1", [](){
server.send(200, "text/plain", "device1 = ON");
digitalWrite(output1, HIGH);
device1 = true;
});

server.on("/status1=0", [](){
server.send(200, "text/plain", "device1 = OFF");
digitalWrite(output1, LOW);
device1 = false;
});

server.on("/status2=1", [](){
server.send(200, "text/plain", "device2 = ON");
digitalWrite(output2, HIGH);
device2 = true;
});

server.on("/status2=0", [](){
server.send(200, "text/plain", "device2 = OFF");
digitalWrite(output2, LOW);
device2 = false;
});

server.on("/status3=1", [](){
server.send(200, "text/plain", "device3 = ON");
digitalWrite(output3, HIGH);
device3 = true;
});

server.on("/status3=0", [](){
server.send(200, "text/plain", "device3 = OFF");
digitalWrite(output3, LOW);
device3 = false;
});

server.on("/status4=1", [](){
server.send(200, "text/plain", "device4 = ON");
digitalWrite(output4, HIGH);
device4 = true;
});

server.on("/status4=0", [](){
server.send(200, "text/plain", "device4 = OFF");
digitalWrite(output4, LOW);
device4 = false;
});

server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}

void loop(void){
server.handleClient();
}

Steps:

    1. Build up the circuit as shown in circuit diagram.
    2. Download source code from download section, edit downloaded code and input your home router’s SSID and Password in the code.
      const char* ssid = "xxxxxxx"; //replace xxxxxxx with your wifi ssid
      const char* password = "xxxxxxx"; //replace xxxxxxx with your wifi password
    3. Compile and upload the source code in NodeMCU or any ESP8266 you are using. You can use Arduino IDE to upload the code.



  1. Once your uploading process is completed, power up the circuit and reset the ESP once.
  2. Now ESP will connect to your router and it will show IP address of your ESP in OLED display.
  3. Install android application in your phone and open it, application link is given bellow in download section.
  4. Input IP address shown in OLED display and port i.e 80 in application page and hit connect button.
  5. Now you can operate relay from your phone and can connect any appliances to these relays. (consider relay amps rating )

 

Note: You can not use direct 5v relay in this project, because NodeMCU control output is only 3.3v which is not enough to trigger 5v relay. That is- why we are using relay  module to work on this project.

 



Downloads:

esp8266_relay_control.ino

Android application

Circuit diagram

]]>
https://blog.etechpath.com/how-to-operate-home-appliances-wirelessly-using-esp8266-and-android-phone/feed/ 0