Update LCD Display with ESP32 Web Server

Hello readers, I hope you all are doing great.

ESP32 is a powerful chip for Internet of Things applications. This tutorial is also based on one of the ESP32 applications in the field of IoT.

Where To Buy?
No.ComponentsDistributorLink To Buy
1ESP32AmazonBuy Now

Project Overview

In this tutorial, we will learn how to update LCD display with new data or input using a web server created with ESP32.

Fig. 1

To achieve the target, we will be using an HTML (Hypertext Markup Language) form to provide web input and then update the text displayed on LCD. The values or input received from the webserver will be further stored inside a variable in the code for further use (to display on LCD).

We have already posted a tutorial on LCD (Liquid Crystal Display) interfacing with ESP32. In that tutorial, we demonstrated how to display the hard-coded data (in the ESP32 module) on LCD.

ESP32 Web Server

A web server is computer software and hardware that accepts requests and responds to those requests using HTTP (Hypertext transfer protocol) or HTTPS (HTTP Secure) (HTTP is a network protocol for delivering online content to client user agents).

The ESP32 standalone web server is mobile-enabled and can be accessed from any device with a browser on the local network. B. Mobile phones, computers, laptops, tablets. However, all the devices must be connected to the same WiFi network to which the ESP32 is connected.

Software and Hardware requirements

  • ESP32 development board
  • 16*2 LCD display
  • 10K trim-pot
  • Breadboard or general-purpose PCB
  • Connecting Wires
  • Arduino IDE
  • h, ESPAsynchWenServer.h header files

Interfacing16*2 LCD with ESP32

There are basically two ways to connect the ESP32 to a 16 * 2 LCD display.

  1. Interface with I2C adapter
  2. Direct connection without using I2C adapter.

Connecting an LCD display without an I2C adapter is cheap, but this method requires more connection cables and is complicated to implement. On the other hand, using an I2C adapter reduces complexity but increases cost. In this tutorial, you will connect the ESP32 directly without using an I2C adapter.

Table: 1

Fig. 2: ESP32 and 16*2 LCD interfacing

For more details on interfacing 16*2 LCD with ESP32, follow our previous tutorial at www.theengineeringprojects.com

Programming ESP32

Installing ESP32 board manager in Arduino IDE:

We are using Arduino IDE to compile and upload code into ESP32 module. You must have ESP32 board manager installed on your Arduino IDE to program ESP32 module. To know more about Arduino IDE and how to use it, follow our previous tutorial i.e., on ESP32 programming series. The link is given below:

https://www.theengineeringprojects.com/2021/11/introduction-to-esp32-programming-series.html

Installing necessary libraries:

ESP32 board manager doesn’t come with inbuilt libraries to create an asynchronous web server. So we need to download the library file from external sources and then add into Arduino IDE.

We need to install two library files:

  1. ESPAsynWebServer: Follow the link https://github.com/me-no-dev/ESPAsyncWebServer to download the respective library.
  1. AsyncTCP: You can download the AsyncTCP library from the following link https://github.com/me-no-dev/AsyncTCP

Once you have successfully downloaded the required libraries, next step it to install or add these libraries in Arduino IDE.

To add the libraries in Arduino IDE, go to Sketch >> Include Library >> Add .zip library and then select the downloaded library files.

Fig. 3: adding necessary libraries

Arduino IDE code

#include < WiFi.h >

#include < AsyncTCP.h >

#include < ESPAsyncWebServer.h >

#include < LiquidCrystal.h > // LCD header file

LiquidCrystal lcd (22, 23, 5, 18, 19, 21 );

AsyncWebServer server ( 80 );

// Enter your netwrok credentials

const char* ssid = "replace this with netwrok SSID";

const char* password = "replace this with Password";

const char* PARAM_INPUT_1 = "data_field1";

const char* PARAM_INPUT_2 = "data_field2";

// HTML web page to handle data input fields

const char index_html[] PROGMEM = R"rawliteral(

<!DOCTYPE HTML> <html> <head>

<title> ESP Input Form </title>

<meta name = " viewport" content="width=device-width, initial-scale=1 ">

<style>

html{ font-family: Times New Roman; display: inline-block; text-align: justify;}

</style>

</head> <body>

<form action="/get">

Data_field1: <input type="text" name="data_field1" >

<input type="submit" value="Post ">

</form> <br>

<form action="/get">

Data_field2: <input type="text" name="data_field2">

<input type="submit" value="Post">

</form><br>

</body></html>)rawliteral";

void notFound(AsyncWebServerRequest *request) {

request->send(404, "text/plain", "Not found");

}

void setup() {

 

Serial.begin(115200);

WiFi.mode(WIFI_STA);

WiFi.begin(ssid, password);

if (WiFi.waitForConnectResult() != WL_CONNECTED) {

Serial.println("WiFi Failed!");

return;

}

Serial.println();

Serial.print("IP Address: ");

Serial.println(WiFi.localIP());

//===set LCD

lcd.begin(16, 2);

lcd.clear();

lcd.setCursor(1,0);

server.onNotFound(notFound);

server.begin();

// Send web page with input fields to client

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request)

{

request->send_P(200, "text/html", index_html);

});

server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) {

String inputMessage;

String inputParam;

// GET input1 value

if (request->hasParam(PARAM_INPUT_1))

{

inputMessage = request->getParam(PARAM_INPUT_1)->value();

inputParam = PARAM_INPUT_1;

}

// GET input2 value

else if (request->hasParam(PARAM_INPUT_2))

{

inputMessage = request->getParam(PARAM_INPUT_2)->value();

inputParam = PARAM_INPUT_2;

}

else

{

inputMessage = " No message sent";

inputParam = " none";

}

Serial.println ( inputMessage );

delay( 1000);

lcd.clear();

lcd.print( inputMessage);

request-> send (200, "text/html", " HTTP GET request sent to ESP32("

+ inputParam + "): " + inputMessage +

"<br><a href=\"/\"> Back to Home Page </a>");

});

}

void loop( )

{

}

Code Description

  • The first step is adding the necessary header files.
  • Here we are using two libraries:
    • The first one is WiFi.h, which is used to enable the Wi-Fi module and hence wireless network connectivity.
    • LiquidCrystal.h is used to call the necessary functions required to interface and control LCD with ESP32.
    • ESPAsynchWenServer library file is responsible for creating an asynchronous web server.
    • AsyncTCP is used to enable a multi-connection network for ESP32 (Espressif’s) microcontroller unit.

Fig. 4: Adding header files

  • Define the data and control pins (of 16*2 LCD) to be interfaced with ESP32.

Fig. 5: LCD data and control pins

  • While creating a web server we also need to assign a port and usually port 80 is used for local web server.

Fig. 6: server port

  • Enter the network credentials in place of SSID and PASSWORD.

Fig. 7: Enter Network credentials

  • The next thing is the declaration of variables for input data fields.

Fig. 8

Creating HTML Form

  • !DOCTYPE html><html> is used to describe/indicate that we are transmitting HTML, this command should always be the first thing we send.
  • <title> tag is used to write a title for the web page.
  • The next line in the code is used to make the web page responsive in any web browser.
  • The <style> tag is used to style the webpage, which includes the type of font, alignment, display etc.

Fig. 9: HTML web page

  • Next comes the HTML form for user input. We are going to create two data input fields for user input and each filed is having a Post button to send the new data string to the ESP device and the variable declared to store the input will be updated.
  • <form> tag is used to create the HTML form. Here we are creating an HTML form with two input fields namely the Data_field2 and Data_filed2 and each field is having individual Post buttons to post the input from the web server to the client.
  • The action attribute is used to specify, where to send the data input provided in the input data fields after pressing the post
  • After pressing the post button a new web page will open, indicating the status whether the input string is successfully posted or not.

Fig. 10: HTML form for data input

  • The two attributes, type and value specifies a button and the text on the button respectively.

Fig. 11: Post button.

  • If we make an invalid request, the notFound() function will be called.
 

Setup

  • Initialize the serial monitor at 115200 baud rate for debugging purpose.
    • begin() function is used to initialize the Wi-Fi module with Wi-Fi credentials used as arguments.
    • The While loop will continuously run until the ESP32 is connected to Wi-Fi network.

Fig. 12

  • If the device is connected to local Wi-Fi network then print the details on serial monitor.
  • localIP() function is used to fetch the IP address.
  • Print the IP address on serial monitor using println() function.

Fig. 13: Fetch/obtain the IP adrress

  • Initialize the 16*2 LCD using begin() function.
  • Clear the previous data from the LCD before printing or displaying the new one using clear() function.
  • Set the cursor position at row 1 and column 0 using setCursor() function.

Fig. 14: Set 16*2 LCD

  • begin() function is used to initialize the web server once ESP32 is connected with the Wi-Fi network.

Fig. 15: Initialize the server

Handling HTTP GET requests

  • The next part in the programming includes handling of HTTP GET requests.
  • When we access the route URL, we send the web page to client along with the data input fields.
  • We have defined a variable namely index_html to save the HTML text.

Fig. 16: Send web page to client

  • Next task is handling what happens when device receive a request on the /get routes.
  • To save input values, we have created two variables: inputPram and

Fig. 17

  • Next we need to check if HTTP get request contains the Data_input1 and Data_input1 These fields values are saved on PRAM_INPUT_1 and PRAM_INPUT2.
  • If the HTTP GET request contains inputs, then the inputMessage1 will be set to the value inserted in the data_field1.

Fig. read the input from HTML form

  • Else there will be no input for inputMessage.

Fig. 18

  • Print the input value saved on variable inputMessage using Serial.print command.
  • clear() command is used to clear the previous data printed on LCD.
  • New data or message received from the web server will be printed on the LCD display using print() function.

Fig. 19

  • After pressing the post button a new web page will open, indicating the status whether the input string is successfully posted or not.

Fig. 20

Testing

  • Open your Arduino IDE and paste the above code.
  • Change the network credentials, that is the SSID and PASSWORD as per you network setup.
  • Compile and upload the code into ESP32 development board.
  • Before uploading the code make sure that you have selected the correct development board and COM port.

Fig. 21: Select development board and COM port

  • Once the code is uploaded successfully, open the Serial monitor and select the 1115200 baud rate (as per your code instructions).
  • Make sure Wi-Fi to which your ESP device is supposed to connect is ON.
  • Once your ESP32 is connected to the internet, the IP address of the device will be printed on the Serial monitor.
  • Copy the IP address.
  • Open the browser and paste the IP address and press
  • A web page with HTML form containing two input fields will open as shown below:

Fig. 22: web Page

  • Enter the text in the HTML form you want to be printed on on the LCD display.
  • Press the Post

Fig. 23: Enter the Input to ESP32

  • After pressing the post button a new web page will open, indicating the status whether the input string is successfully posted or not.

Fig. 24: Input Updated

Fig. 25: IP address and Web Input on serial monitor.

Fig. 26: String input received from Web server, printed on LCD

This concludes the tutorial. We hope you found this of some help and also hope to see you soon with a new tutorial on ESP32.

Server-Sent Events with ESP32 and DHT11

Hello readers, I hope you all are doing great. In this tutorial, we will learn how to update a webpage using Server-Sent Events and the ESP32 web server.

Where To Buy?
No.ComponentsDistributorLink To Buy
1ESP32AmazonBuy Now

What is Server-Sent Events (SSE)?

It is a server push technology that enables the client devices to receive automatic updates from a server over HTTP (Hypertext Transfer Protocol) connection. SSE also describes how the server can initiate data transmission towards the client once an initial connection with the client has been established.

We have already posted a tutorial on how to implement Web socket protocol with ESP32 which is also a protocol used to notify events to a web client. Both the Server-Sent Events (SSE) and Web-Socket technologies seem to be quite similar but they are not.

The major difference between the two is that SSE is unidirectional, where the web client can only receive the updates from the ESP32 but it can’t send updates back to ESP32. On the other hand, the Web-socket protocol is bi-directional where both the web client and ESP32 can send and receive updates/events.

Fig. 1 Server-Sent event

