psadminetechpath – Blog eTechPath https://blog.etechpath.com Sun, 23 Apr 2023 21:03:56 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://blog.etechpath.com/wp-content/uploads/2017/08/BrandLogo12-150x150.png psadminetechpath – 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
Interfacing SHARP 2Y0A21 Distance Sensor with Arduino https://blog.etechpath.com/interfacing-sharp-2y0a21-distance-sensor-with-arduino/ https://blog.etechpath.com/interfacing-sharp-2y0a21-distance-sensor-with-arduino/#respond Tue, 21 Feb 2023 08:44:53 +0000 https://blog.etechpath.com/?p=1201 Introduction:

In this tutorial, I will explain how to interface SHARP 2Y0A21 infrared distance sensor with Arduino board and display the output in serial monitor.

SHARP 2Y0A21

SHARP 2Y0A21 sensor works on infrared technology, it consists of a transmitter and a receiver diode which calculates the distance between the sensor and the target by measuring time interval between transmitted and received wave.

SHARP infrared distance sensor
SHARP 2Y0A21 Sensor Specifications:
  1. Working voltage: 4.5 – 5.5 Vdc
  2. Distance measuring range: 10cm – 80cm (10cm dead band)
  3. Output type: Analog (voltage)
  4. Output: 0 to 3.1v (3.1v at 10cm to 0.3v at 80cm)
  5. Operating Temperature: -10 to +60 °C (Storage: -40 to +70 °C)

Circuit Diagram:

Code:

//SHARP 2Y0A21 IR Distance Sensor Test (10-80cm) 
// Author: Pranay Sawarkar
// www.eTechPath.com

#define sensor A2 

void setup() 
{
  Serial.begin(9600);
}

void loop() 
{
  float volts = analogRead(sensor)*0.0048828125;
  int distance = 30*pow(volts, -1.173);
  delay(1000); 
  
  if ((distance >=10)&&(distance <=80))
  {
    Serial.print("Distance:");
    Serial.println(distance);
    Serial.print("Volts:");
    Serial.println(volts);   
  }
  else
  Serial.println("Out of range");
}
]]>
https://blog.etechpath.com/interfacing-sharp-2y0a21-distance-sensor-with-arduino/feed/ 0
How to recover KingView SCADA project password. https://blog.etechpath.com/how-to-recover-kingview-scada-project-password/ https://blog.etechpath.com/how-to-recover-kingview-scada-project-password/#respond Wed, 09 Nov 2022 12:49:45 +0000 https://blog.etechpath.com/?p=1032 kingview scada password

Introduction:

In this tutorial we will learn how to get access to your kingview project if you have missed or forget your project password.

Disclaimer: This tutorial is for educational purpose only, please do not use if the project is locked by the third person.

Instructions:

  • Step 1: Take backup of your project and make changes to copied files and not to the original program.
  • Step 2: Download any hex file editor. (In this tutorial we are using WinHex editor).
  • Step 3: Open tagname.db file from program folder with hex editor.
  • Step 4: As shown in picture bellow, change these hex values to zero.
  • Step 5: Save the tagname.db file in hex editor and close it.
  • Step 6: Now you can open the project in kingview software without password.

Note: With this trick, you can get access to project tags and communication data. But you will still need password to get access to the pages. Also you will not be able to change the password without knowing the original password.

If you want to fully unlock the project, you can take paid help from any expert freelancers or you can simply reach out to us with the project files. email

]]>
https://blog.etechpath.com/how-to-recover-kingview-scada-project-password/feed/ 0
Solid State Drives – SSD https://blog.etechpath.com/solid-state-drives-ssd/ https://blog.etechpath.com/solid-state-drives-ssd/#respond Sat, 29 Oct 2022 20:04:22 +0000 https://blog.etechpath.com/?p=1006

Introduction:

Solid state drive is a type of storage device that uses integrated circuit assembly to store digital data in it. Unlike conventional hard disk drives, SSD’s does not consist of mechanical moving parts which makes it more reliable and long lasting than conventional hard disk drives.

Advantages and Disadvantages of SSDs over HDDs:

Advantages:

  • Solid state drives are way faster than the hard disk drives. HDDs can copy data at maximum 150MB/s, while common SSDs can copy the same data at 500MB/s. Also, some latest PCIe SSD’s can go more than 5500MB/sec transfer speed.
  • Lifespan of solid state drive is longer than HDDs. Hard disc drives tend to last for around 5years, while SSD’s can last more than 10years.
  • HDD’s has moving parts inside so they make little noise at the time of working. SSD’s are super quiet.
  • SSD’s are very light in weight as compared to HDD’s.
  • Power consumption of a solid state drive is very less as compared to a hard disk drive.

Disadvantages:

  • The measure disadvantage of a solid-state drive is the cost. An SSD can cost more than double the cost of an HDD.
  • Inability to recover old lost data. Which is possible in conventional hard disk drives.

Types of Solid-State Drives:

Solid state drives are available in two interfaces, one is SATA SSD and another is PCIe SSD.

SATA Solid State Drive:

