LCD Library for Proteus V2.0

Hi learners! I hope you are doing great. Today, I am going to share the second version(V2.0) of the LCD library for Proteus. We have already shared the LCD V1.0 Library on our blog. Along with appreciation, we also get some complaints/suggestions about that library. So, we have designed a better version of the LCD library by keeping the suggestions in mind.

Version 2.0 has error-free working, better pinout prints, and is identical to the real-world LCD. We have also removed our website link from the LCD. This library includes two alphanumeric LCDs in it i.e. LCD 16x2 and LCD 20x4.

If you don't have any experience with the LCD, no need to worry as we will guide you from scratch. Before installing the LCD, let's first have a look at its brief introduction:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2ResistorAmazonBuy Now
3LCD 16x2AmazonBuy Now
4LCD 20x4AmazonBuy Now
5PIR SensorAmazonBuy Now
6Arduino UnoAmazonBuy Now

What is Liquid Crystal Display?

  • A liquid crystal display or LCD is a flat board of liquid crystals that are sandwiched between polarizers. When the electric field is applied to it, this material rotates according to the polarization and allows the light to pass through it. As a result, the display is shown on the LCD board.
  • A simple 16x2 LCD is shown in the below figure:
  • The LCD is used in electrical/electronic projects to display sensors' data, statuses, alerts, notifications etc.
  • We can interface this LCD with any microcontroller i.e. Arduino, PIC, Atmel, Raspberry Pi, STM32 etc.
  • Some of the advantages are low power consumption, durability, and long life.

Let's have a look at the pinout of LCD:

LCD Pinout

Both of these LCDs(16x2 and 20x4) have similar pinouts and a simple basic circuit needs to be designed in order to operate them. There are a total of 16 pins present in LCD used for different purposes. The below table has the complete description of LCD Pinout:

Serial

Pin

Functionality

Description

1

VSS

Ground

This pin is connected to the ground terminal of the circuit. 

2

VDD

Power Supply

It is connected to the positive voltage(+5V) and is responsible for the power supply to all pins. 

3

VEE

Voltage Emitter

It is used to control the contrast of LCD. it applies the negative voltage and thus controls the electric field of the LCD. 

4

RS

Register Select

It selects the LCD register. LCD has two registers: an instruction register and a data register. 

5

RW

Read or write

The read-and-write operation is done through this pin. if set to HIGH then LCD is in reading mode and LOW means it is writing the data. 

6

E

Enable

Enables the working of LCD. If HIGH then allow the display and if LOW then disable it.

7-14

D0-D7

Data bits (Pins to deal with the data)

Data is sent to the LCD in a parallel manner. These pins send this data and out of these, D0 is the least significant and D7 is the most significant.

LCD Library For Proteus

The installation of the LCD V2.0 is simple. The first step is to download the library files. I believe you have Proteus installed. So, click the below button to download the Proteus Library zip file.

LCD Library for Proteus V2.0

Adding Proteus Library Files

  • Once downloaded, go to the file location and extract content from the zip file.
  • Open the folder named "Proteus Library Files" and here you will find two library files in it, named:
  • LCDLibraryTEPV2.0.IDX
  • LCDLibraryTEPV2.0.LIB
  • Simply copy these files in the Library folder of Proteus software. Go to your C drive>Program Files>LabCentre Electronics>Proteus Professional> Library.
  • If you are having any difficulty installing the library, you should a look at How to install a new Library in Proteus.

The zip file also contains the project, where we simply connected both the LCDs with Arduino, so that you could check their working. Moreover, code is also present in the file.

LCD V2.0 in Proteus

Once the Library is installed, you need to open your Proteus software. If it's already open, you have to restart it. Now follow the instructions.

  • Go to the pick library by clicking on the “P” button.
  • In the dialogue box, type "LCD TEP" and you will get the below results:

I have installed both versions therefore, I am getting four options. I will choose the LCD 20X4 V2.0 and LCD 16X2 V2.0.

  • Click on the components and simply place them on the working sheet of Proteus, it will appear as shown below:

  • I hope you guys will enjoy this new look without the site's link.

Now, let's design an LCD simulation in Proteus:

LCD Simulation in Proteus

Now, let's design a simple LCD simulation, where we will interface it with an Arduino UNO board. We will display our website's link on the LCD. So, let's design the circuit:

Interfacing LCD with Arduino

Go to the pick library and select the following components:

  1. LCD 20X4
  2. LCD 16X2
  3. Arduino
  4. POT-HG
  • Place the Arduino and other components in the working area, as shown in the below image:
  • Go to Terminal mode and select the Power & Ground terminal for both LCDs.
  • In order to design a neat circuit, I have connected the “Default” terminal with each pin, instead of wires.
  • The complete circuit diagram is shown in the below figure:

Now let's design the Arduino code to display data on these LCDs:

Arduino Code for LCD Simulation

Now, open your Arduino software, I hope you have it installed. Paste the below code in it, I have also added this code in the zip file.

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // Print a message to the LCD.

  lcd.setCursor(1,0);

  lcd.print("www.TheEngineering");

  lcd.setCursor(4,1);

  lcd.print("Projects.com");

}

void loop() {

}

Add HEX File in Proteus

The next step is to get the Hex File from Arduino IDE and add in the Proteus. For this, follow these steps:

  • Verify the Arduino Code by clicking the "Verify" button and the output pane will give the location to the hex file, as shown in the below figure:
  • In the proteus software, double-click on the Arduino board to open its Properties Panel.
  • Paste the HEX file in the program file section and press OK.

LCD Simulation Results

  • Now, the LCD simulation is ready to run.
  • You can see in the code, we have printed the TEP link on the LCD screen.
  • Once you play the circuit, the LCDs will display the message, as shown in the below figure:

If you have followed all the steps, I am sure your project will run successfully. I hope it was helpful to you. You must practice it more and try to make different projects. So, that was all for today, will meet you guys in the next tutorial. Take care!!!

Raspberry Pi 2 Library for Proteus

Hello friends, I hope you all are having fun. In today's tutorial, I am going to share a new Proteus library for Raspberry Pi 2. We have already shared the Proteus Libraries of other Raspberry Pi modules i.e. Raspberry Pi 4, 3, Pico etc. and we discussed that these Pi modules won't be able to read the Python code. We have just designed the external appearance of these modules and you can use these Pi modules for circuit designing and project presentations.

