0% found this document useful (0 votes)
18 views2 pages

LCD Power Supply Circuit Code

This document contains an Arduino code for a power supply system using an LCD display. It reads voltage and current values, calculates power and energy, and displays the information on the LCD. The system also includes conditions to indicate over-voltage and whether it is in constant current or constant voltage mode.

Uploaded by

mriganka.rintu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

LCD Power Supply Circuit Code

This document contains an Arduino code for a power supply system using an LCD display. It reads voltage and current values, calculates power and energy, and displays the information on the LCD. The system also includes conditions to indicate over-voltage and whether it is in constant current or constant voltage mode.

Uploaded by

mriganka.rintu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <LiquidCrystal.

h>

LiquidCrystal lcd(7, 5, 3, 2, 1, 0); // -- creating LCD instance

//variables
float Vout = 0;
float Iout = 0; //this maps the measured voltage in volts from 0 t 3.7V
float Vset = 0;
float power=0;
float Iset = 0;
float energy = 0;

unsigned long previousMillis = 0;

unsigned long loop_delay = 300;

void setup() {
analogReference(INTERNAL);

[Link](2,16);
[Link]();
[Link]("Free Circuit Lab");
[Link](0,1);
[Link]("CV CC Pwr Supply");
delay(3000);
}

void get_values()

float V=analogRead(A0);
float I=analogRead(A1);
Vout = (V*15.49/908)-(I*1.17/1023);
Iout = I*1.00/176;
Vset = (analogRead(A2)*15.49/989)-(0.3*Iout) ;
Iset = analogRead(A3)*1.00/174;

power = Vout*Iout; //Calculate power and energy


energy = energy + (Iout/3600);
}

void loop() {
unsigned long currentMillis = millis();

if (currentMillis - previousMillis >= loop_delay)


{
previousMillis = currentMillis;
get_values();

//Print all the values on the display


[Link]();
[Link](9,0);
if (Vout>17){[Link]("Ovr Vtg");}
else{[Link](Vout);
[Link]("V");

[Link](0,0);
if (Iout>6.4){[Link](">6.5A");}
else {[Link](Iout);
[Link]("A");
if (abs(Iout-Iset)<0.3){
[Link](6,0);
[Link]("cc");}
else{
[Link](6,0);
[Link]("cv");}
}

[Link](9,1);
[Link](Vset);
[Link]("Vs");

[Link](0,1);
[Link](Iset);
[Link]("As");

/*[Link](100,22);
[Link](Time);
[Link]("s");*/

[Link](); //This functions will display the data


}
}

You might also like