DIY regulated power supply on LM338 and Arduino

 Batteries and accumulators are generally widely used to power electronic circuits and projects, as they are readily available and can be easily connected. But they drain quickly, and then we need new batteries, and they also cannot provide a large current to drive a powerful motor. Therefore, it is better to use a regulated (programmable) power supply to solve these problems.


DIY regulated power supply on LM338 and Arduino

And in this material, an example of creating such a source based on LM338 and Arduino will be given, which will provide an adjustable DC voltage in the range from 0 to 24 V with a maximum current of up to 3 A.


For most of our sensors and motors, we use voltage levels such as 3.3V, 5V, or 12V. But while sensors require milliampere current, motors such as servomotors or DC motors that operate at 12 V or more, require high current. Thus, we will create a regulated power supply with a current of 3 A with an AC voltage from 0 to 24 V.


A regulated power supply is a source that converts the voltage from your AC mains into DC voltage and regulates it to the required level. Our power supply uses a 24V 3A step-down transformer that rectifies AC to DC using a diode bridge. The resulting reduced DC voltage is adjusted to the required level with the LM338K and monitored with a potentiometer. The Arduino and LCD are powered by a low voltage voltage regulator IC like the 7812.


So the transformer lowers our voltage (220V) to 24V, and we directly transfer it to our bridge rectifier. A bridge rectifier should give you 33.9 volts, but don't be surprised if you get roughly 27 - 30 volts. This is due to the voltage drop across each diode in our bridge rectifier. Now let's stabilize the output voltage with a high current regulator like the LM338K. The connection diagram for such a voltage regulator is shown below.


LM338

The value of R1 and R2 must be calculated using the above formulas to determine the output voltage. In our case, we get R1 equal to 110 ohms and R2 as 5 kΩ. Once our regulated output is ready, we just need to turn on the Arduino. To do this, we will use the 7812 as the Arduino will draw less current. The 7812 input voltage is our rectified 24VDC output from a rectifier. The output voltage of 12V DC is fed to the Vin pin of the Arduino. Do not use the 7805 as the 7805 has a maximum input voltage of only 24V while the 7812 can handle up to 24V. The 7812 also requires a heatsink as the voltage drop is very high. The complete wiring diagram for a 0-24V, 3A regulated power supply is shown below.


DIY regulated power supply on LM338 and Arduino

In addition to the above components, there is also an RC low-pass filter to suppress noise, and in it R = 5.2K and C = 100uF are used to filter out noise in our signal. Also, an ACS712 current sensor has been added to our circuit to measure the output current. The program code for the implementation of the power supply is shown below.



#include <LiquidCrystal.h>

// инициализировать библиотеку с номерами интерфейсных выводов
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); 

void setup() 
{
  Serial.begin(9600);
  // установите количество столбцов и строк на ЖК-дисплее:
  lcd.begin(16, 2);
  // Распечатать сообщение на ЖК-дисплее.
  lcd.setCursor(0, 0);
  lcd.print("RPS");
  lcd.setCursor(0, 1);
  lcd.print("-Circuit Digest");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Voltage = ");
}

int voltage; 

void loop() 
{
  int A1 = analogRead(A0);
  voltage = map(A1,0,1024,0,22);
  Serial.println(voltage);
  lcd.setCursor(10,0);
  lcd.print(voltage);
  delay(1000);        
}
Previous Post Next Post

Contact Form