In modern electronics, the ability to monitor and control current flow is essential for maintaining the efficiency and safety of electrical systems. Engineers often rely on current sensors to observe how much current passes through a circuit, helping them analyze system behavior under different conditions. In this project, we simulate the interfacing of a current sensor with an Arduino using the Proteus software environment.
The aim of this simulation is to demonstrate how Arduino can read both the analog and digital outputs of the current sensor to identify the presence and level of current in a circuit. The system also displays the voltage reading and current status on a 20x4 LCD while controlling an LED indicator to represent current detection visually. By the end of this tutorial, you will understand how to integrate current sensors into Arduino-based circuits, interpret their output values, and visualize the results effectively using Proteus.
A current sensor is an electronic device used to detect and measure the amount of current flowing through a conductor. It converts the current into a corresponding voltage signal that can be easily read by microcontrollers like Arduino. These sensors are widely used in power monitoring systems, motor control circuits, and protection mechanisms where accurate current measurement is essential. Here is the image of real current sensor.
In Proteus, however, the current sensor is not available by default. To enable its simulation, a custom library has been developed that includes multiple sensor models, including the current sensor. This addition allows users to simulate real-time current measurement and observe how the Arduino responds to changing current levels. Follow the simple steps to install the current sensor library in Proteus .
The sensor used in this simulation provides both analog and digital outputs. The analog output varies continuously with the sensed current, while the digital output switches between HIGH and LOW states depending on whether the measured current exceeds a predefined threshold. This makes it convenient to visualize and test current detection behavior directly within the Proteus environment.
This project focuses on interfacing a current sensor with Arduino in the Proteus simulation environment. The goal is to monitor the analog and digital outputs of the current sensor and display the corresponding information on an LCD. The setup provides a clear understanding of how current sensors work in conjunction with microcontrollers and how real-time readings can be displayed and interpreted.
The Arduino serves as the central controller, reading the sensor’s analog signal to calculate the voltage and checking the digital output to detect the presence of current. The measured voltage and current status are then shown on a 20x4 LCD, while an LED is used as an indicator to visually represent when current is detected. This simple yet effective design demonstrates how to combine sensing, processing, and displaying within a single system.
To successfully simulate this project in Proteus, you will need to install two additional libraries:
Arduino Library for Proteus – enables you to simulate Arduino boards and run your sketch inside Proteus.
LCD Library for Proteus – allows the 20x4 or 16x2 LCD module to display characters during simulation.
After adding these libraries along with the custom current sensor library, you’ll be able to design the complete circuit, upload the code through Arduino IDE, and visualize the working of the project in real-time within Proteus.
Follow the steps below to create your simulation:
Open the new project in Proteus ISIS.
Go to the pick library through the “P” button and search for the current sensor. If you’ve successfully installed it, it will be shown as in the picture.
Get the Arduino UNO through the same process. For better working, always get the latest version.
Now, you need an LCD and a 20x4 is better because it can accommodate more characters.
Get the LED for the digital pin output. I am getting the green one; you can have any color of your choice.
To produce a valid analog signal at the A0 pin, a load circuit (LC circuit) is added in the simulation to simulate real current flow through a conductor. In actual hardware, this load represents the current-carrying path, but in Proteus, it is necessary to create this path artificially since current cannot flow unless a defined load is present in the circuit. Hence, get the inductor and capacitor.
Get the POT HG (potentiometer). The pick library must contain the following components:
Now, arrange the circuit as shown below:
To complete the current sensor part, go to the terminal mode from the left side of the screen> choose the power terminal, and place it at the respective place. Repeat the step for the ground. Connect the circuit.
Now, go to the virtual instrument section and connect the DC Volmeter to the LC circuit you’ve made.
Arrange the Arduino and LCD on the working area.
Create the full circuit by following the image below:
Start the Arduino IDE and create a new project.
Remove the default code and paste the following:
#include
// LCD pin connections: RS, EN, D4, D5, D6, D7
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
#define SENSOR_A0 A0 // Analog output pin of current sensor
#define SENSOR_D0 6 // Digital output pin of current sensor
void setup() {
pinMode(SENSOR_D0, INPUT);
lcd.begin(20, 4); // Initialize 20x4 LCD
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("CURRENT SENSOR");
lcd.setCursor(5, 1);
lcd.print("TEST MODE");
delay(2000);
lcd.clear();
}
void loop() {
int analogValue = analogRead(SENSOR_A0);
int digitalState = digitalRead(SENSOR_D0);
// Convert analog value (0–1023) to voltage (0–5V)
float voltage = (analogValue * 5.0) / 1023.0;
// --- LCD Display Section ---
lcd.setCursor(0, 0);
lcd.print("Analog: ");
lcd.print(analogValue);
lcd.print(" "); // Prevent ghost digits
lcd.setCursor(0, 1);
lcd.print("Voltage: ");
lcd.print(voltage, 2);
lcd.print(" V "); // 2 decimal precision
lcd.setCursor(0, 2);
lcd.print("Digital: ");
lcd.print(digitalState == HIGH ? "HIGH " : "LOW ");
lcd.setCursor(0, 3);
if (digitalState == HIGH) {
lcd.print("Status: CURRENT ON ");
} else {
lcd.print("Status: CURRENT OFF");
}
delay(500);
}
For your convenience, I am dividing the code into sections and explaining each of them.
#include
// LCD pin connections: RS, EN, D4, D5, D6, D7
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
The LiquidCrystal library allows Arduino to control an LCD display.
The LiquidCrystal lcd(...) line defines which Arduino pins are connected to the LCD.
RS (Register Select) → Pin 13
EN (Enable) → Pin 12
D4–D7 (Data pins) → Pins 11, 10, 9, 8
These connections are required to send commands and display text on the LCD.
2. Pin Definitions
#define SENSOR_A0 A0 // Analog output pin of current sensor
#define SENSOR_D0 6 // Digital output pin of current sensor
Here we define two pins used by the current sensor:
SENSOR_A0 (A0) → Reads the analog voltage from the sensor.
SENSOR_D0 (Pin 6) → Reads the digital output (HIGH or LOW) that indicates whether current is detected.
Using #define makes the code easier to read and modify.
void setup() {
pinMode(SENSOR_D0, INPUT);
lcd.begin(20, 4); // Initialize 20x4 LCD
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("CURRENT SENSOR");
lcd.setCursor(5, 1);
lcd.print("TEST MODE");
delay(2000);
lcd.clear();
}
This section runs once when the Arduino starts:
The digital pin (SENSOR_D0) is set as an input, so Arduino can read the sensor’s logic state.
The LCD is initialized as a 20x4 display.
A welcome message (“CURRENT SENSOR TEST MODE”) is shown for 2 seconds before clearing the screen.
This helps confirm that the LCD is working properly before readings begin.
void loop() {
int analogValue = analogRead(SENSOR_A0);
int digitalState = digitalRead(SENSOR_D0);
The loop() function runs continuously.
analogRead() reads the sensor’s voltage signal (0–1023).
digitalRead() checks whether current is detected (HIGH) or not (LOW).
float voltage = (analogValue * 5.0) / 1023.0;
The Arduino’s analog input reads values from 0 to 1023, corresponding to 0–5 volts.
This line converts the raw analog value into a readable voltage using a simple proportion formula.
lcd.setCursor(0, 0);
lcd.print("Analog: ");
lcd.print(analogValue);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("Voltage: ");
lcd.print(voltage, 2);
lcd.print(" V ");
lcd.setCursor(0, 2);
lcd.print("Digital: ");
lcd.print(digitalState == HIGH ? "HIGH " : "LOW ");
This section shows the sensor readings on the LCD:
Line 1: Displays the raw analog value (0–1023).
Line 2: Displays the corresponding voltage in volts with two decimal places.
Line 3: Displays whether the digital output is HIGH or LOW.
The extra spaces (" ") clear old characters if the new number is shorter.
7. Current Status Display
lcd.setCursor(0, 3);
if (digitalState == HIGH) {
lcd.print("Status: CURRENT ON ");
} else {
lcd.print("Status: CURRENT OFF");
}
delay(500);
Finally, the last LCD line shows whether current is detected or not:
If digitalState is HIGH → “CURRENT ON”
If digitalState is LOW → “CURRENT OFF”
The delay(500) ensures the display updates twice per second (every 0.5 seconds), preventing flicker.
The next step is to make a connection between the Arduino IDE code and the simulation. For this, let’s follow the simple steps:
Compile the Arduino IDE code through the tick button present in the upper left section of the screen.
The loading process will start, and once completed, search for the hex file address. In my case, it is the following:
Copy the hex file address.
Go to the Proteus simulation and double-click the Arduino module.
Paste the Hex file address in the “hex file upload” section.
Click Okay.
During downloading and installing the WCS1600 module, you must have noticed that a hex file is used in the process. Double-click the WCS1600 module.
Insert the hex file address manually or through the file system in the respective section.
Once all the steps are complete, hit the play button in the simulation to see if the project works.
In Proteus, the current sensor model is designed to output an analog voltage that represents the amount of current flowing through a load. Since there’s no real current flow in the simulation, a potentiometer (POT_HG) is used to mimic that behavior.
When you adjust the potentiometer, it changes the resistance in the load circuit (the LC circuit connected to A0). This change in resistance affects the voltage drop across the sensor, which is then read by the Arduino through the A0 pin.
Here’s what happens step-by-step:
Increasing the potentiometer resistance reduces the current flow, resulting in a lower analog voltage at the A0 pin.
The LCD will show a smaller analog value and lower voltage.
The digital output (D0) may turn LOW if the current is below the sensor’s threshold.
Decreasing the potentiometer resistance allows more current to flow, producing a higher analog voltage at A0.
The LCD shows a higher analog value and voltage.
The digital output switches HIGH, and the status line will display “CURRENT ON.”
In short, the potentiometer acts like a manual current control knob — increasing or decreasing its resistance simulates the rise or fall of current in the circuit, helping visualize the sensor’s response in real time.
This project demonstrated how to interface a current sensor with Arduino in a Proteus simulation to monitor current variations visually through an LCD display. The simulation utilized both analog (A0) and digital (D0) outputs of the current sensor to detect and measure current levels.
Since Proteus does not include the current sensor by default, a custom sensor model was used. To generate realistic current behavior, a load circuit using a potentiometer (POT_HG) was connected, simulating how current changes affect the sensor’s output voltage.
The Arduino reads this voltage from the A0 pin, converts it to a corresponding value, and displays it on a 20x4 LCD along with the sensor’s digital status. As the potentiometer resistance is varied, the LCD readings change accordingly—showing how current flow can be visualized dynamically within the simulation.
Through this project, users gain a practical understanding of how a current sensor operates, how analog signals are interpreted by Arduino, and how sensor data can be displayed and analyzed in real-time using Proteus.
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w