We have also added the Arduino firmware in these boards, which is just to provide a bit of interaction with these boards. We have given these boards an unofficial title "Arduino Pi".

So, let's have a look at How to simulate Raspberry Pi in Proteus:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4LCD 16x2AmazonBuy Now
5LCD 20x4AmazonBuy Now
6PIR SensorAmazonBuy Now

Raspberry Pi 2 Library for Proteus

  • First of all, we need to download the Proteus Library zip file of Raspberry Pi 2, by clicking the below button:

Raspberry Pi 2 Library for Proteus

Adding Proteus Library Files

  • Extract files from the Proteus Library zip file and open the folder named "Proteus Library Files".
  • Here you will find two library files, named:
    • RaspberryPi2TEP.IDX
    • RaspberryPi2TEP.LIB
  • We need to place these files in the Library folder of the Proteus software, normally at C > Program Files > Labcenter Electronics > Proteus 8 > Library.

Note: For a better understanding, you should read How to Add a New Library File in Proteus.

Raspberry Pi 2 in Proteus

  • We have successfully added the library files in the last step. So, now is the time to open your Proteus software.
  • Open the Components search box by clicking the "P" button in Proteus and here make a search for Raspberry Pi 2.
  • If you have added the library correctly, you will get the below result:

  • Add it to your project by double-clicking on it.
  • Place the Raspberry Pi 2 modules in your Proteus workspace, as shown in the below figure:

Note: Its design is quite similar to that of Raspberry Pi 3, although we added the name to differentiate between the two.

Raspberry Pi 2 Simulation in Proteus

As mentioned above, this Pi board won't be able to read the Python code. So, we have added the Arduino firmware in it to make it a bit more interactive. So, let's blink an LED with this Raspberry Pi 2 module in Proteus:

LED with Raspberry Pi 2

  • Before working on the code, let's first design the circuit diagram and as you can see in the below figure, I have connected an LED along with a resistor to Pin # 13 of the Pi board:

  • In the properties panel of LED, change the Model Type of LED from analog to digital.

Code for Raspberry Pi 2

  • As it has Arduino firmware, so we need to get its hex file.
  • So, open Arduino IDE and from Examples, open the LED blink code.
  • Compile the code and get its hex file, as shown in the below figure:

Add Hex File in Proteus

  • Open the Properties PAnel of Raspberry Pi 2 and here you will find an option "Program File".
  • Paste the Hex File location in its text box, as shown in the below figure:

  • Click Ok to close the Properties PAnel and now its time to run the Raspberry Pi 2 simulation:

Raspberry Pi 2 Simulation Results

  • Click the Play Button in Proteus to run the simulation and if everything goes fine, the LED will start blinking, as shown in the below figure:

So, that was all for today. I hope you have enjoyed these Raspberry Pi simulated modules. IF have any questions, please ask in the comments. Thanks for reading.

Raspberry Pi Zero W Library for Proteus

Hello friends, I hope you all are doing great. As we are working on Raspberry Pi libraries for Proteus these days, so today, I am going to share another awesome library i.e. Raspberry Pi Zero W Libary for Proteus. We have already shared the Raspberry Pi Pico, Raspberry Pi 3 & Raspberry Pi 4 Libraries for Proteus, I hope you have already installed these libraries.

We have only designed the exterior look of this module, it won't be able to read the Python code. You can use this module to design circuit diagrams of your projects or to demonstrate your project in the presentation. Although, just for fun, we have added the Arduino UNO firmware to it. So, you can add the Arduino hex file in it. Something is better than nothing.

So, let's install the Proteus Library and simulate Raspberry Pi Zero:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4Raspberry Pi ZeroAmazonBuy Now

Raspberry Pi Zero W Library for Proteus

  • First of all, we need to download the Proteus Library zip file of Raspberry Pi Zero, by clicking the below button:

Raspberry Pi Zero W Library for Proteus

Adding Proteus Library Files

  • Extract the content of the Proteus Library zip file.
  • Here, you will find a folder named "Proteus Library Files".
  • Open this folder and you will find below two library files in it:
    • RaspberryPiZeroTEP.IDX
    • RaspberryPiZeroTEP.LIB
  • Place these two files in the Library folder of your Proteus software.
  • You will find the Library folder at this location: C > ProgramFiles > LabCenter Electronics > Proteus8.

Note: For a better understanding, you should read How to Add a New Library File in Proteus.

Raspberry Pi 4 in Proteus

  • So, after adding the Raspberry Pi Zero Library Files, open your Proteus software and if it's already open, then restart it so that it could index components from the newly-added Library.
  • Now, open the Proteus components search box by clicking the "P" button.
  • Here, make a search for Raspberry Pi Zero and you will get the below results:
  • Now, double-click on this Raspberry Pi Zero module to add it in your project list.
  • Place the Raspberry Pi Zero W module in your Proteus workspace and it will look like this:

  • We have tried to keep it small in size so that other components could easily add up in the workspace.

Raspberry Pi Zero Simulation in Proteus

As I mentioned earlier, this RPi Zero module in Proteus won't be able to read the Python code. So, just for fun, we have added the Arduino firmware inside. I know it's not that helpful but that's all we have right now. I hope we will design the real Raspberry Pi Zero simulator one day. So, let's add the Hex File in Raspberry Pi Zero W:

LED with Raspberry Pi Zero W

  • Now, let's design a simple circuit, as shown in the below figure:

  • I have simply attached an LED along with a resistor with Pin # 13 of the Raspberry Pi Zero W.
  • The LED attached has an analog Model Type and we need to change it to Digital, so open its Properties Panel by double-clicking on it.
  • In the Properties Panel, you will find "Model Type", change it from Analog to Digital.

Code for Raspberry Pi Zero

Let's clear this thing up one last time, we can't add Python code in this simulated Raspberry Pi Zero, so just to have some interaction, we have added the Arduino Hex file in it. So, we need to get the Arduino hex file.

  • So, open the Arduino IDE and open its LED Blink example from the File > Examples > Builtin.
  • Compile the code to get its HEX file, which we will add in the Raspberry Pi Zero.

