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.

IoT based Web Controlled Home Automation using Raspberry Pi 4

Greetings, and welcome to today's tutorial. In the last tutorial, we learned how to construct a system for tallying individuals using Raspberry Pi, astute subtraction, and blob tracking. We demonstrated the total number of building entrances and exits. Feature computation and HOG theory were also discussed. The tests proved that a device based on the raspberry pi could effectively function as a people counting station. One of the many benefits of the Pi 4 is its internet connectivity, which is especially useful for home automation projects due to its low price and ease of use. We're going to see if we can use a web page's buttons to manage our air conditioner today. With this Internet of Things (IoT) based home automation, you can command your home gadgets from the comfort of your couch. The user can access this web server from any gadget capable of loading HTML apps, such as a smartphone, tablet, computer, etc.

Where To Buy?
No.ComponentsDistributorLink To Buy
1BreadboardAmazonBuy Now
2DiodesAmazonBuy Now
3Jumper WiresAmazonBuy Now
4LEDsAmazonBuy Now
5ResistorAmazonBuy Now
6TransistorAmazonBuy Now
7Raspberry Pi 4AmazonBuy Now

Components

The needs of this project can be broken down into two broad classes: hardware and software.

Hardware Requirement

  • Raspberry Pi 4

  • Memory card 8 or 16GB running Raspbian Jessie

  • 5v Relays

  • 2n222 transistors

  • Diodes

  • Jumper Wires

  • Connection Blocks

  • LEDs to test.

  • AC lamp to Test

  • Breadboard and jumper cables

  • 220 or 100 ohms resistor

Software Requirement

We'll be using the WebIOPi framework, notepad++ on your PC, and FileZilla to transfer files (particularly web app files) from your computer to the raspberry pi and the Raspbian operating system.

The Raspberry Pi Setup Process

As a good habit, I constantly update the Raspberry Pi before using it for the first time. In this project phase, we will handle the web-to-raspberry-pi connection by upgrading the Pi and setting up the WebIOPi framework. The python Flask framework provides a potentially more straightforward alternative, but getting your hands dirty and looking at how things operate makes DIY appealing. When you get to that point, the fun of DIY begins. Use the updated commands below to upgrade your Raspberry Pi and restart the RPi.

sudo apt-get update

sudo apt-get upgrade

sudo reboot

After this is finished, we can set up the webIOPi framework. Using, verify that you are in your home directory.

cd ~

To download the files from the google page, type wget.

wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz

Then, once the download is complete, unzip the file and enter the directory;

tar xvzf WebIOPi-0.7.1.tar.gz

cd WebIOPi-0.7.1/

Unfortunately, I could not locate a version of WebIOPi that is compatible with the Pi 4; thus, we have to download a patch before proceeding with the setup. Run the instructions below from within the WebIOPi directory to apply the patch.

wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch

patch -p1 -i webiopi-pi2bplus.patch

Once we have those things, we can begin the WebIOPi setup installation process by using the;

sudo ./setup.sh

Just click "Yes" when prompted to install more components during setup. Upon completion, restart your Pi.

sudo reboot

Verify the WebIOPi Setup

Before diving into the schematics and programs, we should power on the Raspberry Pi and ensure our WebIOPi installation is functioning as expected. Execute the command below;

sudo webiopi -d -c /etc/webiopi/config

After running the above command on the pi, open a web browser and navigate to http://raspberrypi.mshome.net:8000 (or HTTP;//thepi'sIPaddress:8000) on the computer that is attached to the pi. When logging in, you'll be asked for a username and password.

Username is webiopi

Password is raspberry

You may permanently disable this login if you no longer need it. Still, it's important to keep unauthorized users from taking control of your home's appliances and Internet of Things (IoT) components. After you've logged in, go to the GPIO header link.

Make GPIO 17 an output; we'll use it to power an LED in this Test.

Following this, attach the led to the Pi 4 as depicted in the schematics.

When you're ready to activate or deactivate the LED, return to the web page where you made the connection and select the pin 11 button. This allows us to use WebIOPi to manage the Raspberry Pi's GPIO pins. If the Test is successful, we can return to the console and exit the program by pressing CTRL + C. Please let me know in the comments if this arrangement has any problems. Once the pilot is finished, we can begin the actual project.

Developing a Web-Based Home-Control application for the Raspberry Pi

In this section, we will alter the WebIOPi service's standard setup and inject our code to be executed on demand. FileZilla or another FTP/SCP copy program will be the first tool we install on our computer. You'll agree that using the terminal to write code on the Pi is a stressful experience, so having access to Filezilla or another SCP program will be helpful. Let's make a project directory in which all our web scripts will be stored before we begin writing the HTML, CSS, and javascript programs for this Internet - of - things Home automated Web app and transferring them to the RPi.

