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!!!

Current Sensor Library for Proteus

Hi Friends! Hope you’re well today. Today, I am going to share the Proteus Library of Current Sensor WCS1600. This sensor is not available in the Proteus Components Library and we’re sharing it for the first time.

The Current Sensor WCS1600 is used to measure the current flowing through the circuit and is used in embedded systems and robotics projects. If you are new to this sensor, you must first design its simulation before playing with the hardware. 

Before we move further, let’s have a brief overview of WCS1600 Current Sensor:

Where To Buy?
No.ComponentsDistributorLink To Buy
1LEDsAmazonBuy Now
2ResistorAmazonBuy Now
3ACS712AmazonBuy Now

What is WCS1600 Current Sensor?

WCS1600 comes with a drift linear hall sensor IC which gives precise and accurate values. The hall sensor IC is 9.0 mm in diameter through the hole and is incorporated with a temperature compensation circuit. To measure the passing current, the electric wire of the system should pass through the hole of this sensor.

Using this design, the system designers can monitor the current path of any length without affecting the layout of the original system. The integrated hall IC senses the magnetic field generated when current flows through the wire. That magnetic field is then converted into a proportional voltage.

Features:

  • Product: WCS1600 current sensor.
  • Sensitivity: 22mV/A
  • Low operating current: 3mA
  • Supply Current: 3.5 ~ 6mA
  • Zero Current Vout: 2.5V
  • Bandwidth: 23kHz
  • Isolation voltage: 4000V
  • Supply Voltage: 3 ~ 12V
  • Operating Temp: -20 ~ 125°C
  • Conductor Through Hole: 9.2mm
  • Temperature Drift: +/-0.3 mV/C
  • Output voltage proportional to AC and DC
  • Wide sensing current range 0~100A at 5V volt
  • For easy soldering on PCB, two bronze sticks are used
  • Ratiometric output from the supply voltage

WCS1600 Current Sensor Library for Proteus

  • First, download the Proteus Library zip file for WCS1600 Current Sensor by clicking the link below:

WCS1600 Current Sensor Library for Proteus

Adding Library Files

  • After downloading this zip file, extract it and you’ll find the folder "Proteus Library Files".
  • In this folder, 3 Proteus Library files are available, named:
    • WCS1600TEP.HEX
    • WCS1600TEP.IDX
    • WCS1600TEP.LIB
  • Copy these files and paste them into the Library Folder of Proteus Software, as shown in the below figure:

  • After adding these files to the Library folder, open the Proteus Software, and if you’re already working on it, you need to restart it. 

Note: You should read How to Add Library in Proteus 8, if you are having any issues finding the Library Folder.

Current Sensor in Proteus

In the components section, write ‘WCS1600 Current Sensor’ in the search bar and you’ll get the following result:

Now place this sensor in the Proteus workspace, as shown in the below figure:

You can see in the above figure, this current sensor carries 4 pins as follow:

  • Vcc: 5V is provided to this pin.
  • GND: This pin is grounded.
  • D0: This is the output pin and it goes HIGH when current passes through the hole and will remain LOW when there is no current.
  • A0: This pin will give the analog output.
  • TestPin: As we can't use a current wire in Proteus, so we placed this test pin to indicate current. When this pin is HIGH, means the current is passing through the IC and if it's LOW, means no current. 

Adding Hex File

Now double-click the sensor to open up its Properties Panel, as shown in the below figure:

Go to the ‘Program File’ section and browse for the file WCS1600TEP.HEX which you have already downloaded and placed in the Library Folder of Proteus.

Simulate Current Sensor

  • Now we’ll design a simple circuit to use this WCS1600 Current Sensor in Proteus.
  • The following figure shows the WCS1600 Current Sensor Simulation in Proteus.

  • As you can see in the above figure, I have placed an LC circuit at the analog pin, that's only for the simulation to get the analog value. It won't be used in real hardware.
  • Now run Proteus Simulation. You’ll get the result as shown below.


