Build your own Adjustable Electronic DC Load using Arduino

The circuit board design seems to be missing the resistors R12&R13 on the Mosfet and Opamp IC2A. Will this circuit operate without these components?

Yes, it will work. Those components are not reflected in the board but you can add this depending on the Mosfet type and gate resistance. It is good to use R12. R13 is not mandatory.

  Joined February 12, 2018      696
Monday at 02:11 PM

I have built the dc load without using the 2 resistors and everything works fine, except that the actual current and actual voltage fluctuate on the display.

Their values change very rapidly, although it is always around the figure in the Set display, for current, and what is on my dc power supply, for the voltage.

Would adding the resistors correct this? Also, what is the value of the 2 ceramic capacitors mounted on the PCB?

Thanks

John

  Joined October 22, 2021      6
Friday at 09:02 PM

Those are 0.1uF capacitor with 50V rating. Did you installed those on your application?

  Joined February 12, 2018      696
Monday at 02:11 PM

I did install 2 X 0.1uf ceramic capacitors (ref: 104) however, I'm not sure of the voltage rating. I think it should be good for 50v though.

I have noticed that the actual voltage and current only seem to fluctuate wildly when the set current is higher than the actaul voltage i.e. I set the current for 400ma and the actual voltage is below 5 volts and it is fairly stable.

I haven't installed R12. Do you think this could be the reason for the jumping figures?

Thanks

  Joined October 22, 2021      6
Friday at 09:02 PM

Not really, but you could use that too.

However, could you please share the code that you are using?

  Joined February 12, 2018      696
Monday at 02:11 PM

Hi Sourav,

Thanks for your reply.

The code I have used is that which is on your 2nd March 2020 post on Circuit Digest.

#include <SPI.h>
#include <LiquidCrystal.h>
#define SS_PIN 10
#define MAX_VOLT 5.0
#define load_resistor 0.1
#define opamp_gain 6
#define average 10
const int slaveSelectPin = 10;
int number = 0;
int increase = A2;
int decrease = A3;
int current_sense = A0;
int voltage_sense = A1;
int state1 = 0;
int state2 = 0;
int Set = 0;
float volt = 0;
float load_current = 0.0;
float load_voltage = 0.0;
float current = 0.0;
float voltage = 0.0;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup() {
  // set the slaveSelectPin as an output:
  pinMode(slaveSelectPin, OUTPUT);
  pinMode(increase, INPUT);  // declare LED as output
  pinMode(decrease, INPUT);    // declare pushbutton as input
  pinMode(current_sense, INPUT);  // 
  pinMode(voltage_sense, INPUT);    // 
  // initialize SPI:
  SPI.begin();
  //set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
  // Print a message to the LCD.
    lcd.print("Digital Load");
    lcd.setCursor(0, 1);
    lcd.print("Circuit Digest");
    delay (2000); 
}
void convert_DAC(unsigned int value)
{
   /*Step Size = 2^n, Therefore 12bit 2^12 = 4096
     For 5V reference, the step will be 5/4095 = 0.0012210012210012V or 1mV (approx)*/
  unsigned int container ;
  unsigned int MSB;
  unsigned int LSB;
  /*Step: 1, stored the 12 bit data into the container
   Suppose the data is 4095, in binary 1111 1111 1111*/
  container = value;    
  /*Step: 2 Creating Dummy 8 bit. So, by dividing 256, upper 4 bits are captured in LSB
   LSB = 0000 1111*/
  LSB = container/256;
  /*Step: 3 Sending the configuration with punching the 4 bit data. 
   LSB = 0011 0000 OR 0000 1111. Result is 0011 1111 */
  LSB = (0x30) | LSB;
  /*Step:4 Container still has the 21bit value. Extracting the lower 8 bits.
   1111 1111 AND 1111 1111 1111. Result is 1111 1111 which is MSB*/  
  MSB = 0xFF & container;    
 /*Step:4 Sending the 16bits data by dividing into two bytes. */
    digitalWrite(slaveSelectPin, LOW);
    delay(100);      
    SPI.transfer(LSB);
    SPI.transfer(MSB);    
    delay(100);
    // take the SS pin high to de-select the chip:
    digitalWrite(slaveSelectPin, HIGH);             
}
float read_current (void){
          load_current = 0;          
          for (int a = 0; a < average; a++){
          load_current = load_current + analogRead(current_sense);                
        }
        load_current = load_current / average;
        load_current = (load_current* MAX_VOLT) / 1024;
        load_current = (load_current / opamp_gain) / load_resistor; 
        return load_current;
}
float read_voltage (void){
          load_voltage = 0;          
          for (int a = 0; a < average; a++){
          load_voltage = load_voltage + analogRead(voltage_sense);                
        }
        load_voltage = load_voltage / average;
        load_voltage = ((load_voltage * MAX_VOLT)/1024.0)*6;
        return load_voltage;
}
void loop () {
        state1 = analogRead(increase);
        if (state1 > 500){
          delay(50);
           state1 = analogRead(increase);
           if (state1 > 500){
              volt = volt+0.02;
           }                    
        }
         state2 = analogRead(decrease);
        if (state2 > 500){
          delay(50);
           state2 = analogRead(decrease);
           if (state2 > 500){
              if (volt == 0){
                volt = 0;
              }
            else{
                volt = volt-0.02;
            }              
           }
        }
        number = volt / 0.0012210012210012;
        convert_DAC (number);        
        voltage = read_voltage();
        current = read_current();       
         lcd.setCursor(0, 0);
         lcd.print("Set Value");      
        lcd.print("=");
        Set = (volt/2)*10000; 
        lcd.print(Set);       
        lcd.print("mA    ");
        lcd.setCursor(0, 1);        
        lcd.print("I");      
        lcd.print("="); 
        lcd.print(current);       
        lcd.print("A ");
        lcd.print(" V");  
        lcd.print("=");
        lcd.print(voltage);       
        lcd.print("V");               
       // lcd.print(load_voltage);
        //lcd.print("mA    ");
       // delay(1000);
        //lcd.clear();
}

  Joined October 22, 2021      6