First, make sure you're in your home directory using; next, create the folder; finally, open the newly constructed folder and make an HTML folder inside it.

cd ~

mkdir webapp

cd webapp

mkdir HTML

Make subfolders inside the HTML folder for scripts, CSS, and graphics.

mkdir html/css

mkdir html/img

mkdir html/scripts

Now that we have our files prepared, we can start coding on the computer and transfer our work to the Pi using Filezilla.

The JavaScript Code

Writing the javascript will be our first order of business. An easy-to-use script for interacting with the WebIOPi server. Our four-button web app will only use two relays in the demonstration, and we only intend to control four GPIO pins for this project.


 webiopi().ready(function() {

                        webiopi().setFunction(17,"out");

                        webiopi().setFunction(18,"out");

                        webiopi().setFunction(22,"out");

                        webiopi().setFunction(23,"out");

                                                var content, button;

                        content = $("#content");

                                                button = webiopi().createGPIOButton(17," Relay 1");

                        content.append(button);

                                                button = webiopi().createGPIOButton(18,"Relay 2");

                        content.append(button);

                                                button = webiopi().createGPIOButton(22,"Relay 3");

                        content.append(button);

                                                button = webiopi().createGPIOButton(23,"Relay 4");

                        content.append(button);

                                });

Once the WebIOPi is ready, the preceding code is executed. To help you understand JavaScript, we've explained below:

  • webiopi().ready(function()

All this tells our system to make this function and call it once the webiopi is set.

  • webiopi().setFunction(23,"out")

We can instruct the WebIOPi program to use GPIO23 for output. Four buttons are now available, but you may add more if necessary.

  • var content, button

With this line, we're instructing the system to make a new variable called content into a button.

  • content = $("#content")

We will continue using the content variable in our HTML and CSS. As a result, the WebIOPi framework generates everything connected to #content when it is mentioned.

  • button = webiopi().createGPIOButton(17,"Relay 1")

WebIOPi can make several distinct types of push buttons. This code instructs the WebIOPi program to generate a GPIO key that operates on the GPIO pin identified as "Relay 1" above. The other ones are the same, too.

  • content.append(button)

Add this code to the button's existing HTML or external code. New buttons can be made that are identical to this one in every respect. This is especially helpful while coding or writing CSS.

If you made your JS files the same way I did, you can save them and then move them with Filezilla to webapp/HTML/scripts after you've finished making them. Now we can move on to developing the CSS.

The CSS Code:

With the aid of CSS, our Internet of Things (IoT) Rpi 4 home automation website now looks fantastic. So that the website will look like the one in the picture below, I built a custom style sheet called smarthome.css.

I don't want to paste the entire CSS script here, so I'll use a subset for the explanation. If you want to learn CSS, all you have to do is read the code. You can skip this and use our CSS code if you want to.

The first section of the script, displayed below, represents the web application's main stylesheet.

 body {

         background-color:#ffffff;

         background-image:URL('/img/smart.png');

         background-repeat:no-repeat;

         background-position:center;

         background-size:cover;

         font: bold 18px/25px Arial, sans-serif;

         color:LightGray;

     }

The above code, which I hope needs no explanation, begins by setting the background colour to white (#ffffff), adds a background image to the document from the specified folder (remember the one we created earlier? ), makes sure the picture doesn't duplicate by setting the background-repeat to no-repeat, and finally tells the CSS to center the background. Next, we adjust the background's text size, font, and colour.

After finishing the main content, we styled the buttons with CSS.

button {

         display: block;

         position: relative;

         margin: 10px;

         padding: 0 10px;

         text-align: center;

         text-decoration: none;

         width: 130px;

         height: 40px;

         font: bold 18px/25px Arial, sans-serif;  color: black;

         text-shadow: 1px 1px 1px rgba(255,255,255, .22);

         -WebKit-border-radius: 30px;

          -Moz-border-radius: 30px;

          border-radius: 30px;

}

Everything else in the script is similarly optimized for readability and brevity. You can play with them and see what happens; this kind of learning is known as "learning by doing," I believe. However, CSS's strengths lie in its simplicity, and its rules are written in plain English. The button's text shadow and button shadow are two of the few supplementary features found in the block's other section. To top it all off, pressing the button triggers a subtle transition effect, making it look polished and lifelike. To guarantee optimal page performance on all browsers, these are defined independently for WebKit, firefox, opera, etc.

The following code snippet notifies the WebIOPi service that it is receiving data as input.

input[type="range"] {

                                                display: block;

                                                width: 160px;

                                                height: 45px;

                        }

Providing feedback on when a button is pressed will be the last element we want to implement. As a result, the screen's colour scheme and button hues provide a quick indicator of progress. To accomplish this, the following line of code is added to each button's HTML.

                        #gpio17.LOW {

                                                background-color: Gray;

                                                color: Black;

                        }

                        #gpio17.HIGH {

                                                background-color: Red;

                                                color: LightGray;

                        }