That’s all for today. Hope you’ve found this Library for Proteus useful. If you’re unsure or have any queries regarding the simulation of this sensor and how to use it in your engineering projects, you are welcome to get in touch with me in the section below. I’ll help you the best way I can. Thank you for reading this tutorial.

Interface 7-Segment Display with Raspberry Pi 4

Thank you for being here for today's tutorial of our in-depth Raspberry Pi programming tutorial. The previous tutorial taught us how to install a PIR sensor on a Raspberry Pi 4 to create a motion detector. However, this tutorial will teach you how to connect a single seven-segment display to a Raspberry Pi 4. In the following sections, we will show you how to connect a Raspberry Pi to a 4-digit Seven-Segment Display Module so that the time can be shown on it.

Seven-segment displays are a simple type of Display that use eight light-emitting diodes to show off decimal numbers. It's common to find it in gadgets like digital clocks, calculators, and electronic meters that show numbers. Raspberry Pi, built around an ARM chip, is widely acknowledged as an excellent Development Platform. Its strong processing power can do amazing things in the hands of electronics enthusiasts and students. If we can figure out how to have it talk to the outside world and process data via an output, then we'll have a real chance of accomplishing all this. We analyze the data by viewing it on an LCD screen or other Display. Numerous sensors can detect specific parameters in the physical world and convert them to the digital world. It would never make sense to utilize a PI LCD panel to display a minimal quantity of information. Here, a 7-Segment or 16x2-Alphanumeric LCD panel is the preferred method of presentation.

There are few uses for a 7-segment display that don't need an LCD panel, even though a 16x2 LCD is preferable in most. If all you need to do is show some numbers, then an LCD, which has the downside of having a small character size, is excessive. Compared to a regular LCD screen, seven segments have the upper hand in dim environments and can be seen from wider angles. Let's get started.

Where To Buy?
No.ComponentsDistributorLink To Buy
1BreadboardAmazonBuy Now
2Jumper WiresAmazonBuy Now
3Raspberry Pi 4AmazonBuy Now

Components

  • Jumper wires

  • Seven segment display

  • 1KΩresistors

  • Breadboard

The 7-Segment and 4-Digit Display Modules

The seven segments of a 7 Segment Display are each lit up by an individual LED to show the digits. To show the number 5, for example, you would make the glow pins for segments a, f, g, c, and d on the 7-segment high. This particular 7-segment display is a Common Cathode version, although there is also a Common Anode version.

One 7-Segment Display Interfacing with Pi 4

The wiring diagram for connecting a 7-segment display to a Raspberry Pi is shown below. Here, 7-Segment Common Cathode has been utilized.

So, we'll simulate an 8-bit PORT on PI using its eight GPIO pins. Here, GPIO12 is the Most Significant Bit (MSB), while GPIO13 is the Least Significant Bit (LSB) (Most Significant Bit).

If we wish to show the number 1, we must activate both segments B and C. We must supply voltage to GPIO6 and GPIO16 to power segments B and C. Accordingly, the hexadecimal value of "PORT" is "06," and the byte value of "PORT" is "0b00000110." If we raise both pins to their highest positions, the number "1" will be shown.

The value for every displayable digit has been recorded and saved in a Character String with the label 'DISPLAY .'We have then used the Function 'PORT' to call those values one at a time and display the relevant digit.

Explanation of the Code

Once everything is wired up according to the schematic, we can power up the PI and begin using PYTHON to write the program. Below is a function that allows us to program the GPIO pins on the PI, and we'll go over the few commands we'll be using in the PYTHON program to do so. We are also changing the name of the GPIO pins in the hardware from "GPIO" to "IO," which will be used throughout the code.

import RPi.GPIO as IO

The general-purpose input/output (GPIO) pins we need to use may be occupied with other tasks. If that's the case, the program's execution will be interrupted by warnings. The below command instructs the PI to continue running the software regardless of the warnings.

IO.setwarnings(False)