SATA is one the most widely used interface in the industry. Latest SATA III 3rd generation standard provides 6Gb/s bandwidth with up to 550Mbps of read write speed. SATA SSDs are available in different sizes, shapes and slots, details are described below.

2.5inch SATA SSD: 2.5inch SATA SSD is a one-to-one replacement of conventional SATA HDD drive. It can give you up to 500mbps transfer speed. With SATA SSD you can upgrade any HDD laptop or desktop computer to SSD without any modification. (Desktop computers may require some reduction brackets)

mSATA SSD: A mSATA SSD is smaller in shape as compared to 2.5inch standered SSD’s. Also, the power consumption of mSATA SSD is comparatively less. These drives are designed to use in battery operated devices like laptops, notebooks and tablets, because of its small shape and power consumption advantage. mSATA SSD can provide data transfer rate up to 550mbps. mSATA SSDs are available in two sizes, standered size mSATA and half mSATA.

M.2 SATA SSD: M.2 is a next generation standard which provides both SATA or PCIe interface, one at a time. M.2 SATA SSD come in different sizes like 2280, 2260, 2242, where 22 represents the width in mm and next two numbers represent the length. M.2 SATA SSDs are generally comes in B+M key interface.

PCIe Solid State Drive:

PCIe interface SSDs provides many advantages than a SATA interface SSDs. The biggest advantage is speed. A latest 3rd generation SATA SSD can reach maximum 550Mbps read write speed, however a PCIe interface SSD can reach up to 3500Mbps speed.

NVMe SSD: NVMe (Non-volatile Memory Express) provides high bandwidth and very high data transfer speed in very low power consumption. NVMe SSD can reach up to 3000Mbps of read write speed. NVMe SSD comes in M.2 interface with different sizes like 2280, 2260, 2242, 2230, where number 22 represents the width in mm and next two numbers represent the length. NVMe SSD comes with M-key interface, which is only compatible with M key slotted system.

AHCI SSD: AHCI (Advanced Host Controller Interface) was widely used in mid period of SATA and NVMe, it was originally designed for use in conventional hard disk drives. The working structure of AHCI SSD layers between SATA and PCIe interface. AHCI was popular because, unlike common memory structure, AHCI allows SSDs to support native command queuing (NCQ) command set.

AIC SSD: AIC (Add in Card) SSD is compatible with your desktop computer PCIe port. So, if you don’t have dedicated M.2 SSD socket in your motherboard but you still want to use high speed NVMe SSD, then go for AIC SSDs. These SSDs will slide in directly in standard PCIe port. AIC SSD functions same as M.2 NVMe and provides same lightning-fast speed without having M.2 port on your system.

M.2 Kays and Slots

All M.2 modules are keyed in specific way to prevent incorrect insertion of module cards into female slot on the host. M.2 SSDs generally uses three common keys i.e., B-key, M-key & B+M-key. You can find key type printed on the edge of module card near golden connector pins.

In above picture, module card on the left shows NVMe SSD with M-key slot, which is compatible with only M-key female sockets on the host. Module card on the right shows M.2 SATA SSD with B+M-key slot, which is compatible with both M-key and B-key female sockets on the host.

Choose between M.2 M key or M.2 M+B key SSD

Considering the performance, you should choose M.2 M key SSD for the best results. But before getting your SSD make sure what type of slot is available in your computer.

In a computer, there is only a M.2 M key socket, or a M.2 B key socket will be available and not M.2 M+B key socket.

Let’s come to the compatibility of slots. M.2 M key slot is compatible with both M key SSD and M+B key SSD, But M.2 B key slot is only compatible with M+B key SSD.

]]>
https://blog.etechpath.com/solid-state-drives-ssd/feed/ 0
Water Tank Level Automation using ESP8266 and HC-SR04 Ultrasonic Sensor. https://blog.etechpath.com/water-tank-level-automation-using-esp8266-and-hc-sr04-ultrasonic-sensor/ https://blog.etechpath.com/water-tank-level-automation-using-esp8266-and-hc-sr04-ultrasonic-sensor/#respond Tue, 18 Oct 2022 09:47:57 +0000 https://blog.etechpath.com/?p=976

About:

In this tutorial, we will learn how to interface hc-sr04 ultrasonic sensor with ESP8266 module and display the water tank level on mobile browser.

Table of Contents:

  • HC-SR04 Module
  • How Ultrasonic sensor works
  • Interfacing sensor module with NodeMCU
  • Programming NodeMCU with ArduinoIDE

HC-SR04 Module and How it works

HC-SR04 is an Ultrasonic sensor module which includes ultrasonic transmitter, receiver and control circuit in single compact PCB.  HC-SR04 has distance measurement ability ranging from 2cm to 400cm. These small units are very accurate, and its accuracy can be reach up to 3mm.

Ultrasonic modules work on the principle similar to radar or sonar- sensors. It generates high frequency signals from the transmitter of about 40kHz towards the sensing object and receives echo signal back to the receiver. Then we can calculate object distance using time interval between the sending of signal and the receiving of echo pulse.

Circuit Diagram:

Libraries:

Code:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <HCSR04.h>