The code snippets up top alter the button's color depending on the user's selection. The button's background is gray when it is inactive (at LOW) and red when it is active (at HIGH). Now that we have our CSS under control let's save it as smarthome.css, upload it to our raspberry pi's styles folder using FileZilla (or another SCP client of your choosing), and fix the remaining HTML code.

HTML Code

The HTML code unifies the style sheets and java scripts.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <meta name="mobile-web-app-capable" content="yes">

        <meta name="viewport" content = "height = device-height, width = device-width, user-scalable = no" />

        <title>Smart Home</title>

        <script type="text/javascript" src="/webiopi.js"></script>

        <script type="text/javascript" src="/scripts/smarthome.js"></script>

        <link rel="stylesheet" type="text/CSS" href="/styles/smarthome.css">

        <link rel="shortcut icon" sizes="196x196" href="/img/smart.png" />

</head>

<body>

                        </br>

                        </br>

                        <div id="content" align="center"></div>

                        </br>

                        </br>

                        </br>

                        <p align="center">Push button; receive bacon</p>

                        </br>

                        </br>

</body>

</html>

The head tag contains several crucial elements.

<meta name="mobile-web-app-capable" content="yes"> 

The code line above makes it possible to add the web app to the mobile device's home screen when using Chrome or Safari. You can access this function using the Chrome menu. This makes it so the app may be quickly launched on any mobile device or desktop computer.

The following line of code provides a measure of responsiveness for the web app. Because of this, it can take up the entire display of any gadget on which it is run.

<meta name="viewport" content = "height = device-height, width = device-width, user-scalable = no" /> 

The web page's title is defined in the following line of code.

<title>Smart Home</title>

The following four lines of code all connect the Html file to multiple resources it requires to function as intended.

        <script type="text/javascript" src="/webiopi.js"></script>

        <script type="text/javascript" src="/scripts/smarthome.js"></script>

        <link rel="stylesheet" type="text/CSS" href="/styles/smarthome.css">

        <link rel="shortcut icon" sizes="196x196" href="/img/smart.png" />

The first line above directly connects to the WebIOPi framework JavaScript, which is stored in the server's root directory. This method must be invoked whenever WebIOPi is used.

The second line tells the HTML document where to find our jQuery script, and the third tells where to get our style sheet. The last line prepares an icon for the mobile desktop, which can be useful if we use the website as an app or a favicon.

To ensure that our HTML code displays whatever is contained in the JavaScript file, we include break tags in the body portion of the code. The definition of our button's content was made previously in the JavaScript code, and its id="content" should bring that to mind.

<div id="content" align="center"></div>

Everybody is familiar with the routine of saving an Html file as index.html and then transferring it to the Pi's HTML folder via Filezilla.

Modifications to the WebIOPi Server for Use in Automated Household Tasks

Before we can begin sketching out circuit diagrams and running tests on our web app, we need to make a few adjustments to the webiopi service's configuration file, instructing it to look for configuration information in our HTML folder rather than the default location.

Edit the configuration by executing the following commands as root:

sudo nano /etc/webiopi/config

Find the section of the configuration file labelled "HTTP" and look for the line that begins with "#" Modify the directory where HTML and resources are stored by default with doc-root.

Remove the # comments from anything below it, and if your folder is organized like mine, set the doc-root to the location of your project file.

doc-root = /home/pi/webapp/html

Lastly, save your work and exit. If you already have another server installed on the Pi utilizing port 8000, you may easily change it. If not, let's stop saving and call it a day.

It's worth noting that the WebIOPi service password can be changed using the command;

sudo webiopi-passwd

A new login name and password will be required. Getting rid of this entirely is possible, but safety comes first.

Finally, issue the following command to start the WebIOPi service.

sudo /etc/init.d/webiopi start

If you want to see how the server is doing, you can do so by;

sudo /etc/init.d/webiopi status

That's why there's a way to halt its execution:

sudo /etc/init.d/webiopi stop

Setup WebIOPi to start automatically with;

sudo update-RC.d webiopi defaults

To do the opposite and prevent it from starting up automatically, use the following;

sudo update-RC.d webiopi remove

Schematic and Explanation of a Circuit

Now that we have everything set up, we can begin developing the schematics for our Web-controlled home appliance.

Whereas I could not procure relay modules, which in my experience, make electronics projects simpler for do-it-yourselfers. So, I'm going to draw some diagrams for regular, single-relay, 5V-powered standalone devices.

Join the components as seen in the fritzing diagram. It's important to remember that your Relay's COM, NO (usually open), and NC (typically Close) contacts could be on opposite sides. Please verify this with a millimetre.

Relays Underlying Operating Principles