Pin numbers on the board and pin functions can be used to refer to PI's GPIOs. This GPIO5 is similar to the one labeled "PIN 29" on the board. Here we specify whether the number 29 or the number 5 will stand in for the pin.

IO.setmode (IO.BCM)

To use the LCD's data and control pins, we have assigned those functions to eight of the GPIO pins.

IO.setup(13,IO.OUT)

IO.setup(6,IO.OUT)

IO.setup(16,IO.OUT)

IO.setup(20,IO.OUT)

IO.setup(21,IO.OUT)

IO.setup(19,IO.OUT)

IO.setup(26,IO.OUT)

IO.setup(12,IO.OUT)

If the condition between the brackets evaluates to true, the looped statements will be run once. The value of PIN13 would be HIGH if and only if bit0 of the 8-bit 'pin' is true. There are eight 'if else' conditions, one for each of bits 0 through 7, so that each LED in the seven-segment Display can be set to either the High or Low state, depending on the value of the corresponding bit.

if(pin&0x01 == 0x01):

   IO.output(13,1)

else:

   IO.output(13,0)

As x increases from 0 to 9, the loop will be run 10 times for each command.

for x in range(10):

The following command can create an infinite loop, with which the statements included within the loop will be run repeatedly.

While 1:

All other commands and functions have been commented on in the following code.

Single 7-segment Display complete code

import RPi.GPIO as IO            # calling for the header file, which helps us use GPIO's of PI

import time                              # calling for time to provide delays in the program

DISPLAY = [0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67]            # string of characters storing PORT values for each digit.

IO.setwarnings(False)            # do not show any warnings.

IO.setmode (IO.BCM)           # programming the GPIO by BCM pin numbers. (like PIN29 as‘GPIO5’)

IO.setup(13,IO.OUT)             # initialize GPIO Pins as outputs

IO.setup(6,IO.OUT)

IO.setup(16,IO.OUT)

IO.setup(20,IO.OUT)

IO.setup(21,IO.OUT)

IO.setup(19,IO.OUT)

IO.setup(26,IO.OUT)

IO.setup(12,IO.OUT)

def PORT(pin):                    # assigning GPIO logic by taking the 'pin' value

    if(pin&0x01 == 0x01):

        IO.output(13,1)            # if  bit0 of 8bit 'pin' is true, pull PIN13 high

    else:

        IO.output(13,0)            # if  bit0 of 8bit 'pin' is false, pull PIN13 low

    if(pin&0x02 == 0x02):

        IO.output(6,1)             # if  bit1 of 8bit 'pin' is true, pull PIN6 high

    else:

        IO.output(6,0)            #if  bit1 of 8bit 'pin' is false, pull PIN6 low

    if(pin&0x04 == 0x04):

        IO.output(16,1)

    else:

        IO.output(16,0)

    if(pin&0x08 == 0x08):

        IO.output(20,1)

    else:

        IO.output(20,0)   

    if(pin&0x10 == 0x10):

        IO.output(21,1)

    else:

        IO.output(21,0)

    if(pin&0x20 == 0x20):

        IO.output(19,1)

    else:

        IO.output(19,0)

    if(pin&0x40 == 0x40):

        IO.output(26,1)

    else:

        IO.output(26,0)

    if(pin&0x80 == 0x80):

        IO.output(12,1)            # if  bit7 of 8bit 'pin' is true, pull PIN12 high

    else:

        IO.output(12,0)            # if  bit7 of 8bit 'pin' is false, pull PIN12 low

While 1:

    for x in range(10):            # execute the loop ten times incrementing x value from zero to nine

        pin = DISPLAY[x]        # assigning value to 'pin' for each digit

        PORT(pin);                  # showing each digit on display 

        time.sleep(1)

Output

The process of displaying a single number character on a 7-segment display is complete. However, we'd need more than a single 7-segment display to express information with more than one digit. Therefore, we will use a 4-digit seven-segment display circuit for this session.