Add Hex File in Proteus

  • Double-click Raspberry Pi zero in the Proteus software, to open its Properties Panel.
  • In the Program Files Section, paste the Hex File Location, as shown in the below figure:

Raspberry Pi Zero Simulation Results

  • Now let's run the simulation to get the results.
  • So, click on the RUN button of Proteus software and if everything worked fine, you will get similar results:

So, that was all for today. I hope you will enjoy this Raspberry Pi Zero W Library for Proteus. If having any difficulty, ask in the comments. Thanks for reading. Have a good day.

Raspberry Pi 4 Library for Proteus

Hello friends, I hope you all are doing great. Today, I am going to share the Raspberry Pi 4 Library for Proteus. In our previous tutorial, we shared the Raspberry Pi 3 Library for Proteus and as we mentioned in that tutorial, these Raspberry Pi libraries will have dummy modules i.e. We have just designed the exterior but these boards won't be able to read the Python code. Although just for fun, we have added the Arduino firmware in these boards, so we can upload the Arduino code in it. As the legends say, something is better than nothing. We have given these boards an unofficial name "Arduino Pi".

You can use these Pi boards to design your circuit diagram or can also use it in your presentation/demonstration of your projects. I hope you will enjoy these simulated Raspberry Pi boards. Before going forward, let's first have a brief overview of Raspberry Pi 4:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4Raspberry Pi 4AmazonBuy Now

What is Raspberry Pi 4?

  • Raspberry Pi 4 is an advanced microcontroller board, designed by Raspberry Pi Foundation and is used in IoT and embedded projects.
  • You should have a look at this Raspberry Pi 4 Pinout to get an in-depth understanding of this board.

So, now let's have a look at How to add this Proteus library and simulate Raspberry Pi 4 in Proteus.

Raspberry Pi 4 Library for Proteus

  • First of all, we need to download the Proteus Library zip files by clicking the below button:

Raspberry Pi 4 Library for Proteus

Adding Proteus Library Files

  • Extract the files from the Proteus Library zip file and open the folder named "Proteus Library Files".
  • You will find two library files in this folder, named:
    • RaspberryPi4TEP.IDX
    • RaspberryPi4TEP.LIB
  • Place these two files in the Library folder of your Proteus software. You will find the Library folder at this location: C > ProgramFiles > LabCenter Electronics > Proteus8.
  • If you are having difficulty finding the Library folder, you should read How to Add a New Library File in Proteus.
  • An LED Blinking Proteus Simulation of Raspberry Pi 4 is also present in this zip file.

Raspberry Pi 4 in Proteus

  • After adding the Library Files, open your Proteus software and if it's already open then restart it, so that it could read the components from the newly added library.
  • Click on the "Pick from Libraries(P)" button in Proteus and make a search for Raspberry Pi 4.
  • If you have added the RPi4 library correctly, you will get the below result:

  • Double-click on this Rpi4 board to add it to your project's components list.
  • Place the Raspberry Pi 4 board in the Proteus workspace and it will look like this:

  • I hope you will enjoy its look, as we put real effort into designing it and as you can see it resembles a real RPi4 board.

Raspberry Pi 4 Simulation in Proteus

Now let's design the Simulation of Raspberry Pi 4 in Proteus. As I mentioned earlier, we can't feed Python code to this RPi4 board. So, we have added the Arduino firmware to it. Thus, we need to upload the Arduino hex file in it. Let's attach an LED with Raspberry Pi 4:

LED with Raspberry Pi 4

  • I have attached a Green LED along with a resistor to Pin # 13 of the Raspberry Pi 4, as shown in the below figure:

  • Double-click on the LED to open its Properties panel, here you will find the "Model Type".
  • Change the Model Type from Analog to Digital, otherwise, it won't glow.

Code for Raspberry Pi 4

  • As it's important, so let's clear it up one more time. The Pi board won't read the Python code, instead, it will work on Arduino Code.
  • So, open your Arduino IDE and get the LED Blinking Code from the Examples.
  • Select Arduino UNO in the Tools > Boards section.
  • Compile the code and get its hex file, as shown in the below figure:

Add Hex File in Proteus

  • We need to add the hex file in Raspberry Pi 4, so double-click it to open its Properties Panel.
  • In the Properties Panel, you will find a section named "Program Files".
  • Add the hex file location in this Program Files section, as shown in the below figure:

Raspberry Pi 4 Simulation Results

  • Now, let's run the simulation of Raspberry Pi 4 by clicking the RUN button in Proteus.
  • If everything's correct, the LED will start blinking, as shown in the below figure:

So, that was all for today. I hope you will enjoy this Raspberry Pi 4 Library for Proteus and will use it in your projects. Let me know your feedback. Have a good day. Take care!!!

Raspberry Pi 3 Library for Proteus

Hello friends, I hope you all are doing great. In today's tutorial, I am going to share a new Proteus Library for Raspberry Pi 3 module. In my previous tutorial, I shared the Raspberry Pi Pico Library for Proteus. Similar to Pico Library, this RPi3 LIbrary won't operate on the Python code. We have just designed the front look to use in the circuit design. Although, we can upload Arduino code to these simulated Raspberry Pi boards.

This Raspberry Pi Proteus Library will have only the Raspberry Pi 3 board in it. We will design the other Pi boards soon. So, let's have a look at How to simulate Raspberry Pi in Proteus:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4Raspberry Pi 3AmazonBuy Now

Raspberry Pi 3 Library for Proteus

First of all, we need to download the Raspberry Pi library files, by clicking the below button:

Raspberry Pi 3 Library for Proteus

Adding Proteus Library Files

  • This Proteus Library zip file will have a folder in it, named "Proteus Library Files".
  • Open this folder and you will find these two files in it:
    • RaspberryPi3TEP.IDX
    • RaspberryPi3TEP.LIB
  • Next, we need to add these library files to the library folder of the Proteus software. So open C > PRogramin Files > Labcenter Electronics > Proteus 8 > Library folder and copy-paste these files into it.
  • This zip file also has a Proteus simulation of the Raspberry Pi 3 board.