Relays can be found anywhere that electricity is being switched, from a simple traffic light controller to a high-voltage switchyard. Relays, in the broadest sense, are equivalent to any other switch. They can connect or disconnect a circuit and are frequently employed to activate or deactivate an electrical load. However, this is a comprehensive statement; there are many other relays, and each Relay behaves slightly differently depending on the task at hand; as the electromechanical Relay is one of the most widely used relays, we will devote more space to discussing it here. In spite of variations in design, all relays work according to the same fundamental concept, so let's dive into the nuts and bolts of relays and talk about how they function.

So, what exactly is Relay?

A relay is called an electromechanical switch that may either establish or rupture an electrical connection. A relay is like a mechanical switch, except that it is activated and deactivated by an electronic signal rather than by physically flipping a switch. It comprises a flexible movable mechanical portion controlled electrically through an electromagnet. Once again, this Relay operating concept is suitable exclusively for electromechanical relays.

A common and widely used relay consists of electromagnets typically employed as a switch. However, there are many kinds of relays, each with its purpose. When a signal is received on one side of the device, it controls the switching activity on the other, much like the dictionary definition of Relay. That's right, a relay is an electromechanical switch that can open and close circuits. This device's primary function is to establish or sever contact with the aid of a signal to turn it ON or OFF automatically and without human intervention. Its primary use is to allow a low-power signal to exert control over a circuit with a high power consumption. Typically, the high-voltage circuit is controlled by a direct current (DC) signal.

How the Relay is Built and Functions

The following diagram depicts the internal structure and design of a Relay.

A coil of copper wire is wound around a core, which is then placed inside a housing. When the coil is electrified, it attracts the movable armature, which is supported by a spring or stand and has a metal contact attached to one end. This assembly is positioned over the core. In most cases, the movable armature is a shared connection point for the motor's internal components and the other wiring harness. The usually closed (NC) pin is linked to the common terminal, while the ordinarily opened (NO) pin is not used in operation. By connecting the armature to the usually open contact whenever the coil is activated, current can flow uninterruptedly through the armature. When the power is turned off, it returns to its starting position.

The picture below shows a schematic of the Relay's circuit in its most basic form.

Relay Teardown: An Inside Look

In the images below, you can see the main components of an electromechanical relay—an electromagnet, a flexible armature, contacts, a yoke, and a spring/frame/stand. They have been thoughtfully placed into a relay.

The workings of a Relay's mechanical components have been outlined below.

  1. Electromagnet

An electromagnet is crucial to the operation of a relay. This metal lacks magnetic properties but can be transformed into a magnet when exposed to an electrical current. It is healthy knowledge that a conductor takes on the magnetic characteristics of the current flowing through it. Thus, a metal can operate as a magnet and attract magnetic objects within its range when wound with a conductive material and powered by an adequate power source.

  1. Movable Armature

A moveable armature is just one piece of metal that can rotate or stand on its own. It facilitates connection-making and -breaking with the contacts attached to it.

  1. Contacts

Internal conductors are the wires that run through a device and hook up to its terminals.

  1. Yoke

It's a tiny metal piece attached to a core that attracts and retains the armature whenever the coil is activated.

  1. Spring (optional)

While some relays can function without a spring, those that do have one attach it to the armature at one end to prevent any snagging or binding. One can use a metal "stand" in place of a spring.

Mechanism of Action of a Relay

Let's examine the differences between a relay's normally closed and normally open states. 

Relay's NORMALLY CLOSED state

If no current flows through the core, there will be no magnetic field, and the device will not be a magnet. As a result, it is unable to draw in the flexible framework. So, the ordinarily closed position of the armature is the starting point (NC).

Relay in NORMALLY OPENED state

When a high enough voltage is supplied to the core, it begins to have a strong magnetic field around itself, allowing it to function as a magnet. The magnetic field produced by the core attracts the movable armature whenever it comes within its field of influence, changing the armature's location. As it has been wired to a normally open relay pin, any external circuits attached to it will no longer operate in the same way.

It is important to connect the relay pins correctly so that the external circuit can do its job. When a coil is powered, the armature is drawn toward it, revealing the switching action; when the power is cut, the coil loses its magnetic property, and the armature returns to its original location. The animation provided below shows the Relay in action.

Transistor functions in the circuit

There is nothing complicated about a transistor, yet there is a lot going on inside it. Okay, so first, we'll tackle the easy stuff. An electronic transistor is a small component that can switch between two functions. It's a switch that can also act as an amplifier.

An amplifier is a device that takes in a little electric current and outputs a significantly larger electric current (called an output current). It can be thought of as a current booster. One of the earliest applications for transistors, this is particularly helpful in devices like hearing aids. A hearing aid contains a microscopic microphone that converts ambient sound into electrical signals. These are then amplified by a transistor and used to power a miniature loudspeaker, which reproduces the ambient noise at a much higher volume.

