esp – Blog eTechPath https://blog.etechpath.com Tue, 03 Jan 2023 12:34:47 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://blog.etechpath.com/wp-content/uploads/2017/08/BrandLogo12-150x150.png esp – Blog eTechPath https://blog.etechpath.com 32 32 K-Type Thermocouple with MAX6675 module using ESP8266 Node MCU https://blog.etechpath.com/k-type-thermocouple-with-max6675-module-using-esp8266-node-mcu/ https://blog.etechpath.com/k-type-thermocouple-with-max6675-module-using-esp8266-node-mcu/#respond Fri, 24 Jun 2022 10:14:32 +0000 https://blog.etechpath.com/?p=938 In this tutorial, you will learn how to interface MAX6675 thermocouple amplifier module with node MCU ESP8266 and view sensor reading on esp local webserver without using any router.

Table of Contents:

  • Types of temperature sensors
  • MAX6675 HW-550 Module
  • Interfacing MAX6675 with ESP
  • Installing libraries
  • Examples to read temperature from MAX6675

Types of temperature sensors.

There are four measure types of temperature sensors that are commonly used in the industry: RTD, Thermocouples, Thermistor and semiconductor based IC’s. From these four types, we will talk about the Thermocouple temperature sensors in this tutorial.

Thermocouple is a temperature sensor which contains two wires and gives output in millivoltage with respect to junction temperature. This temperature sensor wires also has fixed polarity, So you can not reverse it.

Sensor element of thermocouple is made up of two different types of metals which is joint together at one point. When this point gets heated or cooled, a voltage is created that can be use as reference for temperature calculation.

Max6675 Module:

MAX6675 is k-type thermocouple to digital converter which provides output in SPI serial interface with 12-bit resolution. MAX6675 can measure temperature range from 0°C to 1024°C with the accuracy of 0.25°C

  • Supply Voltage: 3.0V to 6.0V DC
  • Current: 50mA
  • Operating temperature : -20°C to +80°C

Schematic Diagram:

Installing Arduino Libraries:

Examples:

Interfacing MAX6675 with ESP8266 and monitoring temperature in serial monitoring.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "max6675.h"

int thermoDO = 12;
int thermoCS = 15;
int thermoCLK = 14;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

void setup() {
  Serial.begin(115200);

  Serial.println("MAX6675 test");
  // Stabilisation delay for MAX6675 chip
  delay(500);
}

void loop() {
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   Serial.print("F = ");
   Serial.println(thermocouple.readFahrenheit());
 
   // There should be at-least 250ms delay between reeds from MAX 6675 
   delay(1500);
}

Interfacing MAX6675 with ESP8266 and monitoring temperature in ESP local webserver.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "max6675.h"

const char* ssid     = "MAX6675-Server";
const char* password = "12341234";

int thermoDO = 12;
int thermoCS = 15;
int thermoCLK = 14;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

float t = 0.0;
float f = 0.0;

AsyncWebServer server(80);

unsigned long previousMillis = 0; //will store last time temp was updated

const long interval = 1000;  

const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    html {
     font-family: Arial;
     display: inline-block;
     margin: 0px auto;
     text-align: center;
    }
    h2 { font-size: 3.0rem; }
    p { font-size: 3.0rem; }
    .units { font-size: 1.2rem; }
    .temp-labels{
      font-size: 1.5rem;
      vertical-align:middle;
      padding-bottom: 10px;
    }
  </style>
</head>
<body>
  <h2>Max6675 Thermocouple Server</h2>
  <h3>www.eTechPath.com</h3>
  <p>
    <span class="temp-labels">Temperature</span> 
  </p>
   <p>
    <span id="temperature">%TEMPERATURE%</span>
    <sup class="units">&deg;C</sup>
  </p>
  <p>
    <span id="fahrenheit">%FAHRENHEIT%</span>
    <sup class="units">&deg;F</sup>
  </p>
</body>
<script>
setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("temperature").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/temperature", true);
  xhttp.send();
}, 1000 ) ;

setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("fahrenheit").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/fahrenheit", true);
  xhttp.send();
}, 10000 ) ;
</script>
</html>)rawliteral";