How does the Server-Sent Event works?

The Server-Sent Event process initiates with an HTTP request from the web client or web page to the ESP32 web server. After that, the ESP32 is ready to send updates or events to the web client as they happen. But the web client can’t send any response or data to the ESP32 server after the initial handshake takes place.

Server-sent event technology can be used to communicate an event, GPIO states or to send sensor readings to the web client, whenever a new reading is observed.

Project Overview

For demonstration purpose, we are using a DHT11 sensor with the ESP32 module. ESP32 web server will display two things i.e., temperature and humidity observed using the DHT11 sensor. So, whenever a new reading is being observed, the ESP32 sends the reading to the Web Client over Server-sent events. After receiving the latest sensor reading the client updates the web page data.

Software and Hardware requirements

  • ESP32 development board
  • DHT11 sensor
  • Connecting Wires
  • Breadboard
  • Arduino IDE
  • Necessary Libraries

DHT11 (a Temperature and Humidity sensor)

Fig. 2 DHT11 sensor

DHT11 is a humidity and temperature sensor that measures its surrounding environment. It measures the temperature and humidity in a given area. It is made up of an NTC (negative temperature co-efficient) temperature sensor and a resistive humidity sensor. It also has an 8-bit microcontroller. The microcontroller is in charge of ADC (analog to digital conversion) and provides a digital output over the single wire protocol.

The DHT11 sensor can measure humidity from 20% to 90% with +-5 percent accuracy (RH or relative humidity) and temperature from 0 degrees Celsius to 50 degrees Celsius with +-2C accuracy.

DHT11 sensors can also be used to build a wired sensor network with a cable length of up to 20 meters.

Interfacing DHT11 with ESP32 module

Table 1

Note: Connect a 10K resistor between data and power (+5V) pin of DHT11 sensor module.

Fig. 3 ESP32 and DHT11 connections/wiring

Programming with Arduino IDE

We are using Arduino IDE to compile and upload code into the ESP32 module. You must have ESP32 board manager installed on your Arduino IDE to program the ESP32 module. To know more about Arduino IDE and how to use it, follow our previous tutorial i.e., on ESP32 programming series. The link is given below:

https://www.theengineeringprojects.com/2021/11/introduction-to-esp32-programming-series.html

Steps to add the necessary libraries in Arduino IDE:

  • Go to Tools >> Manage Libraries.

Fig. 4 manage libraries

  • Search for the necessary library in Library Manager and click Install.
  • We are attaching an image, where we are installing the DHT11 sensor library.

Fig. 5 Install DHT sensor library

  • Follow the similar procedure for rest of the libraries.
  • After successfully installing all the required libraries close the Library Manager tab.

ESP32 board manager doesn’t come with inbuilt libraries to create an asynchronous web server. So we need to download the library file from external sources and then add into Arduino IDE.

We need to install two library files:

  1. ESPAsynWebServer: Follow the link https://github.com/me-no-dev/ESPAsyncWebServer to download the respective library.
  1. AsyncTCP: You can download the AsyncTCP library from the following link https://github.com/me-no-dev/AsyncTCP

Once you have successfully downloaded the required libraries, next step it to install or add these libraries in Arduino IDE.

To add the libraries in Arduino IDE, go to Sketch >> Include Library >> Add .zip library and then select the downloaded library files.

Fig. 6 adding necessary libraries

Arduino Code

#include <WiFi.h>

#include <AsyncTCP.h>

#include <ESPAsyncWebServer.h>

#include "DHT.h"

#define DHTPIN 4 // Digital pin connected to the DHT sensor

#define DHTTYPE DHT11 // DHT 11

// Initializing the DHT11 sensor.

DHT dht(DHTPIN, DHTTYPE);

// Replace with your network credentials

const char* ssid = "SSID";

const char* password = "password";

// Create AsyncWebServer object on port 80

AsyncWebServer server(80);

// Create an Event Source on /events

AsyncEventSource events("/events");

// Timer variables

unsigned long lastTime = 0;

unsigned long timerDelay = 20000; //20 sec timer delay

//==== Creating web page

const char index_html[] PROGMEM = R"rawliteral(

<!DOCTYPE HTML><html>

<head>

<title>SSE with ESP32 Web Server</title>

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">

<link rel="icon" href="data:,">

<style>

html {font-family: Times New Roman; display: inline-block; text-align: justify;}

p { font-size: 1.2rem;}

body { margin: 0;}

.topnav { overflow: hidden; background-color: blue; color: white; font-size: 1rem; }

.content { padding: 20px; }

.card { background-color: #ADD8E6; box-shadow: 2px 2px 12px 1px rgba(140,140,140,.5); }

.cards { max-width: 600px; margin: 0 auto; display: grid; grid-gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.reading { font-size: 1.4rem; }

</style>

</head>

<body>

<div class="topnav">

<h1>Server-Sent Events </h1>

<h2> DHT11 Sensor Data </h2>

</div>

<div class="content">

<div class="cards">

<div class="card">

<p> DHT11 Temperature</p><p><span class="reading"><span id="temp">%TEMPERATURE%</span> &deg;C</span></p>

</div>

<div class="card">

<p> DHT11 Humidity</p><p><span class="reading"><span id="hum">%HUMIDITY%</span> &percnt;</span></p>

</div>

</div>

</div>

<script>

if (!!window.EventSource)

{

var source = new EventSource('/events');

source.addEventListener('open', function(e)

{

console.log("Events Connected");

}, false);

source.addEventListener('error', function(e)

{

if (e.target.readyState != EventSource.OPEN)

{

console.log("Events Disconnected");

}

}, false);

source.addEventListener('message', function(e)

{

console.log("message", e.data);

}, false);

source.addEventListener('temperature', function(e)

{

console.log("temperature", e.data);

document.getElementById("temp").innerHTML = e.data;

}, false);

source.addEventListener('humidity', function(e)

{

console.log("humidity", e.data);

document.getElementById("hum").innerHTML = e.data;

}, false);

}

</script>

</body>

</html>)rawliteral";

 

void setup() {

Serial.begin(115200); //initialize serial monitor

//===set and initialize Wi-Fi

WiFi.mode(WIFI_STA);

WiFi.begin(ssid, password);

Serial.print("Connecting to WiFi ..");

while (WiFi.status() != WL_CONNECTED)

{

Serial.print('.');

delay(1000);

}

Serial.print("IP Address: ");

Serial.println(WiFi.localIP()); // print the IP address

//====Initialize DHT11 sensor

dht.begin();

//====Handle Web Server

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){

request->send_P(200, "text/html", index_html);

});

// Handle Web Server Events

events.onConnect([](AsyncEventSourceClient *client)

{

if(client->lastId())

{

Serial.printf("Client reconnected! Last message ID that it got is: %u\n",

client->lastId());

}

// send event with message "hello!", id current millis

// and set reconnect delay to 1 second

client->send("hello!", NULL, millis(), 10000);

});

server.addHandler(&events);

server.begin();

}

void loop()

{

delay(2000);

float humidity = dht.readHumidity();

// Read temperature as Celsius (the default)

float temperature = dht.readTemperature();

// Check if any reads failed and exit early (to try again).

if (isnan(humidity) || isnan(temperature))

{

Serial.println(F("Failed to read from DHT sensor!"));

return;

}

if ((millis() - lastTime) > timerDelay)

{

// Send Events to the Web Server with the Sensor Readings

events.send("ping",NULL,millis());

events.send(String(temperature).c_str(),"temperature",millis());

events.send(String(humidity).c_str(),"humidity",millis());

Serial.print(F("Humidity(%): "));

Serial.println(humidity);

Serial.print(F("Temp.: "));

Serial.print(temperature);

Serial.println(F("°C "));

}

}

Code Description

  • Here we are using four libraries:
    • The first one is WiFi.h, which is used to enable the Wi-Fi module and hence wireless network connectivity.
    • DHT.h is used to call the necessary functions required to interface DHT sensor with ESP32.
    • ESPAsynchWenServer library file is responsible for creating an asynchronous web server.
    • AsyncTCP is used to enable multi-connection network for ESP32 (Espressif’s) microcontroller unit.

Fig. 7 Header files

  • Next step is the declaration of variables for DHT11 sensor.
  • We are declaring 2 variables, the first one is the DHTPIN to store the GPIO number receiving input from DHT11 sensor and another variables is to define the type of DHT (i.e., whether DHT11 or DHT22).

Fig. 8 Global declarations

  • Next we are creating a DHT object called dht in the DHT sensor type (defined earlier) and the DHT pin.

Fig. 9

  • Enter the network credentials in place of SSID and PASSWORD.

Fig. 10 Enter Network credentials

  • While creating a web server we also need to assign a port and usually port 80 is used for local web server.

Fig. 11 Server port

  • Next step is creating a new event source(on /events).

Fig. 12 Event source

  • Timer variable declaration: the timerDelay and lastTime variables are declared to add delay using timer, instead of using delay() function. Here we are adding a delay of 20 seconds which means the web browser will be updated with new sensor reading in every 20 sec.

Fig. 13 Timer Variables

Creating the Web Page

  • !DOCTYPE html><html> is used to describe/indicate that we are transmitting HTML, this command should always be the first thing we send.
  • <title> tag is used to write title for the web page.

Fig. 14

  • The <style> tag is used to style the webpage, which includes the type of font, alignment, display, color, dimensions etc. You can make changes in the <style> tag as per your requirements.

Fig. 15

  • The content, which is to be displayed on the Web page is written inside the <body> tag. The <body> tag includes two headings h1 and h2 and sensor readings (temperature and humidity).

Fig. 16

Initializing an Event-Source connection

  • JavaScript is written inside the inside the <script> tag, which is responsible for initializing an event source connection with the web server and also to handle the events received from the web server.
  • An object EventSource is created and along with that the URL of the webpage sending the updates is also specified.
  • addEventListener() function is used to listen to the messages coming from the web server, once the event source is initiated successfully.

Fig. 17

  • Next task is adding an event listener for Whenever a new temperature reading is observed from the DHT11 sensor, ESP32 sends a “temperature” event to the web client.

Fig. 18

  • Similarly, another event is generated for It prints the latest readings on the web browser & puts the received data into the element with respective ID on the webpage.

Fig. 19

Setup

  • Initialize the serial monitor at a 115200 baud rate for debugging purposes.
    • begin() function is used to initialize the Wi-Fi module with Wi-Fi credentials used as arguments.
    • The While loop will continuously run until the ESP32 is connected to the Wi-Fi network.

Fig. 20

  • If the device is connected to a local Wi-Fi network then print the details on the serial monitor.
  • localIP() function is used to fetch the IP address.
  • Print the IP address on the serial monitor using println() function.

Fig. 21 Fetch/obtain the IP address

 

Fig. 22 Initialize DHT sensor

Handling HTTP GET requests

  • The next part in the programming includes handling HTTP GET requests.
  • When we access the route URL, we send the web page to the client along with the data input fields.
  • We have defined a variable namely index_html to save the HTML text.

Fig. 23

Handling Server Event source

  • The next task is setting up the event source on the webserver.

Fig. 24 Handling server events

 

Initializing web server

  • Initialize the webserver using begin() function.

Fig. 24 initializing web server

 

Loop()

  • DHT11 is a very slow sensor. It takes almost 250ms to read temperature and humidity.
  • So it is preferred to wait a few seconds before a new measurement or updated sensor reading.
  • Next, we are defining a float type variable ‘h’ to store humidity measured from the DHT11 sensor.
  • readHumidity() function is used to observe the humidity value.
  • readTemperature() function is used to read the surrounding temperature with the DHT11 sensor.

Fig. 25

 
  • If somehow the sensor fails to read or observer temperature and humidity values, then the respective results will be printed on the serial monitor.

Fig. 26 If error occurs while reading data from DHT11

Sending Events to the server

  • Send the updated events or the latest observation from the DHT11 sensor the web browser over the local network.
  • The sensor readings will be updated in every 20 second as per the code instructions.