Friday at 09:02 PM

Use proper heatsink. Otherwise the current drift due to high temparature. Also use higher wattage resistor.

  Joined February 12, 2018      696
Monday at 02:11 PM

I have used a good heatsink and have also installed a cooling fan, so I don't think temperature is the issue.

When you say, use a higher wattage resistor, is that the shunt resistor or the other resistors used in the circuit?

 

  Joined October 22, 2021      6
Friday at 09:02 PM

It is the shunt resisot. Problem is a shunt resistor has value drifiting when became too hot. You need to choose ver low toallernce resistor with very high ppm.

  Joined February 12, 2018      696
Monday at 02:11 PM

Hi Sourav,

I think I may have identified the issue which causes the actual current and voltage to fluctuate. I have been using my DC power supplies to test the DC load and, as they are regulated I think that they are trying to maintain the votage/current whilst the DC load is try to draw the set current.

I have tested the DC load with a battery and it doesn't fluctuate.

I do have another issue though. I tried connecting the DC load to a Dewalt 18v battery and increased the current to about 1.5 amps, but it blew the Mosfet. I note that you said the load was good for about 5 amps so do you think I would be able to set the current for more than 1.5 amps if I add the R12 10k resistor?

John

  Joined October 22, 2021      6
Friday at 09:02 PM

Haivng connected 5 AMP is not a problem if you use bigger wattage heatsink with the Mosfet and the Bigger wattage resistor for as the load resistor.

 

The load resistor is 0.1R. The wattage required is = 5 x 5 x 0.1 = 2.5W  [Atleast a 5 W resistor is required]

The heat sink that is used in the project is too small. Increase the heatsink atleast 3-4 times.

 

Use a low RDSon Mosfet for better operation.

 

  Joined February 12, 2018      696
Monday at 02:11 PM