ff
GERMANY • + Follow
Edit Project
Description
123dsfsdfsdfsdfsd123213ffgsdfsdaf
#include <LiquidCrystal.h>
#include <JC_Button.h>
const float Low_BAT_level = 3.2;
11
//Current steps with a 3R load (R7)
const int Current[] = {0, 37, 70, 103, 136, 169, 202, 235, 268, 301, 334, 367, 400, 440, 470, 500, 540};
const byte RS = 2, EN = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7;
const byte PWM_Pin = 10;
const byte Speaker = 12;
const int BAT_Pin = A0;
int PWM_Value = 0;
unsigned long Capacity = 0;
int ADC_Value = 0;
float BAT_Voltage = 0;
byte Hour = 0, Minute = 0, Second = 0;
bool calc = false, Done = false;
LiquidCrystal lcd(RS, EN, D4, D5, D6, D7);
Button UP_Button(16, 25, false, true);
Button Down_Button(15, 25, false, true);
void setup() {
pinMode(PWM_Pin, OUTPUT);
pinMode(Speaker, OUTPUT);
analogWrite(PWM_Pin, PWM_Value);
UP_Button.begin();
Down_Button.begin();
lcd.setCursor(0, 0);
lcd.begin(16, 2);
lcd.print("Battery Capacity");
lcd.setCursor(0, 1);
lcd.print("Measurement v1.0");
delay(3000);
lcd.clear();
lcd.print("Load Adj:UP/Down");
lcd.setCursor(0, 1);
lcd.print("0");
}
void loop() {
UP_Button.read();
Down_Button.read();
if (UP_Button.wasReleased() && PWM_Value < 80 && calc == false)
{
PWM_Value = PWM_Value + 5;
analogWrite(PWM_Pin, PWM_Value);
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(String(Current[PWM_Value / 5]) + "mA");
}
if (Down_Button.wasReleased() && PWM_Value > 1 && calc == false)
{
PWM_Value = PWM_Value - 5;
analogWrite(PWM_Pin, PWM_Value);
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(String(Current[PWM_Value / 5]) + "mA");
}
if (UP_Button.pressedFor(1000) && calc == false)
{
digitalWrite(Speaker, HIGH);
delay(100);
digitalWrite(Speaker, LOW);
lcd.clear();
timerInterrupt();
}
}
void timerInterrupt() {
calc = true;
while (Done == false) {
Second ++;
if (Second == 60) {
Second = 0;
Minute ++;
lcd.clear();
}
if (Minute == 60) {
Minute = 0;
Hour ++;
}
lcd.setCursor(0, 0);
lcd.print(String(Hour) + ":" + String(Minute) + ":" + String(Second));
lcd.setCursor(9, 0);
ADC_Value = analogRead(BAT_Pin);
BAT_Voltage = ADC_Value * (5.0 / 1024);
lcd.print("V:" + String(BAT_Voltage));
lcd.setCursor(0, 1);
lcd.print("BAT-C: Wait!...");
if (BAT_Voltage < Low_BAT_level)
{
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
Capacity = (Hour * 3600) + (Minute * 60) + Second;
Capacity = (Capacity * Current[PWM_Value / 5]) / 3600;
lcd.print("BAT-C:" + String(Capacity) + "mAh");
Done = true;
PWM_Value = 0;
analogWrite(PWM_Pin, PWM_Value);
digitalWrite(Speaker, HIGH);
delay(100);111
digitalWrite(Speaker, LOW);
delay(100);
digitalWrite(Speaker, HIGH);
delay(100);
digitalWrite(Speaker, LOW);
}
delay(1000);
}
}
Jul 11,2019
21 views
123dsfsdfsdfsdfsd123213ffgsdfsdaf
1 Layers PCB 1 x 1 mm Polyimide Flex, 0.1 mm, 1, Immersion gold (ENIG), Yellow Solder Mask, White silkscreen
121111
21
0
0
Published: Jul 11,2019
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution (CC BY)
License.
Topic
- Comments(0)
- Likes(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
It looks like you have not written anything. Please add a comment and try again.
You can upload up to 5 images!
Image size should not exceed 2MB!
File format not supported!
View More
View More
VOTING
0 votes
- 0 USER VOTES
0.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
More by ff
-
5937690589 54903jgfjagja;lgk vt4w tq4 t5retret246twe grregrfgf
-
123dsfsdfsdfsdfsd123213ffgsdfsdaf #include <LiquidCrystal.h> #include <JC_Button.h> const float Low_BAT_level = 3.2; ...
-
190606test-popo 190606test-popo~~190606test-popo~~190606test-popo~~190606test-popo~~190606test-popo~~190606test-popo...
-
fe wwqwt5421151 twet ytey54 y wtw ytwW255755AW255755AW255755AW255755AW255755AW255755AW255755AW255755AW255755AW255755...
-
dfasg 45143515 t artrqe y yteq yrqe
-
cart-popotest cart-popotest190408~~~cart-popotest190408~~~
-
popo-share order 190408 content test -popo~~123123 Link to Documentation,Link to Source Code
-
1234567890qwerty123 ### DESCRIPTION ( Introduce yourserlf and your project)### TECHNICAL DETAILS (With project photos)##...
-
no file--test~~ no file--test~~no file--test~~no file--test~~no file--test~~no file--test~~no file--test~~
-
软板分享测试~~3333 软板分享测试~~
-
W255755ASD866_pcb测试文件_审核失败 W255755ASD866_pcb测试文件_审核失败~~W255755ASD866_pcb测试文件_审核失败
-
W255755ASD856_PCBWay测试订 单(测试234.v2)文件名很长很长很长 gyqreyyi 3462653
-
W255755ASD846_pcb测试文件_非JDB 32412344
-
W255755ASL409_smt测试文件_B ### DESCRIPTION### TECHNICAL DETAILS / COMPONENTS### LEARN / TOPIC / BUILD INSTRUCTIONS
-
W255755ASL91_PI_备货 ### DESCRIPTION111### TECHNICAL DETAILS / COMPONENTS11### LEARN / TOPIC / BUILD INSTRUCTIONS
You may also like
-
-
-
-
Enter the title_ of your projectEnter the title_ of your projectEnter the title_ of your projectEnter the title_ of your projectEnter the title_
13 0 0 -
-
-