Fig. 27 Sending events to the server

  • Print the temperature and humidity readings (observer form the DHT11 sensor) on the Serial monitor.

Fig. 28 Print Sensor data on the Serial monitor

Testing

  • Open your Arduino IDE and paste the above code.
  • Change the network credentials, that is the SSID and PASSWORD as per you network setup.
  • Compile and upload the code into ESP32 development board.
  • Before uploading the code make sure that you have selected the correct development board and COM port.

Fig. 29 Select development board and COM port

  • Once the code is uploaded successfully, open the Serial monitor and select the 1115200 baud rate (as per your code instructions).
  • Make sure Wi-Fi to which your ESP device is supposed to connect is ON.
  • Once your ESP32 is connected to the internet, the IP address of the device will be printed on the Serial monitor.
  • Copy the IP address.
  • Open the browser and paste the IP address and press
  • A web page will appear, as shown below:

Fig. 30

  • The web page will be updated with new data every 20 seconds, as per the code instructions and we do not even need to refresh the web page for latest event updates due to SSE technology.

Fig. 31

This concludes the tutorial. I hope you found this of some help and also hope to see you soon with a new tutorial on ESP32.

Up Down Counter without Microcontroller

Hello geeks, welcome to our new project. In this project, we are going to make a very interesting project. I think most of us have seen the scoreboards in sports, after looking at that, have you ever wondered about the working of it. Therefore, this time, we will be making something like that only with some extra features. So basically that score board is nothing but a counter which counts the scores. Most of the geeks who have an electronics background or have ever studied digital electronics must have heard about the counter.

Here, in this project, we are going to make an Up-Down counter. A simple counter counts in increasing or decreasing order but the Up-Down counter counts in increasing and decreasing order, both depending upon the input it has given.

But I am having an interesting question about the counter. Let suppose if the counter is counting in increasing order then up to which value, it will count because it can not count to infinite which means it has to reset after some certain value, and I believe that you must be having the same doubt as well. Basically every counter resets itself after a certain value and that value depends upon the bits of a counter.

Let suppose, we have a 8 bit counter which means it will count a maximum of up to 255 after which, it will reset to 0. So the size of the counter depends upon the bits of the counter.

So, in this project, we are going to make a counter which will count from 0 to 9 after which it will again reset to 0.

Software to install

We will make this project in the simulation first, for that we will use a simulation software which is Proteus.

Proteus is a simulation software for electronics based circuits. In this software we can make different types of electronic circuits and we can run the simulation and can monitor the working of that project in real-time only.

And it is a good practice also while making any new project. First of all, we should make a simulation of that project so that we can debug any issues without damaging any real components.

Proteus has a very huge database of all types of electronics components pre-installed.

Components Required

In this project, we will use the following components:

  • 7 Segment LED display
  • Push buttons
  • Resistors
  • 74LS192 (BCD/DECADE UP/DOWN COUNTER)
  • 7447 BCD to 7-Segment Decoders/Drivers

Components details