Note: Look at How to add a new Library in Proteus 8, if you are having any issues.

Raspberry Pi 3 in Proteus

  • After adding the library files, open your Proteus software or restart it, if it's already open.
  • In the components search box, make a search for Raspberry Pi 3 and you will get the below results:

  • So double-click on this Raspberry Pi board to add it to your project.
  • Place the Pi board in your Proteus workspace, as shown in the below figure:

Simulate Raspberry Pi 3 in Proteus

Now we are going to simulate this Raspberry Pi 3 board in Proteus. We will attach a simple LED to one of its pins. As I told earlier, we have just designed the exterior of this board. It won't read the Python code. We can use it to design circuit diagrams for our project. But just for fun, we have added the Arduino firmware to it. So, we can upload the Arduino hex file in this Pi board.

LED with Raspberry Pi 3

  • I have connected a simple LED with resistance on Pin # 13 of the Pi board, as shown in the below figure:

  • In the Properties panel of LED, change the Model Type from analog to digital, otherwise, it won't work.

Code for Raspberry Pi 3

  • As I mentioned earlier, this Rpi3 board in Proteus won't read the Python code. We can only upload Arduino code in it.
  • So, I am going to use the LED Blinking code and will select Arduino UNO in the boards' section, as shown in the below figure:

Add Hex File in Proteus

  • In order to add this hex file, double-click on the Raspberry Pi 3 board to open its Properties Panel.
  • In the Properties Panel, you will find a section named Program Files.
  • Paste the hex file location in the Program Files section and click OK to close the panel.

Now, let's run our simulation to get the results:

Raspberry Pi 3 Simulation Results

  • So, now let's run the simulation and you will see that the LED on the board will start blinking, as shown in the below figure:

So, that was all for today. I hope you will use this Raspberry Pi Library to design your projects. In the next tutorial, I will share the Raspberry Pi 4 Proteus Library. Till then, take care. Have fun!!!

Raspberry Pi Pico Library for Proteus

Hello friends, I hope you all are fine. In today's tutorial, I am going to share the Raspberry Pi Pico Library for Proteus. It's a dummy library, we have just designed the display. We can't add the Python Code to it, but we can make it work with Arduino code. A mixture of Arduino and Raspberry Pi, I have given it an unofficial name "Arduino Pi". It's better to have something than nothing. You can design circuit diagrams using this library and can also demonstrate your project in presentations by designing simulations.

So, let's have a look at How to simulate Raspberry Pi Pico by adding this Proteus Library:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4Raspberry Pi PicoAmazonBuy Now

Raspberry Pi Pico Library for Proteus

  • First of all, we need to download the zip file of Proteus Library for Raspberry Pi Pico, by clicking the below button:

Raspberry Pi Pico Library for Proteus

Adding Proteus Library Files

  • The Proteus zip file will have a folder named "Proteus Library File".
  • Open this folder and you will get two library files, named:
    • RaspberryPiPicoTEP.IDX
    • Raspberry PiPicoTEP.LIB
  • Now, open the Library folder of your Proteus software, normally present at C > Program Files > LabCenter Electronics > Proteus 8, and copy-paste these 2 library files into it.
  • The zip file of Proteus Library will also have a simulation of Raspberry Pi Pico in it.

Note: Look at How to add a new Library in Proteus 8, if you are having any issues.

Raspberry Pi Pico in Proteus

  • After adding the library files, restart your Proteus software so that it could index the components of the newly added library.
  • Open the Proteus components section and make a search for "Raspberry Pi Pico".
  • If you have added the library correctly, you will get the below result:

  • So our Pico board is now available in the Proteus components list.
  • Double-click on the Pico board to add it to your project.
  • Close the components section and drag-&-drop the Pico board in the Proteus workspace, as shown in the below figure:

We have tried to keep it small in size so that other components could get more space.

Simulate Raspberry Pi Pico in Proteus

As I told earlier, we can't program this Pico board with Python, which is the actual programming language of this board. But just for fun, we have enabled it to read the Arduino code. Let's design a simple blink example to see how it works:

LED with Raspberry Pi Pico

  • First, we need to design a simple LED circuit in Proteus, as shown in the below figure:

  • Double-click on the LED to open its Properties panel and here, we need to change the Mode Type of LED from Analog to Digital.

Code for Raspberry Pi Pico

  • Let's mention it one more time(as it's important), we can't program this board with Python code. We can only upload the Arduino Code in it.
  • So, here's the LED blink code and as you can see in the below image, I have selected Arduino UNO.

Add Hex File in Proteus

  • Now, we need to add this hex file to the Pico board of Proteus.
  • So, double-click the Raspberry Pi Pico to open its Properties Panel.
  • In the Properties Panel, there's a section called Program File, add the Hex file location here, as shown in the below figure:

Now let's run our simulation to check the results:

Raspberry Pi Pico Simulation Results

  • If everything goes fine, the LED attached to the Pico board will start blinking, as shown below:

So, that was all for today. I hope you will enjoy this Raspberry Pi Pico Library for Proteus and will use it in your simulations. If you have any suggestions, use the below comment form. Thanks for reading. Take care!!!

ESP32 Library for Proteus

Hello friends, I hope you all are doing well. In today's tutorial, I am going to share a new Proteus Library of ESP32 embedded module. ESP32 is a microcontroller board used mostly in IoT projects. It's a successor of ESP8266 or NodeMCU. We have already shared the NodeMCU Library for Proteus and I hope you guys have enjoyed it.

Proteus software is not capable of handling WiFi or BLE technology, thus we can't implement these technologies in the ESP32 board. Though, you can use its input/output pins to interface embedded sensors and modules. You can also use it to design the Circuit Diagram of your Project.

So, let's have a look at How to simulate ESP32 board in Proteus:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4ESP32AmazonBuy Now

ESP32 Library for Proteus

  • First of all, download the zip file of Proteus Library for ESP32 board, by clicking the below button:

ESP32 Library for Proteus

Add Proteus Library Files

  • In this Proteus Library zip file, open the folder named "Proteus Library File".
  • In this folder, you will find two library files, named:
    • ESP32TEP.IDX
    • ESP32TEP.LIB
  • We need to add these library files in the Library folder of the Proteus software.