It is possible to use a transistor as a switch. A transistor is a device that allows for the passage of one electrical current to induce a much larger current to flow through the next part of the device. What this means is that a relatively small current can activate a much larger one. All computer chips function in this general way. As an illustration, a memory chip may have as many as a billion individually controllable transistors. Due to the fact that each transistor can exist in either of two states, it is capable of storing either a zero or a one. A chip's ability to hold billions of zeroes and ones, as well as almost as many regular numbers and letters, is made possible by its billions of transistors.

Diode functions in the circuit

Diodes can range in size from what's shown in the image up top. They feature a cylindrical body that is usually black with a stripe at one end and certain leads that protrude so that we may plug it into a circuit. The opposite terminal is called the cathode and is opposite the anode.

A diode is an electrical component that restricts current flow in one direction.

To illustrate, picture a swing valve fitted in a water line. The water pressure inside the pipe will force open the swing gate, allowing the water to flow uninterrupted. In contrast, the gate will be forced shut, and water flow will stop if the river alters its course. As a result, there is only one direction for water to flow.

Very much like a diode, which we also employ to alter the current flow through a circuit, it allows us to switch it on and off at will.

We have now animated this process using electron flow, in which electrons move from negative to positive. However, traditional flow, positive to negative, is the norm in electronics engineering. It's usually best to start with the conventional current because it's more familiar to most people, but feel free to use either one; we'll assume you're aware of the difference.

It's important to remember that the light-emitted diode will only light up properly if the diode is connected to the circuit in the correct orientation when adding it to a simple Light emitted diode circuit like the one shown above. Only one direction of current can travel through it. Accordingly, its conductive or insulating properties are determined by the orientation in which it is mounted.

So that it can conduct electricity, you must join the black end to the neutral and the striped end to the positive. The forward bias is the condition in which current can flow. If we invert the diode, it will become an insulator and stop the passage of electricity. The term for this is "the reverse bias."

Exactly how would a diode function?

You probably know that electricity is the transfer of electrons between atoms that are not bound. Because of its high number of unpaired electrons, copper is widely used for electrical wiring. Since rubber is an insulator—its electrons are kept very securely, so they cannot flow between atoms—it is used to wrap around the copper wires for our protection.

In a simplified form of a metal conducting atom, the nucleus is at the center, and the electrons are housed in a series of shells around it. It takes a specific amount of energy for an electron to be absorbed into each shell, and each shell has a max number of electrons it can hold. Those electrons that are furthest from the nucleus are the most energetic. Conductors have between one and three electrons in their outermost "valence" shell.

The nucleus acts as a magnet, keeping the electrons in place. However, there is yet another layer, the conduction band. If an electron gets here, it can leave its atom and travel to another. Because the valence shell and conduction band of a metal atom overlap, the electron can move quickly and easily between the two.

The insulator has a tightly packed outer layer. No free space for electrons to occupy. Because of the strong attraction between the nucleus and the electrons and the great distance between the nucleus and the conduction band, the electrons are trapped inside the nucleus and cannot leave. Because of this, electricity is unable to travel through it.

Of course, a semiconductor is also a different type of material. A semiconductor might be silicon, for instance. This material behaves as an insulator because it has one more electron than is necessary in its outermost shell to be a conductor. However, with enough external energy, a few valence electrons can generate enough momentum to hop across to the conduction band, where they can finally break free. Consequently, this substance can perform the roles of both an insulator and a conductor.

Due to the lack of free electrons in pure silicon, engineers must add a small number of materials (called "doping") to the silicon to alter its electrical properties.

This process gives rise to P-type and N-type doping, respectively. The diode itself is a combination of these doped materials.

Two leads connect the anode and cathode to various thin plates inside the diode. P-Type doped silicon is on the anode side of these plates, and the cathode side is N-Type doped silicon—an insulating and protective resin that coats the entire structure.

Consider the material to be pure silicon before it has been doped. There are four silicon atoms surrounding each one. Because silicon atoms need eight electrons to fill their valence shells but only have four available, they share one with their neighbours. Covalent bonding describes this type of interaction.

Phosphorus, an N-type element, can be substituted for a number of silicon atoms in a compound semiconductor. Phosphorus has a 5-electron valence shell because of this. This extra electron isn't needed because particles are sharing them to reach the magic number of 8. This means there's an extra electrons in the material, and it's free to go wherever it wants.

In P-type doping, a substance like aluminum is introduced. Due to its limited valence electron pool of 3, this atom is unable to share an electron with any of its four neighbours. An electron-sized void is therefore made available.

We now have silicon with either too many or too few electrons, depending on the doping method.

