• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Need circuit help? Post them in the comments! I've answered over 50,000!

Blog | Categories | About | Contact | Calculators-online
You are here: Home / Arduino Projects / Over Current Cut-off Power Supply Using Arduino

Circuit Simulator: Assemble and Simulate

Over Current Cut-off Power Supply Using Arduino

Last Updated on December 5, 2024 by Swagatam 42 Comments

In this post I will show how to construct a battery eliminator / DC variable power supply which will automatically cut-off the supply, if the current flow through the load exceeds the preset threshold level.

Table of Contents
  • Main Technical Features
  • The Design
  • Connection Details
  • Power Measuring Stage
  • Relay Connection Details for the above Design:
  • Program Code:

By Girish Radhakrishanan

Main Technical Features

The proposed over current cut-off power supply circuit using Arduino has 16 X 2 LCD display, which is used to show case the voltage, current, power consumption and preset threshold current limit in real time.

Being an electronics enthusiast, we test our prototypes on a variable voltage power supply. Most of us own a cheap variable power supply which might don’t sport neither voltage measuring / current measuring feature nor short circuit or over current protection built in.

That’s because power supply with these mentioned features can bomb on your wallet and will be overkilled for hobby usage.

Short circuit and over current flow is a problem for beginners to professionals and beginners are prone to this more often because of their inexperience, they might reverse the power supply’s polarity or connect the components in wrong way, etc.

These things can cause the current flow through the circuit unusually high, resulting in thermal runaway in semiconductor and passive components which results in destruction of valuable electronic components. In these cases ohm’s law turns into an enemy.

If you never made a short circuit or fried circuit, then congrats! You are one of few people who are perfect in electronics or you never try something new in electronics.

The proposed power supply project can protect the electronic components from such frying destruction, which will be cheap enough for an average electronics hobbyist and easy enough to construct one for who is slightly above beginner level.

The Design

The power supply has 3 potentiometers: one for adjusting the LCD display contrast, one for adjusting the output voltage ranging from 1.2 V to 15V and the last potentiometer is used for setting the current limit ranging from 0 to 2000 mA or 2 Ampere.

The LCD display will update you with four parameters every second: the voltage, current consumption, pre-set current limit and power consuming by the load.

The current consumption via load will be displayed in milliamps; the pre-set current limit will be displayed in milliamps and the power consumption will be displayed in milli-watts.

The circuit is divided into 3 parts: the power electronics, the LCD display connection and power measuring circuit.

These 3 stage may help the readers to understand the circuit better. Now let’s see the power electronics section which controls the output voltage.

Schematic diagram:

warning message: electricity is dangerous, proceed with caution
power supply circuit for Arduino

The 12v-0-12v / 3A transformer will be utilized for stepping down the voltage, the 6A4 diodes will convert the AC into DC voltage and the 2000uF capacitor will smooth out the choppy DC supply from diodes.

The LM 7809 fixed 9V regulator will convert the unregulated DC to regulated 9V DC supply.

The 9V supply will power the Arduino and relay. Try to use a DC jack for arduino’s input supply.

Don’t skip those 0.1uF ceramic capacitors which provide good stability for output voltage.

The LM 317 provides variable output voltage for the load which is to be connected.

You can adjust the output voltage by rotating the 4.7K ohm potentiometer.

That concludes the power section.

Now let’s see the display connection:

Connection Details

Arduino connected with LCD disaply

There is nothing to explain here much, just wire up the Arduino and LCD display as per the circuit diagram. Adjust the 10K potentiometer for better viewing contrast.

The above display shows the sample readings for the four parameters mentioned.

Power Measuring Stage

Now, let’s see the power measurement circuit in detail.

The power measuring circuit comprises of voltmeter and ammeter.

The Arduino can measure voltage and current simultaneously by connecting the network of resistors as per the circuit diagram.

resistor network for Over Current Cut-off Power Supply Using Arduino

Relay Connection Details for the above Design:

Arduino relay connection details

The four 10 ohm resistors in parallel which forms 2.5 ohm shunt resistor which will be utilized for measuring the current flow through the load.

The resistors should be at least 2 watt each.