Note: Look at How to add new Library in Proteus 8, if you don't know already.

ESP32 in Proteus

  • Now open your Proteus software and if it's already open, then restart it. (it's necessary for Proteus to read the library files)
  • Open the components Library of Proteus and search for "ESP32".
  • If everything's fine, you will get the ESP32 board in the results section, as shown in the below figure:

  • We need to double-click on this module to add it in our project.
  • Now drag and drop the ESP32 board in the Proteus workspace, as shown in the below figure:

  • We have tried our best to keep it as small as we can, so that you get more space for other components.

So, using this ESP32 Library, we have added the board in Proteus software. Now, let's simulate ESP32 in Proteus:

Simulate ESP32 in Proteus

We are going to simulate the ESP32 board by running Blink LED Example. As I told earlier, we can't add WiFi and BLE capabilities in this simulated ESP32 board. So, we are going to select Arduino UNO in the board section of Arduino IDE to get the hex file.

LED with ESP32

  • First of all, design this simple circuit, where we have placed an LED at Pin # 13 of ESP32, as shown in the below figure:

  • In the Properties Panel of this LED, change the Model Type from Analog to Digital.

Code For ESP32

  • Open Arduino IDE and in the File>Examples, open the Blink LED example code, given below:

  • As you can see in the above figure, I have selected Arduino UNO in the Tools>Boards section of Arduino IDE.
  • Now compile the Arduino Code and get its hex file. Read this resource: How to Get the Hex File from Arduino IDE.

Add Hex File in Proteus

  • Open the Properties Panel of the ESP32 board by double-clicking on it in the Proteus software.
  • In the Program File section of the Properties Panel, add the hex file location, as shown in the below figure:

  • Now, close the Properties Panel by clicking the OK Button.

ESP32 Simulation Results

  • If you did no mistake, you will get results as shown in the below figure:

So, that was all for today. I hope you have enjoyed simulating ESP32 board in Proteus software. If you have any questions, ask in the comments. Till the next tutorial, take care. Have fun !!!

NodeMCU Library for Proteus

Hello friends, I hope you all are doing great. In today's tutorial, I will share a Proteus Library of another embedded module i.e. NodeMCU. NodeMCU is a microcontroller board and if you are new to this board, you should read Introduction to NodeMCU to get your hands dirty. NodeMCU is not present in the components library of Proteus and using this library you can easily simulate NodeMCU in Proteus.

We can't add WiFi and BLE capabilities to our module in the Proteus software, that's why it will just perform the basic functions i.e. sensors interfacing, PWM, I/O control etc. So, you can use it for simple code testing and can also use it to design circuit diagrams of your projects.

So, let's have a look at How to download NodeMCU Proteus Library and simulate it:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2LEDsAmazonBuy Now
3ResistorAmazonBuy Now
4ESP8266AmazonBuy Now

NodeMCU Library for Proteus

  • First of all, download the Proteus Library zip file, by clicking the below button:

NodeMCU Library for Proteus

Add Library Files in Proteus

  • Extract the zip file and open the "Proteus Library Files" folder.
  • You will find two files in this folder, named:
    • NodeMCUTEP.IDX
    • NodeMCUTEP.LIB
  • Place these two files in the Library Folder of your Proteus Software.

Note: Look at How to add new Library in Proteus 8, if you don't know already.

NodeMCU in Proteus

  • After adding the NodeMCU files to the Library folder, open your Proteus software or restart it, if it's already running.
  • In the components list, make a search for "NodeMCU".
  • If you have added the Library files correctly, you will get the below result:

  • Double-click on this NodeMCU module to add it in the list of your project components.
  • Now place it in the Proteus workspace and it will look like:

  • We have kept its size small as we got a lot of requests after Arduino Library to reduce the boards' sizes. I hope you will like this one.

So, we have successfully added the NodeMCU module to our Proteus software. Now let's simulate NodeMCU and for that, I am going to use the blink example:

Simulate NodeMCU in Proteus

LED with NodeMCU

  • First of all, we need to attach an LED with Pin # 13 of NodeMCU, as shown in the below figure:

  • Make sure to change the LED Model Type from analog to digital in its Properties Panel, otherwise, it won't work.

Code for NodeMCU LED Blinking

  • Now it's time to get the NodeMCU LED Blinking code, given below:

Note: As you can see in the above code, we have selected Arduino UNO in the boards' section. As I have told earlier, this NodeMCU module is only going to use its pins, we can't add WiFi or BLE capabilities in the Proteus software. So, while compiling the code, select Arduino UNO board. Something is better than nothing.

Adding Hex File in Proteus

  • Double-click on the NodeMCU module in Proteus software to open its Properties Panel.
  • Add the Hex file from Arduino IDE in the "Program File" section of the Properties Panel.

  • Click OK to close the panel.
  • Now run the Proteus simulation and if everything goes fine, you will get results as shown in the below figure:

So, that's how you can easily simulate NodeMCU in the Proteus software. If you have any questions, please ask in the comments. I will resolve them as soon as possible. In the next tutorial, we will share the ESP32 Library for Proteus. Till then take care and have fun!!!

Web-Server Based Weather Monitoring System Using ESP32

Abstract: This paper is written to represent a web-server based real-time weather monitoring system implemented using the ESP32 module. The system is designed to measure the weather conditions like temperature, pressure, humidity etc, in its vicinity. This system continuously provides real-time data (weather conditions) over limited or controlled areas, for example, agriculture fields, homes or a particular room, industries etc. Although we have satellites for weather monitoring but to perform research over a particular area, the data observed should be highly accurate which is not possible with satellites. To implement an IoT network we need to use a webserver to continuously store and display the real-time data which can be accessed globally. ’ThingSpeak’ is a web service where one can upload and access (globally) with internet-connected devices. ESP32 will be acting as an interface medium between the various sensors and the web-server. ESP32 module is also responsible for collecting, processing and then communicating the data to the server. The real-time data stored on the web server can be further used for research and analysis of weather conditions of a particular place.

Keywords

ESP32, IoT, Temperature sensor, Humidity sensor, Pressure sensor, Altitude sensor, Arduino IDE, ThingSpeak.

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