Upon joining, the two substances forge a p-n junction. This is a depletion region, and it forms at the intersection. Here, some of the surplus electrons on the N-type side migrate over to fill the vacancies on the P-type side. By moving in this direction, electrons and holes will accumulate on either side of a barrier. Holes are thought to be positively charged since they are the opposite of electrons, which are negatively charged. The resulting accumulation produces two distinct regions, one slightly negatively charged and the other slightly positively charged. This forms an electric field that blocks the path of any more electrons. In regular diodes, the voltage drop over this area is only 0.7V.

By applying a voltage across the diode with the P-Type anode linked to the positive and the N-Type cathode attached to the negative, a forward bias is established, and current can flow. The electrons can't get over the 0.7V barrier unless the voltage source is higher.

We can achieve this by connecting the positive terminal of the power supply to the cathode of an N-type device and the negative terminal to the anode of a P-type device. The diode functions as a conductor to block current because the barrier expands as holes are drawn toward the negative and electrons are drawn toward the positive.

Resistor functions in the circuit

A resistor is a two-terminal, non-active electrical component that reduces the amount of current in electric and electronic circuits. A certain amount can lower the current by strategically placing a resistor in a circuit. From the outside, most resistors will appear identical. But if you crack it open, you'll find a ceramic rod used for insulation within, with copper wire covering the rest of the structure. Those copper twists are crucial to the resistance. When copper is sliced thinner, resistance rises because electrons have more difficulty penetrating the material. We now know that electrons can move more freely through some conductors than insulators.

George Ohm investigated the correlation between resistor size and material thickness. His proof showed that an object's resistance (R) grows in proportion to its length. Because of this, the resistance offered by the lengthier and thin wires is greater. However, wire thickness has a negative effect on resistance.

Once everything is hooked up, you can start your server by browsing to the IP address of your RPi and entering the port you chose earlier (as mentioned in the previous section), entering your password and username and seeing a page that looks like the one below.

All it takes is a few clicks of your mouse to operate four AC home appliances from afar. This can be controlled from a mobile device (phone, tablet, etc.) and expanded with additional switches and relays. Thank you all for reading to the end.

Conclusion

This guide showed us how to set up a web-based control system for our home automation system based on the Raspberry Pi 4. We have learned how to utilize the WebIOPi API to manage, debug, and use raspberry Pi's GPIO, sensors, and adapters from an internet browser or any application. We have also implemented JavaScript, CSS, and HTML code for the web application. For those who thrive on difficulty, feel free to build upon this base and add whatever demanding module you can think of to the project. The following tutorial will teach you how to use a Raspberry Pi 4 to create a Line Follower robot that can navigate obstacles and drive itself.

Capacitance Measurement using Arduino

Hello geeks, welcome to our new project. In this project, we are going to make a very useful and interesting electronics tool that we as engineers or tinkers need in everyday life. We use the capacitor in most of our projects for various purposes such as filters or power supplies. Most of the time, we do not have a provision to measure the capacitor value in our digital multimeter. So, this time we came up with the solution. Hence, we will make our own capacitance measurement tool using Arduino.

Rather than investing in new electronic equipment, we will use an Arduino board and some basic components to measure the capacitance. To make this project, we should have some working knowledge about the capacitor. Here, we will not discuss the in-depth working of capacitors, but we will talk briefly so that it would be easy to understand the working principle of our project.

The capacitor is an electronic component that basically stores the energy when applied to an electric field. It has two parallel terminals connected by two parallel conducting plates separated by a dielectric material. Dielectric materials are electrical insulators(resist to pass the current) that can be polarised by applying an electric field. When we connect a battery with the capacitor then due to potential difference, the electric field is created between two oppositely charged plates of the capacitor and this way the capacitor stores the energy.

Where To Buy?
No.ComponentsDistributorLink To Buy
1CapacitorAmazonBuy Now
2ResistorAmazonBuy Now
3LCD 16x2AmazonBuy Now
4Arduino UnoAmazonBuy Now

Software to install

To make this project, we will need some software to install. As we will make our project in the simulation, so for that we will install Proteus simulation software and for coding, we will use the Arduino IDE.

A brief about Proteus, it is a tool used for simulation and design of electronic circuits. Here we can design different types of electronic circuits and run the simulation. Although Proteus has a very big database for electronic components, still we need to install some libraries which we will use in this project.

  • Arduino UNO - We have to install the library for Arduino UNO.
  • LCD module - We have to install a library for the LCD module.

You can download this whole project for example Proteus Simulation and Arduino Code, by tapping the below button:

Capacitance Measurement using Arduino

Project overview

In this project, we will use the following components-

  • Arduino UNO - We will use this as the main controller for this project. It will calculate the capacitance of the capacitor.
  • 16x2 LCD Module - We will use this to show the result of measured capacitance and some user-related messages.
  • Resistors and Capacitors - We will be using some resistors to make the RC circuit which is required for measuring the capacitance.