// Replaces placeholder with sensor values
String processor(const String& var){
 
  if(var == "TEMPERATURE"){
    return String(t);
  }
  else if(var == "FAHRENHEIT"){
    return String(f);
  }
  return String();
}
void setup(){
  Serial.begin(115200);  
  Serial.print("Setting AP (Access Point)…");
  WiFi.softAP(ssid, password);

  IPAddress IP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(IP);

  Serial.println(WiFi.localIP());

  // Route for root
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/html", index_html, processor);
  });
  server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(t).c_str());
  });
  server.on("/fahrenheit", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(f).c_str());
  });
  server.begin();
} 
void loop()
{  
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) 
  {
    previousMillis = currentMillis;
    // Read Celsius
     float newT = thermocouple.readCelsius();
    if (isnan(newT))
    {
      Serial.println("Failed to read from Thermocouple Sensor!");
    }
    else 
    {
      t = newT;
      Serial.println(t);
    }
      // Read Fahrenheit
      float newF = thermocouple.readFahrenheit();
     if (isnan(newF)) 
     {
      Serial.println("Failed to read from Thermocouple Sensor!");
    }
    else 
    {
      f = newF;
      Serial.println(f);
      Serial.println(WiFi.softAPIP());
    }  
  }
}

Prototype:

]]>
https://blog.etechpath.com/k-type-thermocouple-with-max6675-module-using-esp8266-node-mcu/feed/ 0
Setup ESP8266 Filesystem (SPIFFS) Uploader in Arduino IDE https://blog.etechpath.com/setup-esp8266-filesystem-spiffs-uploader-in-arduino-ide/ https://blog.etechpath.com/setup-esp8266-filesystem-spiffs-uploader-in-arduino-ide/#respond Tue, 14 Apr 2020 19:43:49 +0000 https://blog.etechpath.com/?p=842

Overview:

SPIFFS is Serial Peripheral Interface Flash File System which is designed for microcontrollers with flash chip, ESP8266 is one of those microcontroller. In this tutorial we will learn how to flash data in ESP8266 filesystem using Arduino IDE plugin.

Using SPIFFS with ESP8266 board you can do several useful things like saving data in file system permanently without using separate memory chip, save html and css file to build a web server, save images and icons for interactive webpage.

Parts Required:

  • ESP8266 Node MCU with data cable
  • Arduino IDE with latest ESP8266 library

Procedure:

  • Install latest Arduino IDE in your computer if it is not installed yet. You can download the latest version from Arduino site directly or from this Link.
  • Install latest ESP8266 library into your Arduino IDE. Please follow the link for detailed procedure.
  • Go to ESP8266 filesystem download page on github and download filesystem zip file as shown in bellow image, ESP8266FS Link.
  • Open Arduino IDE directory and locate tools folder in it. In most of the cases in Windows system your directly will be same as bellow,
  • Unzip the downloaded file in tools folder as it is, do not rename or change location of jar file, it should be same as shown in bellow image.
  • If you don’t find tools folder under Arduino folder, then make one with correct spell (tools) and paste downloaded unzipped folder in it.
  • That’s it, you are ready to go now. Restart your Arduino IDE and check if the plugin was successfully installed. Click on Tools menu in Arduino IDE and check that you have the option ESP8266 Sketch Data Upload in drop-down list.
]]>
https://blog.etechpath.com/setup-esp8266-filesystem-spiffs-uploader-in-arduino-ide/feed/ 0
DIY pendrive size WiFi repeater using ESP-01 ESP8266 module. https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/ https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/#comments Thu, 07 Sep 2017 19:38:19 +0000 https://blog.etechpath.com/?p=214 About:

In this project i am going to explain you how to build your own WiFi repeater to extend your home WiFi signal strength. This device is very easy to make and very handy to use. You can use this device at school, college, office or Cafe to extend the WiFi signal without buying expensive WiFi modems from the market.




Components you will need:

  1. ESP-01 or NodeMCU
  2. ASM1117 3.3V voltage converter IC
  3. Male USB connector
  4. USB-UART adapter for programming ESP-01
  5. Android or iOS phone to configure settings.

Circuit Diagram for Programming ESP-01 : 

esp-01_circuit

 

 