Four individual Seven-Segment Displays have been linked up here. For a 4-digit 7-segment display, we know that each module will have 10 pins, so there will be 40 pins total. Soldering that many pins onto a dot board would be a hassle for anyone; thus, I recommend that anyone using a 7-segment display do so by purchasing a module or creating their PCB. See below for a diagram of the relevant connections:

In the preceding diagrams, we can see that the A-lines of all four displays are linked together as one A, and the same is true for B, C.... up until DP, which is essential for understanding how the 4-digit seven-segment module functions. Put another way, if trigger A is activated, the state of all 4 A's should be high.

Nonetheless, this never occurs. The four extra pins labeled D0 through D3 (D0, D1, D2, and D3) let us select which of the four displays is driven high. As an illustration, if I want my output to appear solely on the second Display, I would set D1 to high and leave D0, D2, and D3 at low. Using pins D0–D3 and A–DP, we can easily choose which displays should be on and which characters should be shown.

Using a Pi 4  to interface with a 4-digit, 7-segment display module

Let's check the many options for interfacing this 4-digit seven-segment Display with the Raspberry Pi. As can be seen in the diagram below, there are 16 pins on the 7-segment module. Even if your module's resources are limited, it will provide at least the following.

  • Segmented pins, either 7 or 8 segments (pins 1 to 8)

  • Pin holder to the ground (here pin 11)

  • A 4-digit code to unlock the door (pins 13 to 16)

See below for the wiring diagram of a digital clock built with a Raspberry Pi and a 4-digit Seven-segment display module:

You can also use the following table to ensure your connections are correct and follow the diagrams.

Locating the module's pins is the first step in making electrical connections. Identifying the Raspberry Pi's GPIO pins can be tricky; I've included an image to help.

Raspberry Pi programming

Here, RPi is programmed in the Python programming language. The Raspberry Pi can be programmed in a wide variety of ways. Since Python 3 has become the de facto standard, we've opted to use that version as our integrated development environment (IDE). At the bottom of this guide, you'll find the whole Python code.

We'll go over the PYTHON instructions we'll be using for this project: first, we'll import the library's GPIO file; next, using the below function, we'll be able to program the Pi 4's GPIO pins. We are also changing the name of the GPIO pins in the hardware from "GPIO" to "IO," which will be used throughout the code. We've brought in time and DateTime to get the current time from Rasp Pi.

import RPi.GPIO as GPIO

import time, DateTime

The GPIO pins we're trying to use are already being used for something else. The program's execution will be interrupted with warnings if this is the case. The PI will be instructed to disregard the errors and continue with the software using the below command.

IO.setwarnings(False)

The physical pin number and the corresponding function number can refer to PI's GPIOs. As with 'PIN 29,' GPIO5 is a physical component on the circuit board. In this case, we specify whether the number "29" or "5" will stand in for the pin. GPIO. In BCM notation, GPIO5 pin 29 will be represented by a 5.

IO.setmode (GPIO.BCM)

As is customary, we'll start by setting the pins to their default values; in this case, both the segment and digit pins will be used as outputs. In our code, we organize the segment pins into arrays and set their values to zero by declaring them to be GPIO.OUT.

segment8 = (26,19,13,6,5,11,9,10)

for segment in segment8:

    GPIO.setup(segment, GPIO.OUT)

    GPIO.output(segment, 0)

We do the same thing with the digital pins, but we set them to output and set them to zero by default.

#Digit 1

    GPIO.setup(7, GPIO.OUT)

    GPIO.output(7, 0) #Off initially

    #Digit 2

    GPIO.setup(8, GPIO.OUT)

    GPIO.output(8, 0) #Off initially

    #Digit 3

    GPIO.setup(25, GPIO.OUT)

    GPIO.output(25, 0) #Off initially

    #Digit 4

    GPIO.setup(24, GPIO.OUT)

    GPIO.output(24, 0) #Off initially