The 10k ohm and 100k ohm resistors helps the Arduino to measure voltage at the load. These resistor can be one with normal wattage rating.

If you want to know more about the working of Arduino based ammeter and voltmeter check out these two links:

Voltmeter: https://www.homemade-circuits.com/2016/09/how-to-make-dc-voltmeter-using-arduino.html

Ammeter: https://www.homemade-circuits.com/2017/08/arduino-dc-digital-ammeter.html

The 10K ohm potentiometer is provided for adjusting the maximum current level at the output.

If the current flow through the load exceeds the pre-set current the output supply will be disconnected.

You can see the preset level in the display it will be mentioned as “LT” (Limit).

Say for example: if you set the limit as 200, it will gives out current till 199mA. If the current consumption gets equal to 200 mA or above the output will be immediately cut-off.

The output is turned on and off by the Arduino pin #7.

When this pin is high the transistor energizes the relay which connects the common and normally open pins, which conducts the positive supply for the load.

The diode IN4007 absorbs the high voltage back EMF from the relay coil while switching the relay ON and OFF.

Program Code:

//------------------Program Developed by R.GIRISH------------------//
#include <LiquidCrystal.h>
#define input_1 A0
#define input_2 A1
#define input_3 A2
#define pot A3
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int Pout = 7;
int AnalogValue = 0;
int potValue = 0;
int PeakVoltage = 0;
int value = 0;
int power = 0;
float AverageVoltage = 0;
float input_A0 = 0;
float input_A1 = 0;
float output = 0;
float Resolution = 0.00488;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000;
float R2 = 10000;
unsigned long sample = 0;
int threshold = 0;
void setup()
{
lcd.begin(16,2);
Serial.begin(9600);
pinMode(input_3, INPUT);
pinMode(Pout, OUTPUT);
pinMode(pot, INPUT);
digitalWrite(Pout, HIGH);
}
void loop()
{
PeakVoltage = 0;
value = analogRead(input_3);
vout = (value * 5.0) / 1024;
vin = vout / (R2/(R1+R2));
if (vin < 0.10)
{
vin = 0.0;
}
for(sample = 0; sample < 5000; sample ++)
{
AnalogValue = analogRead(input_1);
if(PeakVoltage < AnalogValue)
{
PeakVoltage = AnalogValue;
}
else
{
delayMicroseconds(10);
}
}
input_A0 = PeakVoltage * Resolution;
PeakVoltage = 0;
for(sample = 0; sample < 5000; sample ++)
{
AnalogValue = analogRead(input_2);
if(PeakVoltage < AnalogValue)
{
PeakVoltage = AnalogValue;
}
else
{
delayMicroseconds(10);
}
}
potValue = analogRead(pot);
threshold = map(potValue, 0, 1023, 0, 2000);
input_A1 = PeakVoltage * Resolution;
output = (input_A0 - input_A1) * 100;
output = output * 4;
power = output * vin;
while(output >= threshold || analogRead(input_1) >= 1010)
{
digitalWrite(Pout, LOW);
while(true)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Power Supply is");
lcd.setCursor(0,1);
lcd.print("Disconnected.");
delay(1500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Press Reset the");
lcd.setCursor(0,1);
lcd.print("Button.");
delay(1500);
}
}
while(output >= threshold || analogRead(input_2) >= 1010)
{
digitalWrite(Pout, LOW);
while(true)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Power Supply is");
lcd.setCursor(0,1);
lcd.print("Disconnected.");
delay(1500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Press Reset the");
lcd.setCursor(0,1);
lcd.print("Button.");
delay(1500);
}
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("V=");
lcd.print(vin);
lcd.setCursor(9,0);
lcd.print("LT=");
lcd.print(threshold);
lcd.setCursor(0,1);
lcd.print("I=");
lcd.print(output);
lcd.setCursor(9,1);
lcd.print("P=");
lcd.print(power);
Serial.print("Volatge Level at A0 = ");
Serial.println(analogRead(input_1));
Serial.print("Volatge Level at A1 = ");
Serial.println(analogRead(input_2));
Serial.print("Voltage Level at A2 = ");
Serial.println(analogRead(input_3));
Serial.println("------------------------------");
}

//------------------Program Developed by R.GIRISH------------------//

By now, you would have gained enough knowledge to construct a power supply which protect you valuable electronic components and modules.

If you have any specific question regarding this over current cut-off power supply circuit using Arduino feel free to ask in comment section, you may receive a quick reply.

You'll also like:

  • 1.  Arduino Pure Sine Wave Inverter Circuit with Full Program Code
  • 2.  LM317 with Outboard Current Boost Circuit
  • 3.  How to Design a Flyback Converter – Comprehensive Tutorial
  • 4.  1.5V to 12V DC Converter Circuit Diagram for LEDs
  • 5.  How to Repair a Switch-Mode-Power-Supply (SMPS)
  • 6.  Wireless Thermometer Using 433 MHz RF Link Using Arduino

Filed Under: Arduino Projects, Power Supply Circuits Tagged With: Arduino, Current, Over, Power, Supply

About Swagatam

I am an electronics engineer and doing practical hands-on work from more than 15 years now. Building real circuits, testing them and also making PCB layouts by myself. I really love doing all these things like inventing something new, designing electronics and also helping other people like hobby guys who want to make their own cool circuits at home.

And that is the main reason why I started this website homemade-circuits.com, to share different types of circuit ideas..

If you are having any kind of doubt or question related to circuits then just write down your question in the comment box below, I am like always checking, so I guarantee I will reply you for sure!

Previous Post: « Make this Advanced Digital Ammeter using Arduino
Next Post: Introduction to EEPROM in Arduino »

Reader Interactions

Comments

  1. MOSES says

    May 29, 2025 at 3:25 am

    GOOD DAY SIR! PLEASE I WOULD LIKE YOU WRITE A CODE FOR AC LOAD MONITORING USING ARDUINO UNO. THE POWER LIMIT OF THE LOAD WILL BE SET USING PUSH BUTTONS. THERE WILL BE WARNING ALARM AS SOON AS THE LIMIT IS REACHED FOR 3 TIMES AFTER WHICH THE LOAD WILL BE SHUTDOWN. THE PROCESSES WILL BE SHUN ON THE LCD THROUGH I2C.

    Reply
    • Swagatam says

      May 29, 2025 at 1:12 pm

      Hi Moses, I will try to figure it out, and let you know soon…

      Reply
      • MOSES says

        May 30, 2025 at 12:08 am

        THANK YOU SO MUCH SIR. YOU HAVE BEEN HELPFUL TO ME . I AM EAGERLY WAITING FOR IT SIR.

        Reply
        • Swagatam says

          May 30, 2025 at 7:06 pm

          Here’s the complete code.
          ACS712 OUT = connect to A0
          Button1 (Increase) = connect to D2 (Pull-down 10k to GND)
          Button2 (Decrease) = connect to D3 (Pull-down 10k to GND)
          Buzzer = connect to D4
          Relay module IN = connect to D5
          LCD SDA = connect to A4
          LCD SCL = connect to A5
          ACS712 VCC/GND, Relay VCC/GND, Buzzer = Connect to Arduino 5V/GND

          #include
          #include

          #define CURRENT_SENSOR A0
          #define BUTTON_UP 2
          #define BUTTON_DOWN 3
          #define BUZZER 4
          #define RELAY 5

          LiquidCrystal_I2C lcd(0x27, 16, 2);

          float current = 0;
          int limit = 2; // Default current limit in Amps
          int overCount = 0;
          bool loadOn = true;

          unsigned long lastRead = 0;

          void setup() {
          pinMode(BUTTON_UP, INPUT);
          pinMode(BUTTON_DOWN, INPUT);
          pinMode(BUZZER, OUTPUT);
          pinMode(RELAY, OUTPUT);

          digitalWrite(RELAY, HIGH); // Relay ON
          lcd.begin();
          lcd.backlight();
          lcd.setCursor(0,0);
          lcd.print("AC Load Monitor");
          delay(2000);
          lcd.clear();
          }

          void loop() {
          // Button press handling
          if (digitalRead(BUTTON_UP) == HIGH) {
          limit++;
          delay(300);
          }

          if (digitalRead(BUTTON_DOWN) == HIGH) {
          if (limit > 1) limit--;
          delay(300);
          }

          // Read current every 1 second
          if (millis() - lastRead > 1000) {
          lastRead = millis();
          current = readCurrent(); // Measure current

          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("I:");
          lcd.print(current, 1);
          lcd.print("A Lim:");
          lcd.print(limit);

          lcd.setCursor(0, 1);
          if (loadOn) {
          lcd.print("Load ON ");
          } else {
          lcd.print("Load OFF");
          }

          // Check overload
          if (current > limit && loadOn) {
          beep();
          overCount++;
          lcd.setCursor(10,1);
          lcd.print("Warn:");
          lcd.print(overCount);

          if (overCount >= 3) {
          loadOn = false;
          digitalWrite(RELAY, LOW); // Turn off load
          lcd.setCursor(0,1);
          lcd.print("Overload Shutdown ");
          }
          }
          }
          }

          // Simulated average current read from ACS712
          float readCurrent() {
          long sum = 0;
          for (int i = 0; i < 150; i++) { sum += analogRead(CURRENT_SENSOR); delay(2); } float voltage = (sum / 150.0) * (5.0 / 1023.0); float current = (voltage - 2.5) / 0.1; // For ACS712-20A (100mV/A) if (current < 0) current = 0; return current; }void beep() { digitalWrite(BUZZER, HIGH); delay(200); digitalWrite(BUZZER, LOW); }

          Reply
      • MOSES says

        May 30, 2025 at 10:25 pm

        HELLO SIR! THANK YOU SO MUCH FOR THE CODE AND INSTRUCTIONS YOU SENT TO ME.I APPRECIATE. SIR WHAT I ACTUALLY WANTED IS THE LOAD MONITORING IN WATTAGE. THAT IS WHERE A PARTICULAR LOAD LIMIT WILL BE SET IN WATTAGE. THAT WILL ENABLE ME TO SET A PARTICULAR POWER LIMIT A GIVEN APARTMENT WILL CARRY. SO WHAT MODIFICATIONS CAN BE MADE TO ACHIEVE THAT BASED ON THE CODE YOU SENT TO ME BECAUSE POWER = CURRENTX VOLTAGE. LETS SAY I WANT TO LIMIT THE LOAD AT 500W OR ANYTHING ELSE . AGAIN I INTEND TO THE TYPE OF CURRENT SENSOR TYPICAL OC COMMERCIAL INVERTERS THAT CAN HANDLE UP TO 100A.

        Reply
        • Swagatam says

          June 2, 2025 at 8:36 am

          Moses! I have requested my friend to design it, let’s see if he is able to create the necessary code for this function or not…once done I will let you know…

          Reply
          • MOSES says

            June 3, 2025 at 1:00 am

            OK SIR. AM SUPER GRATEFUL ALREADY. MORE GRACE SIR.

            Reply
            • Swagatam says

              June 3, 2025 at 6:39 pm

              Moses, I have posted the full article in the following link, hope it is as per your requirement. If you have any further questions, please post it under the below article:
              https://www.homemade-circuits.com/100a-ac-load-monitoring-circuit-using-arduino-watt-limit-lcd-alarm-auto-shutdown/

              Reply
  2. Stephen says

    January 5, 2019 at 3:03 am

    Hi sir , I have a megger ago meter . which has burnt four resistors connected in series with the voltage connection leads. The reason was I used it to check voltage across diode in a microwave oven. Please can you help find the value of the burnt resistors

    Reply
    • Swagatam says

      January 5, 2019 at 8:23 am

      Hi Stephen, sorry I do not have any idea about it, you can perhaps try using 4nos 1M resistors and see how it works.

      Reply
  3. Rizal says

    August 9, 2018 at 5:27 pm

    Sir,how can I use a AC load for this project? Beacuse in the diagram I see the load in DC right? Because im planning to use 240V AC light bulb.

    Reply
    • Swagatam says

      August 9, 2018 at 6:12 pm

      Rizal, the above Arduino design can be difficult to modify for an AC current control, however it can very simply done using a transistor based circuit as shown below:

      https://www.homemade-circuits.com/mains-ac-overload-protection-circuit/

      Reply
  4. Rizal says

    July 18, 2018 at 9:30 am

    For IN4007,how is the connection with 5v relay module? As the relay 5v have vcc,ground and in,so how to connect the IN4007 with the relay? Thank you.

    Reply
    • Swagatam says

      July 18, 2018 at 9:55 am

      please see the last diagram.

      Reply
      • rizal says

        July 19, 2018 at 10:54 pm

        sir I cant understand for the relay part..I have buy 5v relay module bt I dont know how to connect IN4007 with the relay as the relay has 3 terminal which is vcc,ground and in.Can you explain sir? Im really appreciate it.

        Reply
        • Swagatam says

          July 20, 2018 at 7:56 am

          Rizal, the above circuit will require an isolated relay without a PCB, so please do not use a relay module, instead buy only a simple relay and wire it as shown in the diagram.

          For more help you can refer to the following article:
          https://www.homemade-circuits.com/how-a-relay-works-in-circuits-how-to-connect-it/

          Reply
  5. Rizal says

    July 16, 2018 at 11:43 pm

    Hye..what happen if I dont use transistor in this project? And can I change 4.7k ohm resistor with 10k ohm resistor? Thank you.

    Reply
    • Swagatam says

      July 17, 2018 at 6:21 am

      Hi, without the transistor you cannot operate the relay. yes 4k7 at the transistor must be changed with a minimum 10K resistor

      Reply
  6. Rizal says

    June 29, 2018 at 1:58 pm

    Sir,I have made the connection accordingly to your schematic diagram but it doesnt work.Can you give a better schematic diagram sir? I mean the connection on the bread board since maybe I have connect wrongly on my bread board.I really need that sir since this is my FYP project. Hope you can consider that. Thank you.

    Reply
    • Swagatam says

      June 29, 2018 at 2:33 pm

      Hi Rizal, the schematic is very clearly presented in the article, please let me know where exactly are you having problems regarding the schematic view?

      Initially You can eliminate the first diagram, and instead use a ready made 9V adapter, and use its output to power the Arduino as well as the “point X”

      Reply
  7. Rizal says

    June 28, 2018 at 10:49 pm

    hye sir,what kind of load I can use to show that when over current occur it will turned off? And how to connect them? Thank you.

    Reply
    • Swagatam says

      June 29, 2018 at 9:30 am

      Hi Rizal, according to me you can add a 9V filament bulb as the load.

      I’ll draw the relay diagram properly soon, and update it in the above article.

      Reply
      • Rizal says

        June 29, 2018 at 1:49 pm

        ok sir..Hope it wont take too much time because Im going to do this for my FYP. Thank you.

        Reply
  8. Valmir says

    March 27, 2018 at 7:28 am

    Hello, what should I modify for an automotive 12 volt 10 amp battery charger?
    Thankful!
    Please reply in my email if possible

    Reply
    • Swagatam says

      March 27, 2018 at 10:05 am

      You can probably experiment with the four 10 ohm resistors for increasing or decreasing the current sensing range

      Reply
      • Valmir says

        March 27, 2018 at 10:53 am

        Thankful

        Reply
        • GR says

          March 30, 2018 at 2:59 pm

          Hi Valmir,

          The maximum capability is 2 A, you can’t use it for 10 Amps in this project, if modified for 10 A, then codes should also be modified accordingly .

          sorry for the previous comment’s misinterpretation.

          Regards

          Reply
  9. Rizal says

    March 6, 2018 at 5:35 pm

    Hye sir..can i get the full schematic diagram for this project? and what type of load you use in this project?

    Reply
    • Swagatam says

      March 6, 2018 at 7:53 pm

      Hi Rizal, the connection diagram is already explained in the schematic, if you are having trouble understanding any specific section, you can tell me here I’ll try to clarify

      Reply
      • Rizal says

        March 30, 2018 at 8:33 am

        Hye sir..for the program code is it correct? Because i have put the program code in the Arduino software but it says error..

        Reply
        • Swagatam says

          March 30, 2018 at 11:51 am

          Rizal, the coeds are correct, did you download the necessary files in your Arduino software before uploading the codes? Anyway I’ll forward this message to Mr. GR for further clarification.

          Reply
        • GR says

          March 30, 2018 at 2:55 pm

          Hi Rizal,

          There is no error in the code, we’ve double checked, Just the code is enough. No need to download any additional library files.

          Regards

          Reply
  10. rajesh says

    September 17, 2017 at 12:00 pm

    can we make 19v 5a=A laptop dc power supply

    Reply
  11. Rohit shing says

    September 2, 2017 at 11:30 am

    discrete components

    Reply
    • Swagatam says

      September 2, 2017 at 3:26 pm

      I have a voltmeter circuit published in this blog:

      https://www.homemade-circuits.com/2013/05/make-this-simple-digital-voltmeter.html

      the same can be modified to measure current by suitably configuring a current sensing resistor

      Reply
  12. Rohit shing says

    September 2, 2017 at 6:02 am

    Hello sir,

    I am start new project & required one digital display circuit

    Input voltage – 54 volt DC
    Show voltage – as for actual for 54 volt dc
    Show load currant – as for actual dc load
    Show A/C current as for actual

    So please provide this circuit

    Reply
    • Swagatam says

      September 2, 2017 at 7:16 am

      Hello Rohit, do you want this in Arduino or using discrete components??

      Reply
    • Rohit shing says

      September 3, 2017 at 5:03 am

      Sir,

      This is only read for A/D voltage but my quiry one single display read DC voltage, Dc load & Ac voltage

      Reply
      • Swagatam says

        September 3, 2017 at 5:30 am

        Rohit, you can use the suggested circuit for all the 3 functions.. but through a selector switch.

        Reply
      • Rohit shing says

        September 3, 2017 at 5:52 am

        Sir,

        Please provide complete circuit diagram with connection can’t understand connection

        Reply
  13. SS says

    August 30, 2017 at 9:09 am

    great article loved it

    Reply
    • Swagatam says

      August 30, 2017 at 9:10 am

      thankx

      Reply

Need Help? Please Leave a Comment! We value your input—Kindly keep it relevant to the above topic! Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar




Subscribe to New Posts

Categories

  • Arduino Projects (89)
  • Audio and Amplifier Projects (132)
  • Automation Projects (17)
  • Automobile Electronics (101)
  • Battery Charger Circuits (83)
  • Datasheets and Components (104)
  • Electronics Theory (143)
  • Free Energy (37)
  • Games and Sports Projects (11)
  • Grid and 3-Phase (19)
  • Health related Projects (25)
  • Home Electrical Circuits (12)
  • Indicator Circuits (14)
  • Inverter Circuits (88)
  • Lamps and Lights (142)
  • Meters and Testers (69)
  • Mini Projects (46)
  • Motor Controller (64)
  • Oscillator Circuits (27)
  • Pets and Pests (15)
  • Power Supply Circuits (108)
  • Remote Control Circuits (50)
  • Security and Alarm (64)
  • Sensors and Detectors (101)
  • Solar Controller Circuits (59)
  • Temperature Controllers (42)
  • Timer and Delay Relay (49)
  • Transmitter Circuits (29)
  • Voltage Control and Protection (39)
  • Water Controller (36)




Other Links

  • Privacy Policy
  • Cookie Policy
  • Disclaimer
  • Copyright
  • Videos
  • Sitemap




People also Search

555 Circuits | 741 Circuits | LM324 Circuits | LM338 Circuits | 4017 Circuits | Ultrasonic Projects | SMPS Projects | Christmas Projects | MOSFETs | Radio Circuits | Laser Circuits | PIR Projects |

Social Profiles

  • Twitter
  • YouTube
  • Instagram
  • Pinterest
  • My Facebook-Page
  • Quora
  • Stack Exchange
  • Linkedin



  • Recent Comments

    • Swagatam on How to Make HHO Fuel Cell Circuit in Automobiles for better Fuel Efficiency
    • Swagatam on How to Repair Mosquito Swatter Bats
    • Pradosh on How to Repair Mosquito Swatter Bats
    • eq on How to Make HHO Fuel Cell Circuit in Automobiles for better Fuel Efficiency
    • Swagatam on 100A AC Load Monitoring Circuit using Arduino, Watt Limit, LCD, Alarm, Auto Shutdown

    © 2025 · Swagatam Innovations