Introduction

The evolving generation of wireless technology has made human life a lot easier. Where everything is online and automatic we can easily monitor multiple things virtually from anywhere in the world. The WSN (wireless sensor networks) and Internet of things or IoT play an important role in implementing and accessing these wireless technologies. Smart homes, smart cities and smart weather monitoring systems are examples of such technologies where things are quite simpler or easier.

In this web-server based weather monitoring system, the weather data (from the surrounding environment or of a particular location) like temperature, humidity, pressure etc. is measured with the help of some sensors and then the collected data will be stored on a server after being processed by a microcontroller. Our daily activities are inseparable from weather conditions and various environmental factors. The real-time data collected can be used in research and analysis and the results can be helpful in human life and for improving environmental conditions as well.

The Internet of Things is a system made up of multiple inter-related computing devices. The main factor ‘things’ in IoT is designated to a component that is capable of communicating data over a network (IoT), the thing could be animals, a digital machine, a sensor, a human being etc. Each component of the Internet of Things network is given an individual or a distinct identity and the ability to communicate data or information over a wireless network that is too without the intervention of a human or a computer [8].

An interface medium capable of collecting, controlling, and communicating data among transmitter and recipient electronic equipment or servers is required to build the IoT network[9].

The ESP32 microcontroller series was developed by Espressif Systems. This module (the ESP32) includes a 2.4GHz Wi-Fi chip, memory, a 32-bit Tensilica microcontroller, an antenna, peripheral interfacing abilities, power management modules, and more. This ESP32 module is excellent for the Internet of things because of all of its technological and infrastructural aspects [10].

DHT11 and BMP280 sensors are used to collect the data from their surrounding environment and then communicate the data to the ESP32 module over a particular protocol [11].

The application of this weather monitoring system can also play an important role in the field of agriculture[12 ] to increase productivity, research application, and reducing manpower (by reducing the need to manually monitor the field status). Sometimes in a particular agricultural zone that is hazardous for a human beings, it is quite difficult to manually (offline) monitor the environment or weather conditions. In such cases, this web server based or online weather monitoring system can be of great importance.

Fig. 1

Hardware and Software Components

The list and quantity of the components required to implement the web server based weather monitoring system are shown in Table1.

Table: 1

DHT11

Fig. 2 DHT11 sensor

DHT11 sensor (or temperature and humidity sensor) is a sensor module used to measure humidity and temperature from its surrounding. This sensor module is responsible for monitoring the ambient temperature and humidity of a given area. An NTC (negative temperature co-efficient) temperature sensor and a resistive type humidity sensor make up the sensor. An 8-bit microcontroller is also included. The microcontroller performs ADC (analogue to digital conversion) and outputs a digital signal via the single wire protocol [13].

Some of the technical specifications of the DHT11 sensor are:

Table:2  DHT11 technical specifications

DHT11 sensors can also be used to create a wired sensor system with up to 20 meters of cable.

To measure temperature and humidity, two DHT modules (DHT11 and DHT22) are available on the market. Both modules serve the same purpose, but they have different specifications. The DHT22 sensor, for example, has a wider range of temperature and humidity sensitivity. However, DHT22 is more expensive than DHT11. As a result, you can choose to use any of the modules as per your needs.

Interfacing DHT11 with ESP32[14]

Table.3  Interfacing DHT11 with ESP32

BMP280

Another sensor we are using is the BMP280. The BMP280, also known as the barometric pressure sensor, is a temperature, pressure, and altitude sensor. This sensor's small size and low power consumption make it suitable for mobile applications, GPS modules, and battery-powered devices, among other things[15].

The Bosch BMP280 is based on Bosch's validated ‘Piezo-resistive pressure sensor technology’, which features high accuracy, long-term stability, linearity, and EMC robustness.

The barometric pressure sensor (280) is the successor to the BMP180 sensor, and it is mostly preferred in all areas where precise temperature and pressure measurements are required.

Fig.3  BMP280 Sensor

Fitness, indoor navigation, and GPS refinement are all new technologies which require relative accuracy, and the BMP280 is ideal for them. This module is preferred over the other available modules for temperature records or measurement because of its low TCO (Temperature coefficient of Offset).

The temperature measured with the BMP280 sensor is more accurate than the DHT11 sensor. BMP80 provides a 0.01°C accuracy rate.

Some technical specifications of the BMP280 sensor are:

Table:4  BMP280 Technical specifications

ThingSpeak web service

A web server is a place where one can store data online and can access that data at any time and from anywhere in the world [16]. A real-time data is created with the help of a web-server. There are various web services available to store real-time data for research and analysis like AWS (Amazon Web Service), Azure, Firebase etc.

We are using the ThinSpeak web service provided by MathWorks which allows us to send sensor readings/data to the cloud. The ThingSpeak is an open source data platform for the Internet of Things (IoT) applications. We can also visualize and act on or access the data (calculate the data) sent to the ThingSpeak server from ESP32. Two different types of channels are available to store data on the ThingSpeak server namely ‘Public Channel’ and ‘Private Channel’ and one can use either of the available channels to store and display data [17].

ThingSpeak is frequently used for IoT prototyping and proof-of-concept systems that require analytics[18].

Software Used

We need to give instructions to our ESP32 module so that it can interface, read data from DHT11 and BMP280 sensors and then finally publish the collected data to the ThingSpeak server. Arduino IDE is an integrated development environment used to write, compile and debug the program for the ESP32 module[19].

Fig. Arduino IDE

Process Flow

The process flow of our weather monitoring system is shown below in Chart 1. The process starts with the initialization of ESP32 module which is acting as an interface medium between the sensor modules and the web-server. The ESP32 wi-fi module is continuously searching for the network credentials as per the instruction provided. After connecting to the internet the sensor modules will be initialized and the real-time data [22] collected from the surrounding environment will be pushed to the ThingSpeak web server[23].

Flow Chart: 1

Results

The results observed from the implemented weather monitoring system are shown below. We observed four different environmental conditions which include temperature, humidity, pressure and altitude. The sensor data collected by ESP32 from DHT11 and BMP280 sensors is published to the ThingSpeak web server. On ThingSpeak we have created a channel that contains four fields to store four different environmental factors temperature, humidity, pressure and altitude.