Steps: 

    1. Connect ESP-01 to UART adapter as shown in above diagram.
    2. Download firmware files form the bottom of the page, We will flash these files to ESP-01 using ESP flash tools.
    3. Firmware files are in rar folder, So unrar firmware files first and then open ESP flash download tools.
    4. Browse downloaded firmware files into given location as shown in bellow picture and write down where do you want flash the particular file, i.e select 0x00000.bin file and then write location to flash @0x00000 after that select 0x10000.bin file and locate it to 0x10000. (refer bellow screenshot for example)esp8266_repeater_diy
    5. select COM port and hit START button. (If you dont know how to use flash tool, Check this link on Getting started with ESP8266 to flash ESP-01)
    6. After flashing firmware to esp-01, disconnect the circuit and connect USB male port to ESP-01 as given in bellow circuit diagram.ESP-01_Repeater
    7. Now you can power this circuit using any 5v USB wall adapter. So power up this circuit and follow the further steps for configuring WiFi AP settings.
    8. Download Telnet Client Terminal application in your phone. Download links are given in download section at the bottom of this page.



  1. Power up the circuit, default device will create open access point with name MyAP without any password and default IP will be 192.168.4.1, Open WiFi settings in your phone and connect this open access point.
  2. Open Telnet Client Terminal in your phone and add two fields as IP: 192.168.4.1 and Port: 7777, hit connect button.
  3. If everything is ok, terminal will show connected. write command show and hit enter. It will show the current name and password of device STA and AP as shown in bellow screenshot.
  4. Use these commands to update the username and password of your STA and AP.
  • set ssid XXXXXXXX    (your home router SSID)
  • set password XXXXXXXX   (your home router password)
  • set ap_ssid  XXXXXXXX   (new access point name)
  • set ap_password  XXXXXXXX   (new access point password)
  • save    (save configuration)
  • reset   (reset device)
  • show     (this will show updated setting of your device, i.e your routers and access point  username and password)
  • quit     (terminates current remote session)

You are now done with the repeater configuration, reset the ESP once and it will connect your home router with updated ssid and password at the same time it will create an access point with your new access point name and password.



Downloads:

Firmware

ESP Flash Download Tools v3.4.4

Telnet Client Terminal  (Android) (iOS)

 

]]>
https://blog.etechpath.com/diy-pendrive-size-wifi-repeater-using-esp-01-esp8266-module/feed/ 1
Getting Started with ESP8266 WiFi Module https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/ https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/#respond Thu, 31 Aug 2017 01:59:00 +0000 https://blog.etechpath.com/?p=100 ESP8266 :

ESP8266 is advance WiFi chip with complete and standalone networking capabilities. This can be use ether as a standalone or the slave to a host microcontroller. ESP8266 is integrated with advance Tensilica’s L106 diamond series 32 bit micro-processor and on-chip SRAM with CPU clock speed 80MHz. We can also interface external input devices with this chip though provided GPIO’s (general purpose input/output).

For detailed information you can download ESP8266 datasheet here.

 

ESP8266 Modules:

There are several esp8266 modules available in market but only some of them are famous and commonly used. The most commonly used esp modules are ESP-01, ESP-07ESP-12  & ESP-32. Nowadays  ESP-32 is most famous module amongs all of them because ESP-32 is the only version  of ESP which combines WiFi and Bluetooth in single module. You can download datasheets of these modules from attachments.

 

ESP-01 Basic Circuit:

 

ESP-01 Pinout

ESP-01 Pinout

 

How to flash ESP-01 using Flash tools:

  1. Gather all component shown in above circuit and wire your esp to serial module as shown.
  2. Download ESP flash download tool from  the link given at the bottom of the page. You will not need to install this tool in your system, this tool will run directly without installation.
  3. Extract the rar file which we have downloaded in last step and run application file in it and select ESP8266 form selection buttons.
    ESP-flash-tools
    ESP-flash-tools
  4. After selecting ESP8266 download tool button, Flash tool screen will appear like bellow picture.
    ESP-flash-tools2
    ESP-flash-tools
  5. Now go back to your circuit and put jumper JP1 on. For setting ESP-01 into programming mode, you have to short GPIO0 to ground terminal of connected source.
  6. Connect serial module to your computer USB port and check the COM port for this device in device manger. You will need the correct COM port number of the connected device which you want to flash.   ( learn how to check COM port )
  7. That’s it, You are ready to go. Now select the bin files you want to burn into your ESP, select com port at the bottom of the flash tool and hit START. Ongoing process and success message will show in download panel dialog box.
  8. For beginner level you can burn NodeMCU firmware in your ESP-01 for general use.

 

How to Flash NodeMCU firmware in ESP-01:

  1. Download ESP8266 Flasher form the link given bellow at the bottom of this page.
  2. Run the flasher application file. You will see the tool as shown in bellow picture,
    ESP_flasher
    ESP_flasher
  3. Now setup your ESP-01 in programming mode as i described in previous steps. and select the COM port of your serial module.
  4. Do not change any other settings in flasher, setting right port is enough.
  5. Now hit Flash button provided just beside com port and your ESP will start receiving data from flasher. At the same time  AP MAC and STA MAC will appears on flasher as shown in picture bellow,
    NodeMCU flasher
    Programming ESP….
  6.  After successfully completing flashing process green indication will appear at the bottom, This means your ESP is programmed successfully and ready to use.

 

 



Downloads:

  1. ESP Flash Download Tools
  2. ESP Flasher win32
  3. ESP Flasher win6

 

]]>
https://blog.etechpath.com/getting-started-with-esp8266-wifi-module/feed/ 0