Numbers on a seven-segment display must be formed into arrays. To show a single digit, we need to toggle the on/off status of all but the dot pin of the 7-segment Display. For the numeral 5, for instance, we can use this setup:

For all alphabets and numerals, there is an equivalent sequence number. You can write on your own or utilize the handy table provided.

Using this information, we can create arrays for each digit in our Python code, as demonstrated below.

null = [0,0,0,0,0,0,0]

zero = [1,1,1,1,1,1,0]

one = [0,1,1,0,0,0,0]

two = [1,1,0,1,1,0,1]

three = [1,1,1,1,0,0,1]

four = [0,1,1,0,0,1,1]

five = [1,0,1,1,0,1,1]

six = [1,0,1,1,1,1,1]

seven = [1,1,1,0,0,0,0]

eight = [1,1,1,1,1,1,1]

nine = [1,1,1,1,0,1,1]

Let's bypass the function in the code that would otherwise be executed before entering the while loop and begin displaying characters on our 7-segment Display. If you hook up a Raspberry Pi to the internet, it will read the current time and divide it into four separate variables. For instance, when the time is 10.45, the values assigned to h1 and h2 will be 1 and 0, while m1 and m2 will be 4 and 5, respectively.

now = DateTime.DateTime.now()

    hour = now.hour

    minute = now.minute

    h1 = hour/10

    h2 = hour % 10

    m1 = minute /10

    m2 = minute % 10

    print (h1,h2,m1,m2)

These four numbers will be displayed on one of our four digits. The lines below can be used to convert a variable's value to a decimal. Here, we show the value in variables on the 7-segment Display by using the function print segment (variable) with the digit 1 set to the highest possible value. You may be asking why we turn off this digit and why there's a delay after that.

GPIO.output(7, 1) #Turn on Digit One

print_segment (h1) #Print h1 on segment

time.sleep(delay_time)

GPIO.output(7, 0) #Turn off Digit One

This is because the user will only be able to see the full four-digit number if all four digits are shown at once, and we all know that this isn't possible.

How, then, can we simultaneously show all four digits? With luck, our MPU is considerably quicker than the human eye. Therefore we offer one number at a time but exceptionally quickly. The MPU and segment display are given 2ms (variable delay time) to process each digit before we go on to the next. A human being cannot detect this 2ms lag; therefore, it appears as though all four digits illuminate simultaneously.

Understanding how to use print segment(variable) is the final puzzle piece. Arrays that have been declared outside of this function are used within it. As a result, the value of any variable passed to this function must be inside the range (0-9) so that the character variable can use in a meaningful comparison. Here, we check the variable against the value 1. The same is true for all comparisons with numbers between zero and nine. Assigning each value from the arrays to the appropriate segment pins is what we do if a match is found.

def print_segment(character):

    if character == 1:

        for i in range(7):

            GPIO.output(segment8[i], one[i])

Show the time on a 4-digit 7-segment display.

Use the provided schematic and code to connect your components and set up your Raspberry Pi. Once you've finished setting everything up, you can open the software and check the 7-segment Display to see the time. However, before doing this, you should check a few things.

  • If you want to be sure your Raspberry Pi isn't stuck in the past, you should update its time.

  • If you want to utilize a 7-segment display on your Raspberry Pi, you'll need to plug it into an adapter rather than a computer's USB connection because of the large amount of current it consumes.

Complete code

import RPi.GPIO as GPIO

import time, DateTime

now = datetime.datetime.now()

GPIO.setmode(GPIO.BCM)

GPIO.setwarnings(False)

 #GPIO ports for the 7seg pins

segment8 =  (26,19,13,6,5,11,9,10)

for segment in segment8:

    GPIO.setup(segment, GPIO.OUT)

    GPIO.output(segment, 0)

    #Digit 1

    GPIO.setup(7, GPIO.OUT)

    GPIO.output(7, 0) #Off initially

    #Digit 2

    GPIO.setup(8, GPIO.OUT)

    GPIO.output(8, 0) #Off initially

    #Digit 3

    GPIO.setup(25, GPIO.OUT)

    GPIO.output(25, 0) #Off initially

    #Digit 4

    GPIO.setup(24, GPIO.OUT)

    GPIO.output(24, 0) #Off initially

