0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

I am using a boost circuit as a constant current load, using an IRFZ44 N-channel MOSFET and an IR2104 low side driver taking the signal from Arduino.

When the signal is low (0) a short circuit appears in the source and the power supply shuts off because of the short circuit.

I am using the Arduino as hysteresis control to get constant current at a different voltage.

The program:

void setup() {
  Serial.begin(9600);
  pinMode(2, OUTPUT);
}
void loop() {
  while (true) {
    float avg = 0;
    
   
      avg =  (0.0263935810810811 * analogRead(A0) - 13.51351351351351) ;
    
    

    if (avg >= 1.27) {
      digitalWrite (2, LOW);
    }
    else if (avg <= 1.25) digitalWrite (2, HIGH);

    Serial.print("Current = ");
    Serial.println(avg, 3);
  }

}

enter image description here

enter image description here

\$\endgroup\$
15
  • \$\begingroup\$ Welcome to EE.SE! Please include the component values also. If the problem is with the actual circuit, consider adding a photograph of the actual circuit. How did you determine that a short circuit is occurring? \$\endgroup\$
    – AJN
    Dec 19 '20 at 10:07
  • \$\begingroup\$ What is your question? Can I suggest you do some basic research on how a boost converter works. The transistor is not supposed to be constantly on. \$\endgroup\$
    – RoyC
    Dec 19 '20 at 10:11
  • 1
    \$\begingroup\$ Boost converters work by periodically "shorting" the voltage source through the inductor. The trick is to make that short circuit only for a very short time. How long are your pulses? Post your Arduino code as well as a correct circuit diagram with part values. \$\endgroup\$
    – JRE
    Dec 19 '20 at 10:11
  • \$\begingroup\$ the inductor 0.51mH capacitor is 1000uF and resistor is 10ohm , and i determined that there is short circuit by having short circuit led on in the power supply . \$\endgroup\$ Dec 19 '20 at 10:40
  • \$\begingroup\$ the problem is when the mosfet is off a short circuit appear, the components in the circuit when the mosfet is off , inductor capacitor and resistor so why there is short circuit, is the problem in the drive circuit? do i need pull down resistor? \$\endgroup\$ Dec 19 '20 at 10:43
0
\$\begingroup\$

Your code isn't a boost converter. Depending on how things really run, it may not be switching the output at all.

You need to be generating a pulse width modulated (PWM) signal. The Arduino has them, and misleadingly calls them "analogWrite." It actually generates a PWM signal with the pulse width set by the "analog" value.

Use analogWrite to drive the MOSFET gate, and connect your A0 input to the high side of the 10 ohm resistor. Measure the voltage, divide by 10, and you have your load current.

Raise the analog output if the current is too high, lower the analog output if the current is too low.

The analog (PWM) outputs of the Arduino only range from 0 (full off) to 255 (full on.) That might be too coarse for your use - it may "hunt" up and down all the time because one step is too high and another too low.

The Arduino Timer1 library can help if the control is too coarse. It allows PWM control with 1023 steps.

You'll want to do some averaging on the current measurements, or use a resistor and capacitor as a low pass filter - or, do both. A hardware filter and some software averaging.


Watch that A0 input. You are generating high voltage pulses. They will easily be higher than the allowed 5V on the Arduino input.

Figure out how how the voltage across the load resistor might be, then use a voltage divider and a diode clamp to keep the voltage on A0 at or below 5V.

As an example, a 1 ampere load current through the resistor will require 10 volts across the resistor. You would need to divide the voltage by 2 to get it low enough for your Arduino to safely handle - and you'll have to account for that in your program.

In any case, you have to allow for the 12 volt power supply - you'll need to use a voltage divider because the voltage across the resistor can be 12V any time the PWM isn't running.


Keep the power rating of the load resistor in mind. A load current of 1 ampere through a 10 ohm resistor would mean 10 watts of power. That's a big resistor in comparison with the other parts of your circuit.


That's a lot of information. Look up anything you don't recognize. Ask additional questions about anything you can't understand even after looking it up.


Nice idea to use a boost converter to vary the load current. Some folks don't realize that boosting the voltage means drawing more current from the low voltage side.

\$\endgroup\$
2
  • \$\begingroup\$ I will study your solution thank you for your time, and i am using power resistor 10ohm 500 watt. \$\endgroup\$ Dec 19 '20 at 14:48
  • \$\begingroup\$ The voltage will be around 70V if you are expecting to get 500 watts. You must use a voltage divider and a clamp diode on A0. Alternatively, use a lower valued current shunt resistor between the load resistor and ground. You'll still want to protect against a too high voltage on A0. \$\endgroup\$
    – JRE
    Dec 19 '20 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.