Now let's talk about the working of this project. The capacitance of any capacitor is the amount of charge that is stored in that capacitor and its unit is Faraday (F). To measure the capacitance, we will use some basic properties of the capacitor.

So when we connect a power supply with a resistor across the terminals of a capacitor, it will take a certain amount of time to fully charge. And when we connect any discharging resistor as a load across it, then it will take a certain amount of time to fully discharge. And this charging and discharging time will be proportional to the capacitance of the capacitor and the charging resistor in the RC circuit.

We will use the time constant formula for the calculation of capacitance. The time constant of any capacitor is known as the time taken by the capacitor to charge 63 percent of applied voltage or the time taken by the capacitor to discharge to 33 percent of stored voltage.

Here,

T (Tau) = Time constant(Seconds)

R = Resistance (Ohms)

C= Capacitance (Farads)

Using the above principle, we will charge the capacitor using a resistor to reach the charge of the capacitor to 63 percent of applied voltage and we will measure the time taken by the capacitor to reach that point. As we know the resistor’s value and time constant, using these two, we can calculate the capacitance:

Components required

  • Arduino UNO
  • 16x2 LCD module
  • 10 kOhms Resistor
  • 220 Ohms Resistor
  • An unknown capacitor(Enter range here )

Components details

1. Arduino UNO

  • Arduino UNO is an open-source development board that will be used to measure capacitance.
  • It comes with 14 digital I/O pins and 6 analog I/O pins.
  • It has 1 UART, 1 SPI, and 1 I2C hardware which are multiplexed with GPIO pins.
  • Digital pins can be used for input and output for digital data. In this project, we have used digital pins for charging the capacitor.
  • Analog pins have 10 bits of ADC (Analog to Digital convertor) resolution ranging values from 0 - 1023.
  • Analog pins can be used for input and output purposes. In this project, we have used analog pins as input for measuring the discharge and charge voltage.

Note-Whenever uploading the code on the Arduino UNO, disconnect any wire which is connected to Rx(D0) and Tx(D1) pins, otherwise, it will give an error while uploading the code.

2. LCD Module

  • LCD stands for Liquid Crystal Display, and its display is made using liquid crystal technology.
  • For more knowledge of how LCD works, prefer this link Working of LCD display.
  • We have used a 16x2 LCD display in this project.
  • The LCD module works in two different data modes: 8-bit or 4-bit mode.
  • We have used 4-bit mode which means we can send 4-bit data in a single cycle to the LCD module.
  • We have used an LCD module to display the user-related information such as capacitance value and the welcome message.

3. Resistors and Capacitors

  • Resistors, as the name suggests, is an electronic component that controls the flow of current in a circuit.
  • Current flowing in any circuit is inversely proportional to resistance.
  • They are used mostly in every type of electronic circuit for current limiting, voltage divider, and in some noise filters.
  • There are various types of resistors available depending upon the current rating, manufacturing materials, and use case.
  • Although we are making this project in simulation, if you want to make this project using the real components for that we will use the carbon composition through-hole resistors.
  • Capacitors are electronic components that have the ability to store energy.
  • When we connect any battery across the terminals of capacitors then it will start charging.
  • We can store a large amount of charge for a very short period of time in capacitors.

Circuit diagram and Working

Now, we have a list of all the required components. Let's start connecting them.

  • Make sure, we have the correct version of Proteus and have installed all the required libraries which we will be using in this project.
  • Now let’s start creating the new project in the Proteus.
  • Import the listed components to the workspace of Proteus.
  • Now we have imported all the components to the workspace.
  • First, connect the charging resistor of 10K ohms with the digital pin 8 of Arduino UNO and then connect the discharging resistor of 220 ohms with the digital pin 9 of the Arduino UNO.
  • We will use the D8 pin for charging the capacitor and the D9 pin for discharging the capacitor.
  • Now connect the capacitor which we want to measure in between these two resistors and connect another terminal of the capacitor with the ground.
  • Connect an analog pin of Arduino UNO with the discharging resistor terminal and that analog pin will be A0 on Arduino UNO.
  • After that, we are finished with our RC circuit.
  • Let’s connect the LCD module with the Arduino UNO, as we are using the LCD module in 4 bits mode so we need to connect only four data pins with Arduino UNO.
  • Connect D4 pin to D7 pins of the LCD module with D2 to D5 pins of the Arduino UNO.
  • While connecting them, keep in mind that they must be connected in the same order.
  • Connect the RS pin with the D6 and Enable pin with the D7 pin of Arduino UNO.
  • Connect the RW pin with the ground which enables the write mode in the LCD module.
  • Connect the 5v power supply with Vdd and Gnd pins of the LCD module.
  • Now we have connected all the components.
  • Before moving to the coding part, reverify your connections once.