Fig. Hardware

In fig. 4 we can see the ‘Field 1’ which is containing the temperature readings published or communicated from the ESP32 module and saved on the ThingSpeak server.

Similarly, fields 2, 3, and 4 are displaying the humidity, pressure and altitude respectively.

Fig. 4 Temperature (°C)

Fig. 5 Humidity

Fig. 6 Pressure (hPa)

Fig. 7 Altitude

Each factor is monitored at different intervals of time to observe the variations in various environmental factors. From table 5 we can see the various environmental factors and their values at different time intervals for the approximate duration of 24hrs.

Table 5 Variations in weather conditions

Conclusion

We observed the weather conditions (that includes temperature, humidity, pressure and altitude) with our “Web-server based weather monitoring system using ESP32”. The observed real time data is stored on the ThingSpeak server which can be accessed globally. The different values of each (mentioned earlier) environmental factor at different intervals in time are also observed (given in table 5) and the observed result clearly shows the changes in the weather conditions for a full day cycle. Hence, we have successfully implemented and tested the web server based weather monitoring system with ESP32 and ThingSpeak web server.

References

  • Maier, A., Sharp, A. and Vagapov,  Y., November  “Comparative  analysis  and practical implementation  of  the  ESP32  microcontroller  module  for  the  internet  of things”  2017 .
  • Prisma Megantoro, Brahmantya Aji Pramudita, Vigneshwaran Pandi, “Real-time monitoring system for weather and air pollutant measurement with HTML-based UI application” June 2021.
  • Foughali Karim, Karim Fathallah, Ali Frihida, “Monitoring System using web of things in precision agriculture” 2017.
  • J.Shah and B. Mishra, “IoT enabled environmental monitoring system for smart cities,” in 2016 International Conference on Internet of Things and Applications (IOTA), 2016.
  • P.Susmitha , G. Sowmyabala, “ Design and Implementation of Weather Monitoring and Controlling System” July 2014.
  • S.Navulur, A. S. C. S. Sastry, M. N.  Giri Prasad,  “Agricultural  management  through  wireless  sensors  and internet of things” .
  • K.Siva, S. Ram, and A. N. P. S. Gupta, “IoT based Data Logger System for weather monitoring using Wireless sensor networks,” 2016
  • Ferdin Joe John Joseph, “IoT Based Weather Monitoring System for Effective Analytics”, 2249 – 8958, Volume-8 Issue-4, April, 2019.
  • A F Pauzi, MZ Hasan, “Development of IoT Based Weather Reporting System”, 2020.
  • ESP32-IoT Development Framework, https://www.espressif.com/en/products/sdks/esp-idf
  • Carlo Guarnieri Calo Carducci, Antonello Monti, Markus Hans Schraven, Markus Schumacher, Dirk Mueller, “Enabling ESP32 based IoT Applications in Building Automation Systems”, 2019.
  • R.K. M. Math and N. V Dharwadkar, “IoT Based Low-cost Weather Station and Monitoring System for Precision Agriculture in India”, 2018 (2nd International Conference on I-SMAC).
  • N. Tianlong, “Application of Single Bus Sensor DHT11 in Temperature Humidity Measure and Control System [J]”, 2010.
  • “Create a Web Server With ESP32”, https://www.theengineeringprojects.com/2021/11/create-a-web-server-with-esp32.html
  • ThinSpeak, https://thingspeak.com/pages/learn_more
  • T. Thilangam. J, T. S. Babu, and B. S. Reddy, “Weather monitoring system application using LabView”, 2nd International Conference on I-SMAC, 2018.
  • J.Weiss and R. Yu, "Wireless Sensor Networking for the Industrial Internet of Things".
  • Gaurav Verma, Pranjal Mittal, Shaista Farheen, “Real Time Weather Prediction System Using IoT and Machine Learning.
  • R.Shete, S. Agrawal, “IoT based Urban Climate Monitoring using Raspberry Pi”, International Conference on Signal Processing and Communication, 2016.

Reading Data from Firebase Database with ESP32

Internet of Things is a system of multiple inter-related computing devices. The factor ‘thing’ in IoT is designated to an entity capable of communicating data over a network (IOT), which can be a digital machine, sensor, human being, animals etc. Each component that is included in IoT network is assigned with an unique identity called UID and the ability to communicate data over IoT network without any external human or computer intervention.

Hello readers, I hope you all are doing great. In our previous tutorial, we discussed how to upload data to Firebase Real-time Database using ESP32. In this tutorial, we will learn how to read the data stored on the Firebase Database with ESP32.

We can access the data stored in Firebase database from anywhere in the world, which makes this preferable in IoT applications.

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

Project overview

In our previous tutorial, we learnt how to upload an integer value (for demonstration) to Firebase real-time database. So, in this tutorial we will learn how to fetch or receive those integer values from Firebase database.

To access real-time data, we are using two ESP boards where one is used to upload/store the real-time data to the Firebase database and another to read the data stored on the firebase.

Although, it is not required to use two ESP boards, we can also access the previously saved data on the Firebase database with only a single ESP32/ESP8266 board.

We can use the same code for both ESP32 and ESP8266 but we need to make some changes like some of the libraries will be different for ESP8266 and the selection of ESP8266 development board while uploading the code with Arduino IDE.

Fig. 1 Reading data from firebase

Firebase

Google's Firebase real-time database is a development platform that includes a number of services for managing and authenticating data.

Firebase is a mobile and web app development platform (that also works well with Android APIs) that includes features such as Firebase Cloud, real-time data, and Firebase authentication, among others.

According to Firebase's official documentation (https://firebase.google.com/docs/database), when a user creates a cross-platform application using JavaScript SDKs for Android or Apple, all clients share a single database.

Fig. 1 Firebase Real-time database and ESP32

The following are the main features of the Firebase Real-time database:

  • Firebase applications remain responsive even when they are not connected to the internet. If any changes were missed while in offline mode, they will be automatically synchronized once connectivity is restored.
  • Unlike hypertext transfer protocol requests, Firebase RTDB uses data synchronization to update changes in the database within milliseconds, making it easier to access the database from a web browser or a mobile device.