7 Segment Led display

  • It is an LED display module in which there are seven LEDs arranged in the rectangular form on which we can display single digit numbers from 0-9 and some alphabets as well.
  • It has two types, one is common ground and another is common Vcc.
  • There are 7 different pins for each LEDs and one common pin, this pin can be common ground or common Vcc depending upon type of the display.
  • The pins on the display are noted as a,b,c,d,e,f, and `g.
  • Common ground is also known as Common cathode, and common Vcc is also known as Common anode .
  • In Common cathode type display, the LEDs will glow when LEDs pins are connected to logic HIGH.
  • In Common anode type display, the LEDs will glow when the LEDs pins are connected to logic LOW.
  • As they are simple LED’s so while using them in the circuit, it is mandatory to use some protection resistors with each of them if we are using Common ground type display and single resistor with the Common Vcc pin if we are using the Common Vcc type display.
  • For the counter, we will follow the truth table of display for showing the numbers.

Push buttons

  • Here, we have used a simple momentary push button for setting the counter in UP counting or in DOWN counting.
  • There are two pins in the push button.
  • As we will use the push buttons in active low condition which means one side will be connected to ground and other terminal will be connected to the Arduino.
  • So when we press the push button, it will close the circuit and set the pin.
  • While using any push button, it is mandatory to use a pull-up or pull-down resistor with it, otherwise there will be some glitches in the operation.
  • Because when the button is released, the circuit will be opened and if there is no pull-up or pull-down connected to the other pin of the push button, then that pin will be in floating state and it will give any random voltage, which will create an issue.
  • In this project, we have used the pull-up resistor so that when the push button is released, the pin state will be in logic HIGH state.

BCD/Decade Up-Down counter (74LS192)

  • 74LS192 is an Up/Down BCD decade counter IC. It is developed by Motorola.
  • This is the main IC which is used in this project for counting purposes.
  • It is one the simplest IC for Up/Down counters. It has two different input pins for selecting the Up counter or Down counter mode.
  • It is a 16 pin TTL based IC. Operating voltage of the IC is 5v.
  • And as per the data sheet for selecting the mode of counter there are basically four pins used and those are MR, PL, CPU, CpD.
  • For counting, the MR pin should be logic LOW and the PL pin should be in logic HIGH.
  • To start the counting in increasing order or upward, the down counter input pin(CpD) should be at logic HIGH state and the up-counter input pin (CpU) should send a pulse from logic LOW to logic HIGH after this sequence the IC will count upwards.
  • We have to follow the same sequence for counting in decreasing order or downward, the up counter input should be at logic HIGH state and the down counter input pin (CpD) should send a pulse from logic LOW to logic HIGH after this sequence the IC will count downwards.

Truth Table for Modes

7447 BCD to 7-Segment Decoders/Drivers

  • This IC is used in this project for controlling the 7-segment LED display.
  • This is an active low output IC which means we can use its common anode LED display only.
  • It basically converts the BCD number to decimal numbers on the 7-segment LED display.
  • It has 4 input pins for reading the BCD input and depending upon which it will set the output pins for the 7 segment display.
  • To set input pins depending upon the required output we will follow its truth table.

Project overview

In this project, we will use two push buttons for controlling the counter as an Up counter or Down counter. The outputs from the push buttons will work as input for the BCD/DECADE UP/DOWN COUNTER IC. When we press the push button, there will be a change in the signal pin of the IC and according to the truth table when the signal changes from logic HIGH to LOW and the other input clock pin is at HIGH state then it will change the output count value depending upon the selected pin.

Which means if we push the Up counter push button, it will send a pulse to CpU pin of the IC, afterwards it will process as the increment in the output value, so it will increase the current output value by one. Similarly, for the Down counter push button, when we press the button, it will send a pulse to the CpD pin of the IC, thereafter it will process as the decrement in the output value so it will decrease the current output value by one.

And the outputs of the BCD/DECADE UP/DOWN COUNTER IC will work as the input for the BCD to 7-Segment Decoder. And the output pins of the BCD to 7-Segment Decoder will be connected to the 7 segment LED with some protection resistor to prevent them from damaging.

The 7-Segment Led display will glow the LEDs depending upon the output values on the BCD to 7-Segment Decoder/Driver.

Now we know the workflow of our counter.

So let‘s move to the circuit of the counter.

Circuit diagram and working

For making the project, we will be using the Proteus simulation software.

  • First, start the new project in the Proteus and import all the required components into the workplace.
  • After importing all the components in the workplace, let’s start connecting those.
  • First of all, we will connect the push button with the BCD counter IC.
  • As we know, the push button has to be connected in pull mode so we will connect a resistor with each of the push buttons and another terminal with the BCD counter IC.
  • Another terminal of the Up counter push button will be connected to the ‘UP’ pin of the BCD counter IC and the Down counter push-button terminal will be connected to the ‘DN’ pin of the counter IC and other pins like MR will be connected to the Vcc and PL pin will be connected to the ground.
  • All the connections are made as per the datasheet of the IC.
  • After this, we will connect the output pins of the BCD counter to the input pins of 7 segment LED driver IC. While connecting the pins of the IC, make sure they are connected in the correct sequence otherwise it will not display the correct value on the LED display.
  • Now we will connect the protection resistors and the 7-segment LED display with the output of the 7 segment LED driver IC.
  • After connecting them our circuit will be ready.
  • Before testing it, do not forget to re-verify the connections.

Result and test

Now we have our circuit ready, it is time to test it.

  • Start the simulation by clicking on the play button in the Porteus simulation.
  • First we will check for the Up counter.
  • Press the Up counter push button. When we press the Up counter push button then the value on the 7 segment display will increase and if we continuously press it then the counter will go up to 9, afterwards it will reset to 0.
  • Now check the Down counter. Press the Down counter push button, then the value on the 7 segment display will decrease and if we continuously press it then it will reach to 0 and thereafter it will start from the 9 again and will be decreased to 0.

Conclusion

I hope we have covered all the aspects of this project. And I think it will be a very useful learning project as well. Now if we see any scoreboard, immediately we will be knowing the electronics behind it. I hope you have enjoyed reading this project. Please let us know in the comment section if you have faced any issues while making this project.

Thanks for reading this article. See you in the next project.

Role of Cloud Computing in IoT

Hi Everyone! Glad to have you on board. Thank you for clicking this read. In this post today, I’ll cover the Role of Cloud Computing in IoT.

Digital transformation has gained momentum in the past few years, the reason traditional technologies are becoming obsolete over time. Now organizations are incorporating modern technologies into their business model at an accelerated pace. These technologies produce the influx of data and at times it becomes very difficult to process and handle that data, thanks to cloud computing that has made the handling of data easy and effective. You don’t need traditional data centers anymore to store and process information. Everything will be taken care of remotely in the cloud with data centers.

Not to mention, this is the era of automation. Companies strive to accommodate automation in the activities of their business so they can achieve maximum output without the interference of humans. And this trend complements the arrival of IoT (internet of things). The IoT is nothing but a data source and cloud computing is used to store and process that data. We’ll touch on this further in this article.

Scroll on.

Role of Cloud Computing in IoT

Both cloud computing and IoT are separate terms but can work together for better efficiency and productivity. The former is an architecture that offers on-demand computing resources to the end-users to process, store and handle data over the internet while the latter is a technology that acts as a data source from where data is produced. In simple words, IoT (internet of things) is a network of ‘things’ like physical objects, humans, and machines connected and collect and exchange data in real-time through embedded sensors. For instance, a human with a heart monitoring device and a car with sensors that send an instant alert to the driver for any danger fall under the umbrella of IoT.

According to Statista, “the total Internet of Things (IoT) connected devices worldwide is expected to reach 30.9 billion units by 2025, compared to 13.8 billion units that were expected in 2021.”

This projects that billions of devices connected will produce enormous data which makes cloud computing a major part of the IoT technology. Both IoT and cloud computing are inseparable and make an effective integration. In the following, we’ll stretch on this further.

How Cloud Computing and IoT Work Together

As touched on earlier, IoT devices are connected with each other and can produce a flood of data that needs to be handled and processed somewhere. Cloud computing serves that purpose. If IoT devices are connected with traditional data centers, it takes a capital investment to install, manage, scale and upgrade machines on-premises to handle that data. While with cloud computing, virtual infrastructure is created that allows the developers to access and handle computing resources remotely without having to worry about the management of on-site IT infrastructure.

There are cloud service providers that offer cloud computing services to end-users. The common service providers include AWS (Amazon Web Services), Google Cloud, and Alibaba Cloud. The computing capabilities they offer are virtually endless that can effectively process and store the information produced by IoT devices. These providers commonly offer pay-as-you-go service which means you can scale up or scale down the resources as per the requirement of connected IoT devices.

Advantages of Cloud Computing with IoT

Cloud computing and IoT are not the same but they complement each other. The following are the main advantages of combining IoT data with cloud computing infrastructure.

1: Cloud Computing Secures IoT Data

Security is the top priority for any organization to run its business activities successfully. And when companies use cloud computing to their advantage, it gives them a sense of security because your data is processed and stored in remote data centers managed globally. The cloud service providers have a network of servers located at multiple locations which means your data is not stored at one data center, instead, the system creates files of your data at multiple locations in different data centers. If one server goes down, you can get a copy of data from another server.

Whether you pick private cloud or public cloud is another parameter to guarantee the security of your sensitive data. This is how it works – companies use the public cloud for storing a large amount of data and the private cloud to process sensitive data locally. If you want to keep your IoT safe and secure, you can pick a private cloud for this purpose.

2: Cloud Offers Mobility to IoT Data

Cloud makes IoT data easily accessible which means you can remotely access information produced by IoT devices from anywhere in the world. Quick and on-spot data access is crucial when it comes to monitoring information gained by connected IoT devices. In IoT technology, we often get continuous readings from the attached sensors and that readings need to be stored and monitored quickly to make instant decisions.

To stretch this further, you can even use edge computing (which is the extension of cloud computing) to your advantage for handling IoT data. The difference between edge computing and cloud computing is the time it takes to process the information. In edge computing, data doesn’t go to the cloud, instead, it goes to the edge device installed near the data source which takes less time to process it.

3: Cloud Model is Cost-Effective for IoT technology

IoT-based businesses often pick cloud computing to speed up their business operations. Since on-site IT infrastructure is costly and requires up-front payment for the management of traditional data centers. While cloud models remove the hassle of hardware maintenance and give you the flexibility to pick the pricing package best suitable for your business needs.

Common Questions

The following are the frequently asked questions when it comes to integrating IoT with cloud computing.

Is Cloud Computing Necessary for IoT?

Technically speaking the answer is no and yes. NO, if you want to locally process your data in on-site IT infrastructure. YES, if you want to leverage the cloud since it’s preferable to pick the cloud model when there is a flood of information to be handled and stored.

How does cloud computing work with IoT?

There are four different cloud models named public cloud, private cloud, hybrid cloud, and community cloud. You can pick any model based on your business needs and requirements. It all depends on the type of data you want to manage and store. For sensitive information to manage, you can prefer the private cloud model, and for non-sensitive, you can opt for the public cloud model. A hybrid model is another option that gives you the option to integrate both private and public clouds into your business.

How do I know if the cloud is right for me?

It depends on the requirement of IT infrastructure. Do your current IT requirements constantly change over the year? Do local data centers cost you more? What is the type of data? The number of connected IoT devices? These are the main questions you need to ask if you need a cloud model or not. This cloud architecture is mainly suited for you if want cost-effective and reliable solutions to handle enormous data.

 

Conclusion

Technology is evolving and every business uniquely works to keep up with the pace of this technology.

Billions of devices are expected to be connected through IoT technology, the information produced by these devices is difficult to handle if you apply the traditional approach to handle and process that information.

As the demand to handle and manage a data grows, organizations will integrate cloud computing into their business models.

And on-demand availability with cloud computing is what makes this model more attractive since this way you can monitor and access your information remotely from anywhere in the world. This trend will complement the usage of more IoT devices in the cloud computing model.

It is safe to say that cloud computing is expected to open new and flexible opportunities for IoT-based businesses to handle, store and process a bulk of data.

That’s all for today. Hope you loved reading this article. If you’re unsure or have any questions, you can ask me in the section below. I’d love to help you the best way I can. Feel free to share your experience with the IoT and cloud computing integration. Thank you for reading this article.

How to order PCB for manufacturing from JLCPCB

JLCPCB (JiaLiChuang Co. Limited) is a worldwide PCB & PCBA Fabrication enterprise. It is a leading company in high-tech manufacturing products specializing in PCB and PCBA production. With over a decade of experience in PCB manufacturing JLCPCB has made over a million customers through online ordering by the customers of PCB manufacturing and PCBA production.

JLCPCB is a professional manufacturer of large-scale manufacturing of PCBs, well equipment, strict management, and superior quality. It deals with the production of all types of PCBs, Stencils, and SMT.

In this article, we are going to discuss widely how the company operates its ordering system of the PCBs by their customers for production through the online booking process.

JLCPCB SMT Services

Normally, SMT components are used in professional/industrial PCBs and JLCPCB offers the best SMT services. You should first check these JLCPCB SMT services to get an idea. Let me highlight its important points:

  • JLCPCB offers single-sided placement on the PCB board.
  • JLCPCB has an extensive Library for SMT parts and you need to select the components from there.
  • JLCPCB manufacture SMT Components in-house and thus gives the best results.
  • JLCPCB places automated solder paste and then performs Solder Paste Inspection(SPI).
  • I have attached the SMT Assembly screenshot in the below figure:
You can check JLCPCB SMT Services from this video as well:

So, it's quite easy to order for manufacturing of Metal Core PCB on JLCPCB.

How to place an order online

Ordering of PCB at JLCPCB is not a complicated process, since the system is user-friendly to every customer. The steps below show the steps to be followed when placing an order.

STEP 1:

Register on the official site of JLCPCB, if you don’t have an account. if you already have an account just log in

STEP 2:

After login into one account. It will display a home page with a quotation calendar that will display an ordering page. On the quotation calendar, the customer would be asked to enter the size of PCB which he/she requires, quantity, layers, and thickness of their choice

STEP 3:

In this step, the customer is required to enter the PCB board details on the online calculator to get the price of the quoted items in step 2. Also, there is the minimum price which is the cheapest one for a particular PCB.

STEP 4:

Then click to “Add your Gerber file” this will upload the file. There are written guidelines on how to generate different Gerber files in the best format on the well-known circuit design program found in the company industry. A very small customer ID is always added to the PCB ordered to distinguish the PCB order from all others.

If one wants to put it in a specific location you are required to indicate the location by adding a unique text like “PBCJLPBCJL”

The system will analyze the file Gerber to confirm the dimensions and layers of the board after uploading the Gerber file.

STEP 5:

Then click the “Gerber viewer” to the design of the boards. Customers are advised to confirm the Gerber file carefully for any errors. After checking and confirming the errors and no problem is detected just click “save to cart” and continue to the next step

STEP 6:

After saving to cart then click “add new item” if you want to order multiple PCBs repeat the same steps from the beginning as you add both of them to the cart.

STEP 7:

Expand the cart and view all the details of the PCBs ordered, including the price of each one of them, its specifications, and all the number of PCBs ordered.

STEP 8:

After viewing all the details in the cart and seeing all the PCBs you wanted click the “checkout securely” button

STEP 9:

On the checkout, menu add your shipping address where are the PCBs are to be shipped. The country where the PCBs are shipped determines the rates. Also, the shipping options are found on the same page just below the address. The shipping methods available are DHL and Airmail both of them vary in their delivery time.

This is the payment method. JLCPCB offers two kinds of payment methods which include

  1. Pay directly: this is the most recommended method of payment by the company. It is recommended since it ensures the high efficiency of manufacturing. If the customer file hasn’t been reviewed for production you will get a refund.
  2. Review before payment: one can pay after the file has been approved. In this method, the design will not be produced until payment is made. Results of the review will be made through email. It is recommended to pay as soon as the file is approved to avoid delivery delays. When the file is not approved the order is automatically canceled.

When the order payment is made the company arranges the production where you can go through your “ACCOUNT” menu to track your order status.

Adding a new order to your existing order

Customers may sometimes feel the urge to add a new order to the existing order. This may be because may feel the items ordered are not enough or an increase in demand for the PCBs which were previously ordered

Here below we are going to go through the steps of how to add a new order to the existing order in JLCPCB.

STEP 1: log in to your account and locate the existing order.

When you log in the process will only go through if the existing order is still in the production process. If the order is finished and delivered you will not be allowed to add an order unless you make a fresh order.

STEP 2: You will open the ordering page, upload the Gerber file and add the items you want and click “combine”. Also, this will only appear if there is an extra shipping cost for the order added.

STEP 3: when you click “combine” a new order will be added to the existing order and you can check on its progress.

 

How to track your orders

After placing your order and payment has been made successfully, you can track your order through your account on the company website. Let’s discuss the steps to track your orders.

STEP 1: Open your order history

Login to your account and account menu click order history. After clicking on order history it will direct you to a previously placed orders page where all your previous orders are listed indicating their current status

STEP 2: Check your order status

Once you open the product files column file review status will appear and also the order status in the order status column. Then click order details to learn more.

STEP 3: Track production process

When you are put I am production-ready to be processed. Click the production progress to check the process.

STEP 4: Track shipment status

Once the order has been put into production and processed shipment process takes place. Once the shipment process has started a shipment notification will be sent through your email advising you on the shipment status of your order and the shipping tracking number. One can also use the JLCPCB company website to track the parcel. While on the website click shipment tracking and all the details about your parcel and delivery time information will be displayed.

 

Instructions for ordering PCBs from JLCPCB

Some users experience confusion during the online ordering placement of the PCBs from the company. Below are instructions on some routine internal actions JLCPCB will make when they receive the order.

PCB file and Gerber file in the zip file at the same time

A Gerber file is a file containing the format of the printed circuit design which is used in the fabrication of data. So while ordering the printed circuit boards on your account if both Gerber files and PCB files are in your zip file, the system will follow the Gerber file and reject the PCB file.

Solder resistance bridges

When the person ordering the PCBs does not specify on the solder mask bridge which is importantly required, it will be ignored. When doing the solder-resistance bridge a spacing between the pins needs to be 0.254mm and special notes on doing that are required.

The English description and the attachments on the zip file

Zip file attachments such as PDF files, EXCEL, DXF files, etc are ignored and PCB will be done according to the Gerber file provided. One should ensure the correct parameters are chosen and those needed to be converted into a Gerber file when placing your order. If otherwise, zip files attachment are important should be added to the remark field.

Plated slots/edge (not longer than 6mm)

In the presence of plated slot or edge, they should not be longer than 6mm, and make a note about it when placing the order or the system will make it for you. In the case where no note is provided the company will assume it and make it in the normal process.

Software incompatible issues

Since there is the use of different software by different clients to design the printed circuit board and the software where Gerber data is processed is not the same as the software used in designing the data it sometimes causes the software incompatibility problems to appear. Due to the reason of no warning notification when transferring and importing the data into the software so it is not easily noticeable and cannot be confirmed to the customers. This makes the company responsible for some of the problems caused by software incompatibility.

Markings on base materials

There are some marking that sometimes appears on the base material. This is because of some security issues and there is a way it can be removed. There is no track on which PCB will have the mark so all the PCBs have equal chances of having the marks. One should check from their side whether it is accepted while placing the order.

Gerberview

This tab is functional for reasons of reviewing the file quickly before paying for the order. Acts as the preview button on the website. At times the website causes errors when there is something wrong to display it exactly so it is advisable before placing the order to check the file carefully when you feel there is doubt.

Design about slots/v-cut/cut out/millings

The customer should ensure the v-cut line, cut out and millings are located on the same layer with the board outline. If not on the same layer with the board line it will not appear. It is advised when one is placing the order should check carefully because when it is missed due they are not in the same layer with the board outline the company will not be responsible.

Silkscreen/text

When you want the silkscreen clear on the PCB board the width of the texts and space between letters should not be less than 0.15mm and a width of not less than 1mm. when outline is the font is made and the solid part is filled with lines the fillings then should not be less than 0.15mm. the company will not modify the silkscreen on the Gerber file but the text may be widened. If the text is not enough the company will not be responsible for any complaints made regarding unclear texts caused by nonstandard design.

Layer PCB

JLCPCB company does not make 3 layer PCBs. If one orders a 4 layer PCB with a single inner layer, the company will process it with the 4 layer process directly and confirm with the customer again. So before placing an order confirm whether there is an inner layer miss or not.

Repeat order

This is the placing of orders same just as the previous one which had been successfully processed. With these orders, the company will not make any changes to the file which was used in the production. The customer should ensure not to leave any related note for the order to be changed while placing the order since the repeated order will not be checked manually by the engineers.

Items found on the board outline

The board outline is used to show how the PCB will look like when made. So everything that needs to be included in the board should be cut out clearly on the board outline. You should avoid the least useful items to avoid confusion. When both the GKO layer and the GM1 layer are found on the Gerber file the engineers will ignore the GKO layer and make boards according to the GM1 layer. when GMI, GM2 or GM2, GM3, GM4 layers are in the Gerber file at the same time, engineers will go for the smallest number after the letter GM as the outline layer by default.

JLCPCB panel

When you place an order to JLCPCB the JLCPCB panel will panel the order by default with the v-cut. JLCPCB only panels PCBs with rectangular and circle shapes. When you penalize the boards yourself but choose “Single PCB” when ordering, the numbers of designs/boards in the Gerber file should not be greater than 5, otherwise, we may cancel this order. If “Panel by Customer” has been chosen, the designs in the panelized Gerber file should not be greater than 10.

The remark field

The remark field is used when you place your order so that you can leave a note in case of any import, but the company does not recommend the use of this option since all the orders with an English note will take a longer time to get through the audition process.

Board larger than 200mm*250mm

Large boards sometimes the company might consider them, but if the good board available can not meet the quantity like the one ordered on the website due to the high cost of production they will ship the good boards and refund the difference to you.

Thickness of board outline design

The recommended thickness design of boards outlined by the company is 0.15mm. in a case when the board is greater than 0.15mm the centerline will be followed to make the board outline

Order cancellation

Orders missing crucial information such as the board outline, solder mask layer the order will be canceled out clearly during the audit process.

Orders beyond company capabilities

Orders beyond the company and engineers’ capabilities, will be canceled directly and an email will be sent to inform you about the reason. So before placing an order kindly check your file carefully before you pay for the order to save the loss due to the cancellation.

Removal of the order number

Order removal will not affect the functions of the boards if JLCPCB puts the order number at random or miss to remove. The removal of the order number will be refunded.

Easyeda generated file

Easyeda is a free online tool that we provide to design the PCB, and you can place your order on JLCPCB easily and quickly. But if there is a manufacturer error due to the design error, we may not responsible for that.

Silkscreen and solder mask openings

When the silkscreen overlaps with the openings on the board surface, the principle of openings first will be put into consideration. we will ignore the silkscreen and make the openings on the boards only. In the case where you want to keep the silkscreen on the openings, kindly make a note in the remark column so that the company engineers and factories pay attention to it and meet the required standards.

How to order PCB boards with solder mask defined pads

solder mask clearance is larger than the copper pad it’s exposing, in most PCBs, these pads are known as Non-Solder Mask Defined pads (NSMD).

Some of the other components have another type of solder mask called Solder Mask Defined pad. Which has a clearance of solder mask that is smaller than the copper pad. One can suggest pad and solder mask clearance size in the datasheet when applying. One should ensure that at least 3 mils (0.076mm) of the mask will be printed on all sides of the copper pad. The reason is registration tolerance on the solder mask placement if the mask is smaller than the pad there are possibilities that the mask could move enough exposing bare substrate which will lead to bad results.

How to transfer SMD INFORMATION TO JLCPCB

In the ordering system, there is no given option to add details on whether the board required has an SMD pad. If CAM engineers don’t get this kind of information the solder mask clearance for SMD pads will be enlarged to its default size.

When transferring SMD information to JLCPCB the following steps are used

Write a special instruction

On your account page in the ordering system, there is a text box called “PCB Remark”

Write a special instruction informing JLCPCB that your order design has an SMD pad

Confirm production file

After writhing the special instruction on the Remark box select “yes” for the “confirm production file” option

On clicking yes, the JLCPCB engineers will come up with a production file that is required to manufacture the PCB. When the production is put into consideration a check notification will appear where you can check and confirm it before reproduction. An email will be sent to you when the file is complete and ready for production. Download the processed Gerbers, pay attention to inspect the solder mask clearance for the SMD pads

Benefits of the ordering PCBs from JLCPCB

  1. Higher quality: JLCPCB has advanced its production technology by providing high precision boards suitable for industrial, military, and medical applications.
  2. Low cost: the company’s mission is to efficiently increase its production of PCB board at a lower cost. JLCPCB produces the cheapest but most efficient PCBs possibly because of extremely high production efficiency, and less human resource cost.
  • Fast delivery and user-friendly online ordering platform: the easy online ordering process have led the company to be a leading manufacturer of PCB with efficient and professional customer service, digital technology used in manufacturing, automatic production lines

and their able logistics partners make every step to deliver your PCBs faster.

  1. Shorten turn around time: PCB prototypes can be made faster even within 24hours because of the automated equipment and the fast technology we utilize the available capacity of our factories network so that system can match your orders to one of our factories which is best suited, in the shortest turnaround time.

Conclusion

JLCPCB is a good company since it provides great customer satisfaction, as long as you consider the time differences, and try to make orders with enough time to respond during your working days, and making orders, not near the weekend, they are well worth the money saved and the simple interface.

Their chat support is fairly good, and the assembly service is also mostly good.

Cloud Computing Advantages

Hi Guys! Hope you’re well today. Thank you for clicking this read. In this post today, I’ll walk through Cloud Computing Advantages.

Growing a business requires keeping up with modern technologies. And cloud computing is no different. Even though it’s not a new term and has been around for a long while, it still encompasses a huge potential to effectively run and manage business operations. Cloud computing is the provision of computing resources over the internet. These resources include storage, processing power, and databases.

Integrating more technologies (like IoT, AI) into the business models means it opens up opportunities to produce a large amount of data. And it’s very challenging to store and process that data on on-site data centers. This is where cloud computing comes in handy. It has the potential to effectively handle the flood of data while giving remote access to the developers to manage that data from anywhere in the world.

I suggest you read this entire article as it aims to cover the advantages of cloud computing.

Keep reading.

Cloud Computing Advantages

Cloud computing comes with scores of benefits. A few of them include cost saving, scalability, mobility, unlimited storage, security, instant collaboration, automatic software update, and more. we’ve discussed them one by one in the section below.

1: Cost Saving

Cost is crucial when it comes to successfully running your business. You need to take careful steps to spend capital investments. Using traditional ways to handle your data allows you to spend an upfront payment for the installation of complex IT hardware infrastructure. And this is not enough. You need money to maintain, scale and upgrade that system to effectively handle your data. Cloud computing prevents you from setting up hardware on-site and your data is managed and stored remotely over the cloud with data centers. You don’t need experts to use computing resources. Everything will be taken care of by the cloud service provider.

2: Scalability

Scalability is another big advantage that comes with cloud computing. You are not bound to pay for all the computing resources. Service providers offer pay-as-you-go service which means you’ll only pay for the resources you use for your business. For instance, you can pick the specific bandwidth, storage, and processing power to handle and store the data. Business requirements increase as the business grows over time. And at times it happens, based on the customer’s current needs and requirements you need to customize the approach. If you require less storage and processing power, you can ask for it from the service provider.

3: Mobility

Cloud computing offers mobility which means your data is not stored in any specific computer hard drive. That data is available online and anyone with an internet connection can access that data. This saves you from program failures or power shutdown. If the system on your location is not working, you can access the data from a different location as long as you have the device to work on and a strong internet connection.

4: Unlimited Storage Capacity

With cloud computing, you create a virtual office to handle the onslaught of data. It gives you the power to ask for unlimited virtual access to handle that data. With traditional data centers, creating unlimited storage capacity is very difficult since you need to upgrade the hardware which requires huge investments. This is not the case with cloud computing. Data centers are handled globally by the service provider and you only pay for the resources you use.

5: Security

Security is important to turn your business into a brand. More customers will rely on your applications if they know the information they share with you is safe and carefully handled. Data on the cloud computing servers is secure. No need to worry in case your sensitive data is deleted. Data centers on cloud computing are located at different locations and they create the copy of your data at different locations. This means if you’ve lost the data or the server at one location is down, you can use another server from a different location to claim that data. Cloud computing also offers an access management feature that gives access to sensitive data to your employees only, preventing that data from being attacked by potential hackers.

6: Instant Collaboration

Cloud computing allows instant collaboration between workers. Especially if you are working with freelancers or employees from remote locations. Any file or information shared on cloud computing gives instant access to that data from anywhere in the world. For instance, Google Drive or Dropbox are examples of cloud computing. Data available on these applications can be accessed by anyone anytime.

7: Automatic Software Update

The software and applications available on cloud computing get updated automatically. You don’t need IT experts to do manual updates. This is the job of your service provider. They instantly update their systems and software for security purposes to avoid any potential threats.

8: High Speed

In cloud computing data is managed over the internet. This means you can easily try new ideas and can simply apply new tweaks in the software within seconds. The data is remotely handled and any new software deployment gives you instant access to find the information in the software or any newly introduced application.

9: Disaster Recovery and Back-up

Cloud computing offers disaster recovery and backup features. At times the updates on your applications don’t work out and you instantly require the previous version. Cloud servers store the backup of your previous version. And if one server is down, cloud computing quickly moves the customers to the running servers, preventing you from big financial loss.

10: Better Control

Cloud computing allows you to have better control over data. It gives you different types of cloud models to pick from like public cloud, private cloud, and hybrid cloud. If you want to process your sensitive data locally, you can pick a private cloud, or if you want to store a large amount of data you can pick a public cloud. And the hybrid cloud is the combination of both private and public cloud which allows you the selectively handle and process your data over different clouds. Moreover, if you don’t want to remain dependent on one service provider, you can get services from two different service providers, this gives you to have better control over your sensitive data.

11: Competitive Advantage

Not every company picks cloud services to handle data. Some are not even aware of this architecture and even if they are aware, they are not willing to incorporate this infrastructure into this business model. If you choose cloud computing to manage your data, you will remain ahead of your competitors and can better store and process your data.

Conclusion

Cloud computing gives you benefits like security, scalability, unlimited data storage, data recovery, high speed, and more.

One wrong move in the initial steps of picking the right service provider can drastically impact your business.

It takes the right knowledge and skill to implement cloud computing into any business model.

Make sure you’re handling your sensitive data in the right hands who know how to effectively incorporate this cloud model into your organization.

Rest assured, if the service provider is reputable and expert in what they do, you’ll be better off with the cloud model to enhance the productivity, revenue, security, and collaboration of your enterprise.

That’s all for today. Hope you’ve enjoyed reading this article. If you’re unsure or have any questions, you can reach me in the section below. I’d love to assist you in the best way possible. Thank you for reading this post.

Types of Cloud Computing

Hi Guys! Happy to see you around. Thank you for clicking this read. In this post today, I’ll walk you through Types of Cloud Computing.

Cloud computing is not a new term. Companies have been using this infrastructure for the past two decades. You might be familiar with this term, in case you don’t, cloud computing is the on-demand availability of computing resources over the internet. Simply put, you can process, store and manage a large amount of data using this architecture. The companies offering these services to end-users are called Cloud Service Providers (CSP). And most of these services offer the pay-as-you-go model which means you can ask for only those computing resources required for your business; you don’t pay for the resources you don’t use in the cloud computing model. This liberates you from using on-site data centers for managing data, and you get computing resources online including storage, processing power, and databases.

I suggest you read this post all the way through as I’ll thoroughly cover the Types of Cloud Computing and how they can be used for improving the activities of any business.

Scroll on.

Types of Cloud Computing

Earlier on-site data centers were a norm for the management of large amounts of data, but cloud computing has gained momentum due to its ability to effectively manage and store the onslaught of data online. Moreover, since these resources are available online, you don’t need hectic IT drills to install, manage, scale or update traditional data centers. These data centers over the cloud are globally managed to give you access from anywhere in the world.

The following are the main types of cloud computing.

1: Public Cloud

2: Private Cloud

3: Hybrid Cloud

4: Community Cloud

No two clouds are the same and picking the cloud type is dependent on the business needs and requirements. Every cloud enables computing power over the network and allows the running of workloads within that system. These cloud models differ in terms of storage capacity, location, and accessibility but they all work on the same principle of virtualization. There is a lot of confusion in each type and I’ll try my best to remove these confusions so you can better understand what each type is all about. We’ll discuss them one by one in the section below.

1: Public Cloud

Public clouds are typically created for businesses but they are not owned by the individual business. Public cloud providers manage and run these clouds and offer services to organizations based on their current needs and requirements. The common public cloud providers include:

  • Amazon Web Services
  • IBM Cloud
  • Google Cloud
  • Microsoft Azure
  • Alibaba Cloud

This is the most cost-effective option for organizations that don’t have enough capital to invest in the development of IT infrastructure. Public cloud resources are shared by a variety of end-users which means this model is not made for a specific business. Instead, computing resources are shared among businesses of all sizes.

Although this is the preferably best option for businesses to handle a large amount of data, this model doesn’t guarantee the security of sensitive data since this architecture is shared by multiple organizations.

Moreover, this infrastructure offers less customization options and the service providers hold the main authority. A single tweak from the provider’s side can drastically impact your business. For improved security and better control over data, a private cloud is used.

2: Private Cloud

In a private cloud, computing resources are owned by a single organization. This model offers two options: resources can be hosted on-site IT infrastructure or businesses can hire a third party to host their computing resources.

Compared to the public cloud, this model is a bit expensive since it gives you more customization power with improved security. Companies dealing with sensitive data can pick this model since here resources are not shared by a variety of businesses.

Private cloud, if hosted on on-site data centers, gives you the power to fully control the computing resources and make the adjustment based on your internal processes and preferences. Even though this model gives you more control, you require professional IT experts to handle and manage the private cloud on-site. If you don’t want to involve yourself in the nitty-gritty of handling complex IT infrastructure required for private cloud, you can get services from a third party to host and manage your resources on their system. This way you still own the private cloud but you require less technical expertise for handling this model.

Better security is another advantage that comes with a private cloud. Companies require a large amount of data to be handled and stored and in the public cloud that data is vulnerable to cyber-attacks since the computing resources are shared by multiple end-users. To prevent your sensitive data from being compromised or deleted, it is better to keep this type of data within your private security boundary so no one can manipulate your data for their advantage.

3: Hybrid Cloud

Hybrid cloud combines both private cloud and public cloud. You can share data and applications between two clouds using this cloud deployment model. This way workload is not handled by a single cloud architecture, instead, it is shared by two different cloud models.

For instance, organizations need unlimited storage capacity to store a large amount of data, public cloud comes in handy for this purpose for handling non-sensitive data. While, on the other hand, if companies want the processing of sensitive data on the premises of their business, the private cloud is the solution.

Hybrid models are common since they set you free from the long-term investment on a specific cloud model, instead, you can use the combination of both models and ask for required computing resources valuable for your business.

4: Community Cloud

Community cloud is valuable for those sharing common business goals. A variety of businesses use cloud computing models including healthcare, education, manufacturing industries, IT sector, and more. Community cloud is suitable for companies falling under the same business model. For instance, organizations falling under the education sector can pick for community cloud with similar computing resources and storage power. Cost is another factor behind the popularity of this model. The resources cost is split between the organizations picking this cloud model.

Uncommon Cloud Types

If you’re still reading this post, it means you have got a clear idea about the four main types of cloud models. However, there are also less common cloud types used for specific purposes. These types include:

A: Multicloud

Don’t get confused. This is different from hybrid cloud. In a hybrid infrastructure, companies can get computing resources from both the private and public cloud. While Multicloud is not the combination of different clouds, instead it’s the provision of computing resources from two different cloud service providers. For instance, you can ask for public cloud resources from two different providers to avoid dependency on one single provider.

B: Distributed Cloud

At its core, a distributed cloud is an architecture that runs from multiple locations but is not owned by a single organization. This model is used to meet the company’s specific performance and compliance needs and it does support edge computing but essentially is managed and controlled by the public cloud provider.

C: HPC Cloud

This model is particularly developed to support high-performance computing applications. This model is useful if you want to perform research on a large scale and are looking for a solution for advanced computing problems.

Conclusion

Every business is unique.

It’s your job to carefully monitor the activities of your business and put dedicated thought to pick the particular cloud computing model for your business.

How you want your data to be managed, processed, and stored does matter. If you want to handle a large amount of data, the public cloud is a valuable solution. And if you want the sensitive data to be processed locally, the private cloud is the answer.

And the best part?

You can deploy both private and public cloud models to selectively handle sensitive and non-sensitive data.

And if you don’t want to remain dependent on a single service provider, you can leverage the services of two providers and use them to your advantage.

Make sure you consider the proper security protocols before picking up the right architecture. A single mistake in the initial steps of choosing the cloud model can drastically impact your business in the long run. So be careful.

That’s all for today. Hope you’ve enjoyed reading this article. Share your experience with cloud computing in the section below. If you’re unsure or have any questions about cloud computing, ask me in the comment section. I’d love to help you the best way I can. Thank you for reading this article.

What is Cloud Computing?

Hello Folks! Glad to have you on board. Thank you for clicking this read. In this post today I’ll walk you through What is Cloud Computing?

Cloud computing is not a buzzword anymore. Even though most companies are familiar with this term, they don’t know what it does and how it works. If you’re one of them, this read is for you. In simple terms, cloud computing allows you to use computer system resources over the internet. This means you can manage your data remotely over the internet from anywhere in the world. We’ll touch this further in our article.

I suggest you read this post all the way through as I’ll cover what is cloud computing, how does it work, the types of cloud computing, the advantages of cloud computing, and the future of cloud computing.

Let’s get started.

What is Cloud Computing?

Cloud computing is a way of storing, processing, and managing data over the internet. Simply put, it’s the on-demand availability of IT resources online. These resources include data storage, computing power and databases. This way you don’t need to worry about handling data over the computer’s hard drive or on-site data centers. This liberates you from managing hardware circuits, software patching, and on-site IT drills, giving you online access over data centers through which you can efficiently manage and process your data.

With the onslaught of IT workloads, companies harness the power of cloud computing. It’s not only fast, economical, and secure, it also gives better control over data. No matter your location, as long as you have access to the internet, you can control your information online.

Google Drive and Dropbox are the best examples of cloud computing where you can access and manage your information online. Companies can use it for regular tasks like data processing, data management, software development, data protection, backup and disaster recovery, server virtualization, data analytics, and other real-time applications.

How Does Cloud Computing Work?

There are three basic parts of cloud computing.

1: Device (like computer, tablets, smartphones) through which you access data

2: Cloud with data centers where data is stored and processed

3: Internet which connects cloud with the device

You might be familiar with the term client-server model. Here user with the device is the client and the cloud with data centers are the servers while the internet connects the users with data centers.

Prior to cloud computing, handling and storing data was challenging. Companies used to install their own data centers that required proper maintenance and regular on-site check-ups to make sure they were running well, which resulted in more oversized bills and more space to accommodate them. It was impractical, expensive, and less efficient.

But cloud computing has dramatically changed this behavior. Now companies don’t need to worry about maintaining, scaling, securing, and managing their IT infrastructure, instead, they can focus on providing a better user experience with quality products. The organizations get these reousrces with pay-as-you-go terms which means the more resources they use the more they pay over time.

Companies that provide cloud computing services often offer monthly subscriptions and give users access to their computing resources. They don’t need to get in the hassle of updating servers, buying software, getting more machines to back up the data, and updating software to avoid potential security threats. The service provider takes care of all of that for them.

Types of Cloud Computing

Cloud computing is perfect for businesses that have a lot of data to deal with. Cloud computing is mainly divided into three major types.

Public Cloud:

The public cloud offers compute resources like storage, memory, networking, and CPU. Public cloud vendors host these resources with globally and fully managed data centers. You can pay the vendors and rent these resources to develop your IT infrastructure.

The managed services in the compute resources include security systems and database servers that set you free from the hectic drill of managing and installing the whole solution into your local and on-site data centers.

The common leading providers of cloud computing services include Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure. You can hire the compute resources from these vendors as per the needs and complexity of your business operations.

Private Cloud

The public cloud is shared by a range of organizations while the private cloud, on the other hand, is specifically developed to meet the business needs of a single organization.

Some businesses don’t feel comfortable working with the public cloud. They want their separate and private cloud on their on-site data centers. Private cloud is perfect and ideally suited for single private organizations.

Two options there: companies can host private cloud or they can involve third-party vendors to host their private cloud on their system. This gives them the ability to immediately get access to the compute power based on their businesses. This setup is best for businesses that are a bit obsessed with the security of their systems.

Hybrid Cloud

Hybrid cloud gives you the ability to combine both public and private cloud and use them to your advantage. You can use either of them for a specific purpose. For instance, you may want to get unlimited storage space from the public cloud but you want to process the sensitive data on your private cloud.

This means if you running out of computing resources from the private cloud you can get the services of the public cloud to fulfill your business needs. It gives businesses advanced flexibility to move data across both clouds without a full commitment to the public cloud’s vendor.

And cost management is another blessing that comes with hybrid cloud. If you own a private cloud you need to install data centers on-site which require proper care and a capital expense. But with the public cloud, you only pay for resources without having to worry about the management of data centers.

Advantages of Cloud Computing

Now you know what is cloud computing and how does it work. Perfect. There are several advantages of cloud computing. A few of them include:

  1. It is cost-effective. The clients demand the service from the companies offering cloud services. Cost may differ for every service depending on the storage and computing power you demand. This way companies don’t need to spend money on purchasing installing and managing IT data centers, instead, they can purchase required computing resources from the service provider.
  2. Flexibility is another advantage that this infrastructure offers. This is not static, but a dynamic and flexible process. You can process and access data from anywhere in the world no matter your location, giving you the chance to scale up your business as you like better and manage data from the locations optimal for your business.
  3. Cloud computing is scalable. Yes, you can increase or decrease the demand for computing resources from cloud service providers as you run your business. This means computing power is directly related to the activities of your business. If at a certain stage you feel you require fewer data to manage and process, you can ask for less bandwidth in your next package. You can even add more users to your plan. Plus, you can even collaborate with multiple service providers at a time depending on your business.
  4. Cloud computing makes data processing fast. This is a centralized approach and the cloud service provider offer access to their data centers that are managed and controlled by experts. Accessing data online from a centralized system makes your data secure and safe.
  5. Cloud service providers strive to comply with their infrastructure with standard protocols. They keep updating their systems and data centers, providing an excellent and reliable user experience. No outsider can play with your data. Only you have access to that data and you can modify and manage it as you see fit.

The Future Trends Of Cloud Computing

Cloud computing becomes a necessary part of the business as the requirement to manage and store a large amount of data grows. And this trend will definitely increase as managing data in on-site data centers is not only expensive, it requires a lot of IT drills to properly install and maintain machines handling and storing data.

We can expect the following future trends in cloud computing.

  • Companies are willing to incorporate hybrid cloud computing into their IT model. Hybrid cloud computing is the combination of both public cloud and private. This infrastructure is mainly used to move data between private and public clouds, providing more flexibility to the users to satisfy their computing needs. What makes hybrid computing so special is its ability to process both analog and digital data. The market of hybrid computing is expected to touch $97.6 billion by 2023.
  • It’s almost impossible to run a successful business without making a footing in an online world. And cyber-attacks, system failures, and data outages are the norm when it comes to managing data online. Cloud computing offers backup and disaster recovery solutions in case of emergency. It creates the copy of your sensitive electronic data and store it miles away in data centers. And if your data original data is lost or compromised, you can ask for a copy of that data from cloud servers. This brings us to the conclusion that more companies will accept this model onwards to make their data safe and secure.
  • We have seen this before and we’ll see it again in coming years – the incorporation of AI with cloud computing. To meet their business needs, companies are now leveraging the power of Artificial Intelligence to run and effortlessly control the activities of their business. AI gives power to the organization to manage and automate their production and manufacturing processes without the interference of any human being. According to IBM, 65% of businesses feel that AI is necessary to handle their business operations and improve efficiency.
  • According to Statista, the total number of IoT-connected devices will amount to 30.9 billion units by 2025. This is huge. This brings us to another remarkable cloud computing trend – Cloud computing in the Internet of Things. IoT in cloud computing serves as a data source (from where data is produced) while cloud computing allows that data to store and process in its data centers. The combination of IoT with cloud computing gives us a model of devices connected intelligently that can manage store and process data automatically without the involvement of an outsider. For example, Alexa is a cloud-computing IoT device that can give you important information from the data stored in remote data centers in the cloud.

Conclusion

Digital transformation is on the rise. And in this era where technology is changing at an accelerated pace, it’s necessary to come up with advanced solutions to manage, store and process your data.

Cloud computing is now a part and parcel of successful organizations. But still, companies, who have reservations about the security of cloud computing, hesitate to transfer their data to a remote location.

For those hybrid model gives the perfect solution where you can get the advantage of both cloud services. For sensitive data, you can pick the private cloud while for the storage of regular and less sensitive data you can choose the private cloud. This way you can move your data and scale your compute resources as per the complexity of your business.

Not to mention, cloud computing has just started. And as the requirements and demands of businesses go complex, companies need powerful systems that not only store their data but also offer advanced processing capabilities. With new advancements in IoT technology and Artificial Intelligence, more businesses will likely adopt cloud computing for the years to come.

That’s all for today. Hope you’ve enjoyed reading this article. If you are unsure or have any questions about cloud computing, feel free to ask me in the section below. I’d love to help you the best way I can. Thank you for reading this article.

Comparator Operators in Ladder Logic Programming

Hi friends. Today we are going to go through one of the most commonly used topics in writing ladder logic programming which is using comparator operations. This includes the logical and mathematical comparison between variables to decide where the logic goes.

There are many comparator operations like equal (==), not equal (<>), less than (<), greater than (>), less than or equal (<=), greater than or equal (>=). All these comparator operations might be used in different logic scenarios while writing a ladder logic program. In this tutorial, we are going to go over each operator showing the input operators and output as well. In addition, we will practice some examples with the simulator to familiarize how to use them flexibly while developing ladder logic programs.

Input and output parameters of Comparator operations

Because they are used for comparing two the value of input variables, there will be two operators which are being compared. these input variables could be of any data type i.e. integer, real, boolean, character, string et cetera. And the output will be a boolean data type which denotes true or false, or “0” or “1”. As shown in Fig. 1 a typical comparator operator has two operands and one output which is called the result of logic (RLO).

Fig. 1: Comparator operation bock diagram

Table 1 lists examples for one of the comparisons between two variables of different data types and their output. In table 1, a typical example of “==” comparator operation between two strings considering the case sensitivity. The first column shows the values of the first operand and the second column shows the values of the second operand while the result of a logical operation (RLO) is represented in the third column. Now let us go over the station of each comparator operation for elaborating their operators, result, and give an example with simulation.

Table 1: example of comparator operation’s operands and RLO

Equal operator (==)

The equal operator is used to check if two operands are equal or not. The input operands’ datatype could be any of the possible data types in the language you are using. For example, Table 2 shows the parameters of the Equal operator in siemens S7. As you can notice, the input operand’ datatype can be any of the listed data types in the third column. One thing we need to highlight here is that datatype could be an array or structure of elements of the basic datatypes. For example, it could be an array of integers. In this case, the comparison will be conducted between every single element in the array of both operands. And if any of these elements have been found not match their equivalent in the other operand, the RLO will be false. Furthermore, the comparison not only does it apply to variables but also could be conducted between memory areas as shown in the third column. It can be used to compare input, output, marker, counter, timer memory data.

Table 2: the parameters of the Equal comparator operator

Example of equal comparator operation

Figure 2 depicts an example of an Equal comparator operation. .it compares literal constant with the variable of type integer saved in marker memory MW4 which is the location of a memory word.

Fig. 2: Example of Equal comparator operator

Figure 3 shows the simulation result of an example of an equal comparator operator. In the case of operands are not equal as in the example shown by fig. 3. The first operand is equal to 5 while the second operand is “0”. So the RLO shows false or “0”.

Fig. 3: simulation result of equal comparator operation when its operands are not equal

Figure 4 shows the simulation of an equal comparator when its operands are equal. The RLO is true or “1”. So the output coil is TRUE.

Fig. 4: simulation result of an equal operator when operands are equal

Not equal comparator operator

This operator is used to compare two operands. When they are not equal it produces positive RLO with High logic and when they are equal it returns false or “0”. Figure 5 shows the test result on the simulator of the NOT operator when the operands are equal. It returns RLO with “0” or false.

Fig. 5: simulation result of Not equal operator when operands are equal

On the other hand, fig. 6 shows the result of the simulation of the NOT operator when its operands are not equal. It gave RLO with logic Tru or “1”.

Fig. 6: simulation result of an equal operator when operands are equal

Greater-than “>” comparator operation

The greater than comparator operator is used for checking if operand 1 is greater than operand 2 or not. Figure 7 shows the rung of a ladder logic program that utilizes greater than comparator operation in which two operands of the integer data type are compared using the greater-than operator. The first operand is at memory location MW4 and the second operand is at memory location MW2. And the RLO represents the retuned result of the greater than comparator operation.

Fig. 7” ladder logic rung example of usage of greater-than comparator operation

Figure 8 shows the results of greater than comparator operation when operand one B is not greater than operand A. on the left side of the figure, it shows the case when both operands are equal and the right side shows the case when operand one is less than operand 2. In both cases, greater than operator sees its condition is not fulfilled so it returns false or “0” at the RLO and hence the output is false.

Fig. 8: simulation results of a greater-than operator when operand 1 is not greater than operand 2

Less-than “<” comparator operation

The less than comparator operator is used for checking if operand 1 is less than operand 2. Figure 9 shows a rung of a ladder logic program that utilizes less than comparator operation “A<B” in which two operands of the real data type are compared using the less-than operator. The first operand is at memory location MD8 and the second operand is at memory location MD12. And the RLO represents the retuned result of the greater than comparator operation. Also, it shows that, when oper1 is not less than oper 2, the result of logic output RLO is false and output is not activated.

Fig. 9: ladder logic rung example of usage of less-than comparator operation

Figure 10 shows the results of less than comparator operation when operand “oper1” is less than operand “oper2” the returned RLO is high or “1” and the output is activated. Now, one may question the case if the two operands are equal? Well that is is a good question and the case of equality between the two operands is considered false for both less than and greater than comparator operations.

Fig. 10: simulation results of less than operator when operand “oper1” is less-than operand “oper2”

Please see fig. 11 which shows the less comparator operation returns false when the two operands are equal. The next section will show the case of greater than or equal comparator operators “>=” and the less-than or equal comparator operator “<=”. In those cases, the equality between the two operands is included and the returned RLO is True or “1”.

Fig. 11: the less-than operator returns false when the two operands are equal.

 

Greater-than or equal comparator operator “>=”

Figure 12 shows a run in a ladder logic program that uses greater-than or equal “>=” operator. As you can see, the output shows true when the two operands are equal.

Fig. 12: greater-than or equal “>=” when two operands are equal

Less-than or equal comparator operator “<=”

Figure 12 shows a run in a ladder logic program that uses less than or equal “<=” operator. As you can see, the output shows true when the two operands are equal.

Fig. 12: the less-than or equal “<=” when two operands are equal

In-range comparator operator

Do all comparator operations take two operands? The answer is almost yes. However, there are very few operators that take only one operand. For example, the in-range operator compares the input operand with upper and lower limits to check if it is located within a specific range or not. Figure 13 shows a ladder logic rung uses that comparator operator to check operand oper1 of type real to see if it is in the defined range which is between 0 to 10.0. because the value of the operand oper1 is 11.5 which is out of the defined range. The RLO shows false or zero. Therefore, the output is deactivated.

Fig. 13: in-range comparator operation for the real data type variable

Figure 14 shows the RLO is true when the operand’s value is located between the defined limits of the in-range block. Also, there is out range comparison operator that is the opposite of the in-range operator about the logic.

Fig.14: in-range comparator operation returns true when operand located in the range

 

Larger example

In this section, we want to show you how these comparator operators can be combined to achieve a logical expression in ladder logic programming. let us imagine a scenario that we have a garage with a full capacity of 100 parking spots and we utilize a counter to count up cars get in and count down the cars that get out of the garage. Figure 15 shows a very simple logic of the validation and comparison to decide if the garage has room for a further car or it is full and no further car is allowed at present. Assume that the output of the counter is an integer data type variable that is stored in memory location %MW20. Now you can see the logic is straightforward. In the first step, the counter output is validated to make sure that it plays in a valid range which is from 0 to 100 which denotes empty to full capacity of the garage. It applies the limit function to the counter in case it is out of range to reset it to be within the designed range. Then program checks in the second step the value if it is less than the full capacity of the garage which is designed to be one hundred cars, it states true indicated with green lamp output meaning there is still room for cars to get in the garage; otherwise, it checks if it is greater than or equal of the maximum limit meaning there is no room for further cars to enter, it shows false meaning garage is full at the current time by activating a red lamp.

Fig. 15: garage status ladder logic example

Figure 16 shows the case when the garage still has room for further cars and the green lamp is activated for incoming cars.

Fig. 16: when the garage has room for further cars

Figure 17 shows the case when the garage is full and has no room for further cars. So the red lamp is activated for telling users no further empty spots available at the moment.

Fig. 17: when the garage is full

What’s next

As usual, I want to express my delight in your following up our tutorial, and let me take this chance to announce one of the most important and exciting tutorials which are about processing the analog inputs and how to scale the analog inputs. Did I tell you my friends that will be the next chapter? So be ready for enjoying processing analog inputs with practicing real-life situations in the industry.

ESP32 DHT11 Interfacing with ThingSpeak WebServer

ESP32 module comes with multiple inbuilt features and peripheral interfacing capability is one of those features. ESP32 module also consists of an inbuilt temperature sensor, but that can only measure the temperature of the ESP32 core not the temperature of the surrounding environment. So it is required to use a peripheral sensor to measure the temperature of the surrounding environment like home, garden, office etc.

Hello readers. I hope you all are doing great. In this tutorial, we will learn how to interface DHT11 (temperature and humidity sensor) with the ESP32. Later in this tutorial, we will discuss how to share the sensor readings obtained from the DHT11 sensor to a web server.

Before moving towards the interfacing and programming part, let’s have a short introduction to the DHT11 sensor, its working and its connections.

Where To Buy?
No.ComponentsDistributorLink To Buy
1ESP32AmazonBuy Now

DHT11 (A Temperature and Humidity Sensor)

Fig. 1: DHT11 sensor

DHT11 is used to measure humidity and temperature from its surrounding. It monitors the ambient temperature and humidity of a given area. It consists of an NTC (negative temperature co-efficient) temperature sensor and a resistive type humidity sensor. It also consists of an 8-bit microcontroller. The microcontroller is responsible for performing ADC (analog to digital conversion) and provides a digital output over the single wire protocol.

DHT11 sensor can measure humidity from 20% to 90% with +-5% (RH or relative humidity) of accuracy and can measure the temperature in the range of 0 degrees Celsius to 50 degrees Celsius with +-2C of accuracy.

DHT11 sensors can also be used to implement a wired sensor system using a cable length of up to 20 meters.

There are two DHT modules (DHT11 and DHT22) available in the market to measure temperature and humidity. The purpose of both module are same but with different specifications. Like DHT22 sensor provides broader temperature and humidity sensitivity ranges. But DHT22 is costlier than DHT11. So you can prefer to use any of the module, as per your requirements.

Components required

  • ESP32 development board
  • DHT11 sensor
  • 10K resistor
  • Connecting wires
  • Breadboard

Interfacing DHT11 with ESP32 module

Table: 1

Note: Connect a 10K resistor between data and power (+5V) pin of DHT11 sensor module.

Fig. 2: ESP32 and DHT11 connections/wiring

Arduino Programming

We are using Arduino IDE to compile and upload code into ESP32 module. To know more about Arduino IDE and how to use it, follow our previous tutorial i.e., on ESP32 programming series. Link is given below:

https://www.theengineeringprojects.com/2021/11/introduction-to-esp32-programming-series.html

Adding required libraries in Arduino IDE

DHT11 sensor uses single wire protocol to communicate data which requires a precise timing. In order to interface DHT11 sensor with ESP32 module it is required to add necessary libraries. To install the DHT11 sensor library;

  • Go to Tools >> Manage Libraries.

Fig. 3: manage libraries

 
  • Type DHT in the search bar and install the DHT sensor library as shown below.

Fig. 4: Install DHT sensor library

   

Arduino IDE code to interface DHT11 with ESP32

#include "DHT.h"

#define DHTPIN 4 // Digital pin connected to the DHT sensor

#define DHTTYPE DHT11 // DHT 11

// Initializing the DHT11 sensor.

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(115200);

Serial.println(F("DHT test string!"));

dht.begin();

}

 

void loop() {

// Wait a few seconds between measurements.

delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

float h = dht.readHumidity();

// Read temperature as Celsius (the default)

float t = dht.readTemperature();

// Read temperature as Fahrenheit (isFahrenheit = true)

float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).

if (isnan(h) || isnan(t) || isnan(f)) {

Serial.println(F("Failed to read from DHT sensor!"));

return;

}

// Compute heat index in Fahrenheit (the default)

float hif = dht.computeHeatIndex(f, h);

// Compute heat index in Celsius (isFahreheit = false)

float hic = dht.computeHeatIndex(t, h, false);

Serial.print(F("Humidity(%): "));

Serial.println(h);

Serial.print(F("Temp.: "));

Serial.print(t);

Serial.println(F("°C "));

Serial.print(F("Temp.: "));

Serial.print(f);

Serial.println(F("°F "));

Serial.print(F("Heat index: "));

Serial.println(hic);

Serial.println(" ");

Serial.print(F("°C "));

Serial.print(hif);

Serial.println(F("°F"));

}

Code Description

  • Add the necessary header files required to interface the DHT11 sensor.

Fig. 5: Add necessary libraries

  • The next step is the declaration of variables for the DHT11 sensor.
  • We are declaring 2 variables, the first one is the DHTPIN to store the GPIO number receiving input from the DHT11 sensor and another variable is to define the type of DHT (i.e., whether DHT11 or DHT22).

Fig. 6: Global declarations

  • Next, we are creating a DHT object called dht in the DHT sensor type (defined earlier) and the DHT pin.

Fig. 7

 

Setup()

  • Inside the setup function, the first task is initializing the serial monitor at a 115200 baud rate for debugging purposes.
  • Initialize the DHT sensor using begin() function.

Fig. 8

Loop()

  • DHT11 is a very slow sensor. It takes almost 250ms to read temperature and humidity.
  • So it is preferred to wait a few seconds before a new measurement or updated sensor reading.
  • Next, we are defining a float type variable ‘h’ to store humidity measured from the DHT11 sensor.
  • readHumidity() function is used to observe the humidity value.

Fig. 9

  • readTemperature() function is used to read the surrounding temperature with DHT11 sensor.

Fig. 10

  • If somehow the sensor fails to read or observer temperature and humidity values, then the respective results will be printed on the serial monitor.

Fig. 11

  • Another float type variable hif is defined to store the heat index value.
  • computeHeatIndex() function is used to calculate the heat index value.

Fig. 12: Heat index

Results

  • Open the Arduino IDE and paste the above code.
  • Compile and upload the program after selecting the correct development board and COM port.
  • Connect the DHT11 sensor with ESP32 board as per the given circuit instructions.

Fig. ESP32 and DHT11 interfacing

  • Open the serial monitor at 115200 baud rate and press the enable (EN) button from the ESP32 development board.
  • You should see the temperature, humidity, Heat index readings printed on the serial monitor.

Fig. 13: Readings observed from DHT11 sensor

Uploading DHT11 sensor reading to ThingSpeak Server

The IoT is the interconnection of physical objects or devices with sensors and software accessing capabilities to communicate data or information over the internet.

To build an IoT network, we need an interface medium that can fetch, control, and communicate data between sender and receiver electronics devices or servers.

Espressif Systems created the ESP32 Wi-Fi chip series. The ESP32 module is equipped with a 32-bit Tensilica microcontroller, 2.4GHz Wi-Fi connectivity, an antenna, memory, and power management modules, and much more. All of these built-in features of this ESP32 module make it ideal for IoT applications.

ThingSpeak web servie

It is an open data platform for the Internet of Things (Internet of Things). ThingSpeak is a MathWorks web service that allows us to send sensor readings/data to the cloud. We can also visualise and act on the data (calculate the data) sent to ThingSpeak by the devices. Data can be stored in both private and public channels.

ThingSpeak is commonly used for internet of things prototyping and proof of concept systems requiring analytics.

 

Getting Started with ThingSpeak

  • To create and account or log in to ThingSpeak (operated by MathWorks) server follow the link: https://thingspeak.com/
  • Click on Get Started for free.

Fig. 14: Getting started for free

  • Enter your details to create a MathWorks account as shown below:

Fig. 15: Create new account

  • If you have already created a MathWorks account, then click on Sign in.

Fig. 16: MathWorks Sign in

  • Create a channel on MathWorks server by clicking on the New Channel
  • ThingSpeak web service allows its user to create and save maximum of 4 channels for free.
  • If you are want access to more channels then you need to make payment for that.

Fig. 17: New Channel

  • Enter the respective details in the channel.

Fig. 18: Fill the channel details

  • Here we are creating two fields. First one represents the temperature and another one is to represent the humidity measured using DHT11 sensor. You can also add more fields as per your requirements.
  • A new URL containing the channel details and channel Stats will open, once you have successfully created the channel. On the same page/url, API keys are available for both read and write services.
  • Go to API Keys and copy the write API key and paste in your Arduino IDE code. So that ESP32 can send or write the DHT sensor readings to the MathWorks server.
  • In Private view your can also customize your chart. To edit the chart, click on the icon present on the top right corner of field chart.
  • Edit the details as per your requirements and click on the Save

Fig. 19: Field Chart Edit

 

Arduino IDE programming

Downloading and installing the required Library file:

    • Follow the link attached below to download the ThingSpeak Arduino library:

https://github.com/mathworks/thingspeak-arduino

  • Open the Arduino IDE.
  • Go to Sketch >> Include Library >> Add .ZIP Library and select the downloaded zip file.

Fig. 20: Adding ThingSpeak library

To check whether the library is successfully added or not:

  • Go to Sketch >> Include Library >> Manage Libraries

Fig. 21: manage libraries

  • Type thingspeak in the search bar.

Fig. 22: Arduino IDE Library manager.

  • The ThingSpeak library by MathWorks has been successfully downloaded.

Code

//------style guard ----

#ifdef __cplusplus

extern "C" {

#endif

uint8_t temprature_sens_read();

#ifdef __cplusplus

}

#endif

uint8_t temprature_sens_read();

// ------header files----

#include <WiFi.h>

#include "DHT.h"

#include "ThingSpeak.h"

//-----netwrok credentials

char* ssid = "replace this with your SSID"; //enter SSID

char* passphrase = "replace this with your password"; // enter the password

WiFiServer server(80);

WiFiClient client;

//-----ThingSpeak channel details

unsigned long myChannelNumber = 3;

const char * myWriteAPIKey = "replace this with your API key";

//----- Timer variables

unsigned long lastTime = 0;

unsigned long timerDelay = 1000;

//----DHT declarations

#define DHTPIN 4 // Digital pin connected to the DHT sensor

#define DHTTYPE DHT11 // DHT 11

// Initializing the DHT11 sensor.

DHT dht(DHTPIN, DHTTYPE);

 

void setup()

{

Serial.begin(115200); //Initialize serial

Serial.print("Connecting to ");

Serial.println(ssid);

WiFi.begin(ssid, passphrase);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(".");

}

// Print local IP address and start web server

Serial.println("");

Serial.println("WiFi connected.");

Serial.println("IP address: ");

Serial.println(WiFi.localIP());

server.begin();

//----nitialize dht11

dht.begin();

ThingSpeak.begin(client); // Initialize ThingSpeak

}

void loop()

{

if ((millis() - lastTime) > timerDelay)

{

delay(2500);

// Reading temperature or humidity takes about 250 milliseconds!

float h = dht.readHumidity();

// Read temperature as Celsius (the default)

float t = dht.readTemperature();

float f = dht.readTemperature(true);

if (isnan(h) || isnan(t) || isnan(f)) {

Serial.println(F("Failed to read from DHT sensor!"));

return;

}

Serial.print("Temperature (ºC): ");

Serial.print(t);

Serial.println("ºC");

Serial.print("Humidity");

Serial.println(h);

ThingSpeak.setField(1, h);

ThingSpeak.setField(2, t);

// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different

// pieces of information in a channel. Here, we write to field 1.

int x = ThingSpeak.writeFields(myChannelNumber,

myWriteAPIKey);

if(x == 200){

Serial.println("Channel update successful.");

}

else{

Serial.println("Problem updating channel. HTTP error code " + String(x));

}

lastTime = millis();

}

}

Code Description

  • The style guards are used at the beginning of the program to declare some function to be of “C” linkage, instead of “C++” Basically, to allow C++ code to interface with C code.

Fig. 22: Style guard

  • Add the required header files. In this example we are using three libraries, Wi-Fi.h, DHT.h, ThingSpeak.
  • We have already discussed above how to download and add the DHT and ThingSpeak library files to Arduino IDE.

Fig. 23: Libraries

  • Enter the network credentials (SSID and Password) of the access point to which your ESP device is supposed to connect for internet connectivity.

Fig. 24

  • To access the created web server we also need to assign a port and usually port 80 is used for local web server.

Fig. 25: server port

  • A Wi-Fi client is created to connect with ThingSpeak.

Fig. 26

  • Global declaration of timer variables.

Fig. 27: Timer variables

  • Add the channel number and API (Write) Key. If you have created only one channel then the channel number will be ‘1’.

Fig. 28

Setup()

 
    • Initialize the Serial monitor with a 115200 baud rate for debugging purposes.

Fig. 29

  • Set ESP32 Wi-Fi module in station mode using mode() function.
  • Enable ESP32’s Wi-Fi module using begin() function which is passing two arguments SSID and password.
  • Wait until the ESP32 is not connected with the wifi network.

Fig. 30: connect to wifi

  • Once ESP32 is successfully connected to Wi-Fi network, the localIP() function will fetch the IP address of the device.
  • begin() function is used to initialize the server.

Fig.31: Fetch and print IP address

  • Initialize the ThingSpeak server using begin() function that is passing client (globally created) as an argument.

Fig. 32

  • Set the number of fields you have created to the ThingSpeak server. We are adding only two fields. First one represents the humidity measured by the sensor from its surrounding and the 2nd field represents the temperature in degree Celsius.
  • You can also add further fields like for temperature in Fahrenheit, heat index etc.
  • ThingSpeak allow the user to add up to maximum of 8 fields for different readings.

Fig. 33

  • writeFields() function is used to write data to the ThingSpeak server. This function is using the channel number and API key as an argument.

Fig. 34

  • Return the code 200 if the sensor readings are successfully published to ThingSpeak server and print the respective results on the serial monitor.

Fig. 35

Results

  • Copy the above code and paste it into your Arduino IDE.
  • Make the required changes in the above code and the changes required includes, network credentials (SSID and Password), API key, Channel number etc.
  • Compile and upload the above program into ESP32 development after selecting the correct development board and COM port.
  • Make sure the Access Point (Wi-Fi) is ON to which your ESP device is supposed to connect.
  • Open the serial monitor at a 115200 baud rate and press the EN button from the ESP32 development board.

Fig. 35: Results on the Serial monitor

  • Open the channel you have created on the ThingSpeak server.
  • You should see the charts updated with the latest temperature and humidity readings.

Fig. 36: Displaying humidity on thingSpeak server

Fig. 37: Displaying Temperature on ThingSpeak server

This concludes the tutorial. I hope you found this of some help and also hope to see you soon with new tutorial on ESP32.

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir