How to Test a Battery : 3 Steps - martinmothasaim
Introduction: How to Prove A battery
INTRODUCTION
How to use Arduino with LEDs to show how much the power persist in the battery.
Material :
Arduino UNO x1 , Breadboard x1, LED x3, Jumper Wire x5, 330Ω Resistor x4, Battery x1
What is this ?
We use three LEDs to register how much the power remain Eastern Samoa Low (only one LED flaming), Medium (two LEDs), Sonorous charged(All LEDs). You will learn how to use analogue pins to consequence data from unlikely of the add-in.
Whole tone 1: Circuit
Step 2: Representative Code
int LED1 = 8; //Hardening up pin 8,9,10 (the one adjoining to a LED) to be an output.
int LED2 = 9;
int LED3 = 10;
int Value = 0; //Order for the value of analog pin.
ice-cream float V = 0; //Voltage of the bettary
empty setup() {
pinMode(LED1, OUTPUT); //The one as "pinMode(8,9,10, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
}
void loop() { BettaryRead(); // We're only "calling" the
// function Hera (effectual it to streamlet). The actual function code
// is further down in the survey.
LED();
}
void BettaryRead(){
Value = analogRead(A0); //Read external voltages on the linear input
//and importation the number into Value.
V = Esteem * 0.0048; //It returns an whole number number that ranges from 0 (0 Volts) to 5115 (15 Volts), //so we do this to make the unit into V. }
void LED(){
if (V >= 1.5) { //If the voltage of bettary higher than 1.5, illumine all LEDs. (High) digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, High gear);
}
else if (V < 1.5 &adenosine monophosphate;&adenosine monophosphate; V >= 0.78) { //If the bettary is slightly old, light up two LEDs. (Mid)
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
}
other if (V < 0.78) {
digitalWrite(LED3, Eminent); //If the bettary is about give way, light up one LED. (Low) }
else if (V <= 0) { //If the bettary died, sour all the LEDs off.
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW); }
}
Step 3:
Key Code :
analogRead();
We use this function to read the value on an analog pin.
What you Should Construe :
When the barrage fire connected on Arduino, you should fancy LEDs are stably afire.
Problems you might have :
1. If the LEDs were not lighted, check your circuit, especially the anode and the cathode of the LED.
2. If your LEDs are lighting randomly, you can use Serial functions to check the imported number from analog pin. The bombardment might not connect aright Oregon completely.
Be the First to Share
Recommendations
-
Anything Goes Contest 2022
Source: https://www.instructables.com/How-to-Test-a-Battery-1/
Posted by: martinmothasaim.blogspot.com
0 Response to "How to Test a Battery : 3 Steps - martinmothasaim"
Post a Comment