Firebase in IoT:

The Internet of Things, also known as IoT, is the interconnection of physical objects or devices with sensors and software accessing capabilities in order to communicate data or information over the internet.

We need an interface medium that can fetch, control, and communicate data between sender and receiver electronics devices or servers in order to build an IoT network.

The Firebase real-time database gives you a place to store data from sensors on your level device. With Android APIs, Firebase performs admirably.

Firebase is especially useful for storing data from sensors and syncing it between users in real-time in data-intensive Internet of things (IoT) applications. For the sake of simplicity and clarity, we can say that it is a Google cloud service for real-time collaborative apps.

Components required:

  • ESP32 development board
  • Arduino IDE for programming
  • Firebase account
  • Firebase API key and project URL

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. 2 manage libraries

  • Search for the Firebase ESP Client library in Library Manager and click Install.
  • We are attaching an image, where we are installing the Firebase ESP-Client (2.3.7 version) library.

Fig. 3 Install Firebase ESP Client Library

Firebase API key and Project URL

We have already posted a tutorial on our website on getting started with Firebase real-time database and how to post or upload data to Firebase database from ESP32. Where we discussed, how to create a project on Firebase real-time database, authentication, how to access the API key and project URL etc.

So now we do not need to create a new project, we are using the same project and hence same API key and project URL to read or download the data from Firebase real-time database.

  • To access the project API key, go to Firebase website and open the project you have created.
  • Go to left sidebar >> setting >> project setting and copy the Web API key.
  • Paste that API key in your Arduino IDE code.

Fig. 4 Project Setting

Fig. 5 Project API key

  • Got to Real-time database on left sidebar and copy the project URL.
  • Paste the project URL in your Arduino IDE code.

Fig. 6 Project URL

 

Code

//--add necessary header files

#include <WiFi.h>

#include <Firebase_ESP_Client.h>

#include "addons/TokenHelper.h" //Provide the token generation process info.

#include "addons/RTDBHelper.h" //Provide the real-time database payload printing info and other helper functions.

// Insert your network credentials

#define WIFI_SSID "ssid"

#define WIFI_PASSWORD "password"

// Insert Firebase project API Key

#define API_KEY "replace this with your project API key"

// ----Insert real-time database URL

#define DATABASE_URL "replace this with your project URL"

//Define Firebase Data object

FirebaseData fbdo;

FirebaseAuth auth;

FirebaseConfig config;

unsigned long sendDataPrevMillis = 0;

int read_data;

bool signupSuccess = false;

void setup() {

Serial.begin(115200);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.print("Connecting to Wi-Fi");

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

Serial.print(".");

delay(200);

}

Serial.println();

Serial.print("Connected to... ");

Serial.println(WiFi.localIP());

Serial.println();

// Assigning the project API key

config.api_key = API_KEY;

//Assign the project URL

config.database_url = DATABASE_URL;

/// check signup statue

if (Firebase.signUp(&config, &auth, "", "")) {

Serial.println("ok");

signupSuccess = true;

}

else {

Serial.printf("%s\n", config.signer.signupError.message.c_str());

}

// Assign the callback function for token generation task

config.token_status_callback = tokenStatusCallback;

Firebase.begin(&config, &auth);

Firebase.reconnectWiFi(true);

}

void loop()

{

if (Firebase.ready() && signupSuccess && (millis() -

sendDataPrevMillis > 8000 || sendDataPrevMillis == 0))

{

sendDataPrevMillis = millis();

if (Firebase.RTDB.getInt(&fbdo, "/test/int"))

{

if (fbdo.dataType() == "int")

{

read_data = fbdo.intData();

Serial.print("Data received: ");

Serial.println(read_data); //print the data received from the Firebase database

}

}

else

{

Serial.println(fbdo.errorReason()); //print he error (if any)

}

}

}

Code Description

  • The libraries we are using are:
    • The first one is h, which is used to enable the Wi-Fi module and hence wireless network connectivity.
    • Another library we are using is the h which is responsible for interfacing ESP32 and Firebase Real-time Database.

Fig. 7 Header files

  • We also need to add two helper libraries (required by the Firebase library).
  • The TokenHelper library is responsible for managing the token generation process.
  • On the other hand, the RTDBHelper library is responsible for providing helper functions to print data coming from the Firebase database.

Fig. 8 Helper libraries

  • Next, we need to insert the project API key obtained from the Firebase project setting page.

Fig. 9 Insert API key

  • Similarly, insert the RTDB (real-time database) URL.

Fig. 10 RTDB URL

  • Next, we are defining three firebase data objects, responsible for linking App to Firebase.

Fig. 11 Firebase Data Objects

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

Fig. 12 Enter Network credentials

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. 13 Initialize wifi module

  • 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. 14 Fetch/obtain the IP address

  • Here, we are assigning the API key to the firebase configuration.

Fig. 15 configuring API key

  • Similarly, the database URL is also assigned to firebase configuration

Fig. 16 configuring database URL

  • Next, we are checking or verifying the Firebase sign-up status.
  • In the signup() function the last two arguments are empty, indicating the anonymous user.
  • If you have enabled different sign-up methods during the Firebase authentication method like Google account, Facebook etc then you need to add the respective credentials as arguments.
  • The respective results of signup status will be printed on the serial monitor.

Fig. 17 sign up status

  • Next, you need to assign the callback function for token generation.

Fig. 18

Loop()

  • Once the signup is successfully done, we are ready to fetch the data stored on the Firebase real-time database in every 10 seconds.
  • RTDB.getInt() command is used to store the data in /test/int node. But before that we are checking the data type that is ‘int’(integer). If the data type of the message/data received from Firebase RTDB is ‘int’ only then the data will be stored inside the integer type variable i.e., “read_data”.

Fig. 19 Fetch data from Firebase RTDB

  • If the data type is other than integer then an error will be printed on the serial monitor.

Fig. 20

  • Similarly, we can read/fetch various types of data like float, string, array etc. from the firebase database.

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 ESP device is connected with Wi-Fi, you should see the data fetched from Firebase, printing on the serial monitor with a particular delay (as per the code instructions).

Fig. 22 Data sent Vs Data Received

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.

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