const char* ssid     = "WaterLevel"; //Access point ssid
const char* password = "12341234";   //Access point password

float l = 0.0;
float per = 0.0;
float fcm = 0;
//Rectangular Tank dimentions in cm
float lcm = 200;  //Length
float bcm = 200;    // width
float hcm = 130;  // Height, from Sensor to tank bottom

HCSR04 ultrasonicSensor(D6, D5, 20, 300);
AsyncWebServer server(80);
unsigned long previousMillis = 0;
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; Color:DodgerBlue; }
    h3 { font-size: 1.5rem; Color:Tomato; }
    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>Water Tank Level</h2>
  <h3>www.eTechPath.com</h3>
  <p>
    <span id="permap">%PERMAP%</span>
    <sup class="units">%</sup> 
  </p>
   <p>
   <span id="liter">%LITER%</span>
    <sup class="units">Liters</sup>
  </p>
      <p>
    <span id="distance">%DISTANCE%</span>
    <sup class="units">Cm</sup>
  </p>
</body>
<script>
setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("permap").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/permap", true);
  xhttp.send();
}, 1000 ) ;
setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("liter").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/liter", true);
  xhttp.send();
}, 1000 ) ;
setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("distance").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/distance", true);
  xhttp.send();
}, 1000 ) ;
</script>
</html>)rawliteral";

// Replaces placeholders with sensor values
String processor(const String& var){
 
  if(var == "DISTANCE"){
    return String(fcm);
  }
  else if(var == "LITER"){
    return String(l);
  }
  else if(var == "PERMAP"){
    return String(per);
  }
  return String();
}
void setup(){
  Serial.begin(115200);  
  ultrasonicSensor.begin(); 
  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("/permap", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(per).c_str());
  });
  server.on("/liter", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(l).c_str());
  });
  server.on("/distance", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", String(fcm).c_str());
  });
  server.begin();
} 
void loop()
{  
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) 
  {
    previousMillis = currentMillis;
     float newdistance = ultrasonicSensor.getMedianFilterDistance(); //pass 3 measurements through median filter, better result on moving obstacles
    if (newdistance != HCSR04_OUT_OF_RANGE)
    {
      Serial.print("sensor raw value:");
      Serial.println(newdistance);
      fcm = hcm - newdistance;
      float v = fcm * lcm * bcm ;
      l = v / 1000;
      per = map(fcm, 0, hcm, 0, 100);
      Serial.println(per);
      Serial.println(l);
      Serial.println(fcm);     
    }
    else 
    {
      Serial.println(F("out of range"));
    }     
  }
}

Video:

]]>
https://blog.etechpath.com/water-tank-level-automation-using-esp8266-and-hc-sr04-ultrasonic-sensor/feed/ 0
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
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
How to interface DHT11 DHT22 Temperature sensor with Raspberry Pi https://blog.etechpath.com/how-to-interface-dht11-dht22-temperature-sensor-with-raspberry-pi/ https://blog.etechpath.com/how-to-interface-dht11-dht22-temperature-sensor-with-raspberry-pi/#respond Sun, 21 Nov 2021 21:37:39 +0000 https://blog.etechpath.com/?p=541 About:
In this tutorial i will explain how to interface and program DHT11/22 temperature sensor with Raspberry Pi. I have used adafruit python library to program these sensors in python shell.




Things you will need:
Raspberry Pi (any model will work)
DHT11 or DHT22
4k7 Resistor




Circuit Diagram:

Circuit diagram

Python Code:

#!/usr/bin/python
# Name: DHT11/DHT22Interfacing Temperature sensor with raspberry Pi
# Author: Pranay Sawarkar
# Website: www.etechpath.com
# Copyright: Creative Common

import Adafruit_DHT

# sensor = Adafruit_DHT.DHT22
sensor = Adafruit_DHT.DHT11


# Sensor connected to Raspberry Pi GPIO4.
pin = 4

humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

if humidity is not None and temperature is not None:
    print('Temperature={0:0.1f}*C  Humidity={1:0.1f}%'.format(temperature, humidity))
else:
    print('Failed to capture reading. Please Try again!')

 




Steps:

  1. Connect your temperature sensor to GPIO4 of your raspberry pi  and don’t forget to connect 4k7 pull up resistor between vcc and data output pin. You can use any 4k7 to 10k range resistor for pull up purpose.
  2. Power on your raspberry pi and open terminal.
  3. First we will download and install adafruit library for DHT sensors,
    sudo apt-get update
    git clone https://github.com/adafruit/Adafruit_Python_DHT.git
  4. Install python essential files. (if you are using it for first time)
    sudo apt-get install build-essential python-dev
    sudo python setup.py install
  5. Now your raspberry pi is ready to run the adafruit dht python program,
  6. Copy main python code at home directory in a empty file and name it as dht.py (or download ready dht.py file from download section and copy it to your raspberry pi home directory).
  7. Now you can use bellow command to check the sensor data by running this python program from your raspbery pi terminal,
    sudo python dht.py

    You will get output like this,



 

]]>
https://blog.etechpath.com/how-to-interface-dht11-dht22-temperature-sensor-with-raspberry-pi/feed/ 0