While working on the real components, make sure you have connected the backlight of the LCD module and set the contrast properly otherwise nothing will be visible on the LCD module.

Arduino code of Capacitance measurement-

Downloading and including libraries

  • This project will need the library for the LCD module.
  • Before going to write, we must download and include all the required libraries.
  • We can download the library for the LCD module using this link LCD module library.
  • To include the library, go to the Sketch >> Include Library >> Manage Libraries… Using this, we can add libraries directly by searching the window.
  • Or if you have downloaded the library using the link then you will have a zip file for the library. In this case, follow this path: Sketch >> Include Library >> Add .Zip Library
  • After downloading the library, we are all set to start our code.
  • First, include the LCD library header at the start, make an object for the same, and declare all the pins which are used for the LCD module.

Variable declaration

  • Now we will declare all the variables and pins which we are going to use in this project.
  • Declare the charging pin, discharging pin, and an analog pin for measuring the charging voltage as 8,9 and A0 respectively.
  • Declare variables to store the start time, stop time, and a variable to store the duration.
  • Declare a function “measure()” which will read the analog values.
  • After the declaration, we will define a function “measure()”.
  • We have defined this at the end of the code.
  • This function will read the analog values from the pin and return the values for the same.
  • Here, we have declared and defined the function separately but we can define the function without declaring it, but it is not a good practice to do so and sometimes that will cause errors in the code also.

Void setup()

  • After declaring all the required variables, we will start writing the “void setup()” function.
  • This is a built-in function in the structure of the Arduino sketch.
  • We can write any code without this function. As per the structure of the Arduino sketch, this function must be in the code.
  • In this function, we will write the pin mode and initialization of other peripherals which will be required in the code.
  • This function will only run once when the code starts.
  • So in this function, we will first begin the LCD module and print the instructions to use.
  • Then set the pin mode of pins and the initial state of the pins.

Void loop()

  • This is also a built function of Arduino sketch.
  • As per the structure of the Arduino sketch, we can not delete this function from the code even though we don’t have anything to write in this.
  • This function executes after the “void setup()” function.
  • In this function, we will write our main code which we want to run continuously.
  • As the name suggests this will run in a loop.
  • Initially, when there is no capacitor connected then the analog value will be in the maximum range and that is 1010 to 1030.
  • So now, we will display the message that ‘place a capacitor’ and code will be in a while loop until we connect any capacitor to the circuit.
  • Now when we connect any capacitor, the above condition will be unsatisfied, then code will enter in a next infinite while and there we will write the process of charging and discharging of capacitor and time constant.
  • First, we will discharge the whole capacitor, for that we will run a while loop, and using the measure() function, we will measure the currently stored voltage in the capacitor.
  • And when the stored voltage reaches below or equal to the threshold, we will change the pin mode of pins to start charging the capacitor again and store the start time of charging.
  • Using the measure() function, monitor the charging voltage in the capacitor and when the stored charge reaches 63 percent which is 648 of 1023 then we will stop the charging and store the stop charging time also.
  • And display the charging percent on the LCD module.
  • Now calculate the total time taken by the capacitor to reach the 63 percent of charge and that will be the time constant of the capacitor.
  • Using the time constant formula, we can calculate the capacitance of the capacitor as we know the charging resistor connected to the capacitor.
  • As we know the charging resistor value is 10k ohms, using that when we divide the time taken by the resistor value, then we will get the capacitance.
  • And the calculated result will be displayed on the LCD module for 3 seconds, after that code will enter in an infinite while loop.
  • Now we have to reset the device to measure any new capacitor value.
  • Here, our coding part will be completed, it is time to test our code with the circuit and now we will move to the next section.

Results and Working

  • As we are going to test our project in the Proteus simulation, we have to include the hex file of our code in the Arduino UNO module.
  • The first step is to generate the hex file of the code.
  • Click on the Arduino UNO module in the Proteus then browse to the location of the generated hex file.
  • After adding the code, we are ready to run the simulation and click on the Play button to start the simulation.
  • First of all when the code starts, on the LCD module, we will show the range of capacitance that can be measured using this device and the message to place the capacitor if it is not placed already.
  • When the capacitor is placed, then the discharging process will start to eliminate any pre-stored charge in the capacitor, thus we will get the more accurate value.
  • After 100 percent discharge, the charging process will start and it will go to 63 percent of the stored charge.
  • Thereafter, the code will calculate the capacitance using the time constant formula, and the result will be displayed on the LCD module with the message to reset the device to measure again.
  • After the compilation of the simulation, click on the stop button to stop the running code.

I hope we have covered all the points related to this project such as circuit diagrams, codes, and working simulation. And I think this will be a very useful project for your daily tinker life. Please let us know if you face any difficulties while making this project in the comment section below.

We will be happy to hear if you will make this project used in your projects.

Thanks for reading this article. All the best and see you in the next project.

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