null = [0,0,0,0,0,0,0]

zero = [1,1,1,1,1,1,0]

one = [0,1,1,0,0,0,0]

two = [1,1,0,1,1,0,1]

three = [1,1,1,1,0,0,1]

four = [0,1,1,0,0,1,1]

five = [1,0,1,1,0,1,1]

six = [1,0,1,1,1,1,1]

seven = [1,1,1,0,0,0,0]

eight = [1,1,1,1,1,1,1]

nine = [1,1,1,1,0,1,1]

def print_segment(charector):

    if charector == 1:

        for i in range(7):

            GPIO.output(segment8[i], one[i])

    if charector == 2:

        for i in range(7):

            GPIO.output(segment8[i], two[i])

    if charector == 3:

        for i in range(7):

            GPIO.output(segment8[i], three[i])

    if charector == 4:

        for i in range(7):

            GPIO.output(segment8[i], four[i])

    if charector == 5:

        for i in range(7):

            GPIO.output(segment8[i], five[i])

    if charector == 6:

        for i in range(7):

            GPIO.output(segment8[i], six[i])

    if charector == 7:

        for i in range(7):

            GPIO.output(segment8[i], seven[i])

    if charector == 8:

        for i in range(7):

            GPIO.output(segment8[i], eight[i])

    if charector == 9:

        for i in range(7):

            GPIO.output(segment8[i], nine[i])

    if charector == 0:

        for i in range(7):

            GPIO.output(segment8[i], zero[i])               

    return;

while 1:

    now = DateTime.DateTime.now()

    hour = now.hour

    minute = now.minute

    h1 = hour/10

    h2 = hour % 10

    m1 = minute /10

    m2 = minute % 10

    print (h1,h2,m1,m2)

    delay_time = 0.001 #delay to create the virtual effect

    GPIO.output(7, 1) #Turn on Digit One

    print_segment (h1) #Print h1 on segment

    time.sleep(delay_time)

    GPIO.output(7, 0) #Turn off Digit One

    GPIO.output(8, 1) #Turn on Digit One

    print_segment (h2) #Print h1 on segment

    GPIO.output(10, 1) #Display point On

    time.sleep(delay_time)

    GPIO.output(10, 0) #Display point Off

    GPIO.output(8, 0) #Turn off Digit One

    GPIO.output(25, 1) #Turn on Digit One

    print_segment (m1) #Print h1 on segment

    time.sleep(delay_time)

    GPIO.output(25, 0) #Turn off Digit One

    GPIO.output(24, 1) #Turn on Digit One

    print_segment (m2) #Print h1 on segment

    time.sleep(delay_time)

    GPIO.output(24, 0) #Turn off Digit One

    #time.sleep(1)

Output

A similar section should appear below if everything is functioning as it should.

7-segment Display limitations

Typically, only 16 hexadecimal digits can be shown on a seven-segment display. Some show the digits 0-9, whereas others can show more. Seven-segment displays can only show a maximum of 16 values due to a lack of input leads. However, LED technology does allow for more than this. Even with the help of integrated circuit technology, the possible permutations of the seven parts on the screen are very few.

Conclusion

This guide taught us how to connect a 7-segment screen to a Raspberry Pi 4. The seven-segment Display, which we learned is employed in digital timers, clocks, and other electrical gadgets, are a cheap, basic electrical circuit and reliable module. Seven-segment displays can either be "common-anode" (where the common point is the power input) or "common-cathode" (where the common end is grounded). After that, we coded some python scripts to show numbers on a single seven-segment model and the time across four such screens. Next, we'll see how to use a Raspberry Pi 4 as the basis for a low-power Bitcoin miner.

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