久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 11459|回復(fù): 10
打印 上一主題 下一主題
收起左側(cè)

簡易測電池容量儀制作 附Arduino代碼

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:85865 發(fā)表于 2019-1-26 11:47 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
以前做項目剩有幾十個14500鋰電池,不知是否全好的,干脆就做個測試電池容量的來測一下

原理圖:


/************************************************************
*簡易測電池容量
*電阻是已知的 電壓通過A0口測得 之后就可以通過歐姆定律算得電流
*電流乘以時間得到容量 (這個用一秒一次采樣 之后將這一秒當(dāng)成恒流放電
*算出每秒放電量再不斷疊加)
*
*電阻5歐 5瓦 可根據(jù)容量改( Rdown)



**************************************************************/

float Udown=0, Rdown=5,Vcc=5,capacity,Idown,time=0;

void setup()
{
Serial.begin(9600);  //定義串口波特率為9600
}

void loop() {
time=time+1;
Udown = analogRead(A0);  //讀取A0口值
Udown=Udown/1023*Vcc;  //換算為電壓值
Idown=Udown/Rdown;    //換算為電流值
capacity=capacity+Idown;  //換算為電池容量值
Serial.print("U:");
Serial.print(Udown,3);  //電壓值保留小數(shù)點3位
Serial.print("V");
Serial.print("  I:");
Serial.print(Idown,3);   //電流值保留小數(shù)點3位
Serial.print("A");
Serial.print("  capacity:");
Serial.print(capacity,3);   //電池容量值保留小數(shù)點3位
Serial.print("mAh");
Serial.print("  time:");
Serial.print(time);   //測試時間
Serial.println("s");


delay(1000);        // 一秒刷新一次 這個與容量測試掛鉤 最好別改
}






*串口工具需要一直開著,否則會清零
*電池中途可以卸下 再接上 不影響測量 另外這個只是粗略測量
*只能測5v以下
*另外改改程序(A0-A7)就能實現(xiàn)多個電池一起測


評分

參與人數(shù) 1黑幣 +80 收起 理由
admin + 80 共享資料的黑幣獎勵!

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏8 分享淘帖 頂 踩
回復(fù)

使用道具 舉報

沙發(fā)
ID:373684 發(fā)表于 2019-10-14 23:57 | 只看該作者
Arduino:1.6.9 (Windows 7), 開發(fā)板:"Arduino Due (Programming Port)"

Arduino:1: error: 'float time' redeclared as different kind of symbol

In file included from c:\users\administrator.user-20161022ou\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdlib.h:11:0,

                 from C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Arduino.h:24,

                 from sketch\Arduino.ino.cpp:1:

c:\users\administrator.user-20161022ou\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\time.h:47:11: error: previous declaration of 'time_t time(time_t*)'

time_t    _EXFUN(time,     (time_t *_timer));

           ^

D:\360嫻忚鍣ㄤ笅杞絃BV\絎簲绔犲簲鐢ㄨ繘闃禱5.4娓╂箍搴︽祴閲廫Arduino\Arduino.ino: In function 'void loop()':

D:\360嫻忚鍣ㄤ笅杞絃BV\絎簲绔犲簲鐢ㄨ繘闃禱5.4娓╂箍搴︽祴閲廫Arduino\Arduino.ino:9:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]

Arduino:9: error: assignment of function 'time_t time(time_t*)'

Arduino:9: error: cannot convert 'time_t (*)(time_t*) {aka long int (*)(long int*)}' to 'time_t(time_t*) {aka long int(long int*)}' in assignment

Arduino:24: error: call of overloaded 'print(time_t (&)(time_t*))' is ambiguous

D:\360嫻忚鍣ㄤ笅杞絃BV\絎簲绔犲簲鐢ㄨ繘闃禱5.4娓╂箍搴︽祴閲廫Arduino\Arduino.ino:24:18: note: candidates are:

In file included from C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Stream.h:26:0,

                 from C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/HardwareSerial.h:24,

                 from C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Arduino.h:195,

                 from sketch\Arduino.ino.cpp:1:

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:61:12: note: size_t Print::print(char) <near match>

     size_t print(char);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:61:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'char'

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:62:12: note: size_t Print::print(unsigned char, int) <near match>

     size_t print(unsigned char, int = DEC);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:62:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'unsigned char'

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:63:12: note: size_t Print::print(int, int) <near match>

     size_t print(int, int = DEC);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:63:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'int'

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:64:12: note: size_t Print::print(unsigned int, int) <near match>

     size_t print(unsigned int, int = DEC);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:64:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'unsigned int'

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:65:12: note: size_t Print::print(long int, int) <near match>

     size_t print(long, int = DEC);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:65:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'long int'

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:66:12: note: size_t Print::print(long unsigned int, int) <near match>

     size_t print(unsigned long, int = DEC);

            ^

C:\Users\Administrator.USER-20161022OU\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.8\cores\arduino/Print.h:66:12: note:   no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'long unsigned int'

exit status 1
'float time' redeclared as different kind of symbol

在文件 -> 首選項開啟
“編譯過程中顯示詳細(xì)輸出”選項
這份報告會包含更多信息。

回復(fù)

使用道具 舉報

板凳
ID:373684 發(fā)表于 2019-10-15 15:10 | 只看該作者
我用Arduino DUE板做的,,做不出來,,上面就是錯誤報警
回復(fù)

使用道具 舉報

地板
ID:264926 發(fā)表于 2019-10-15 18:30 | 只看該作者
加個顯示屏  顯示呢
回復(fù)

使用道具 舉報

5#
ID:373684 發(fā)表于 2019-10-18 19:32 | 只看該作者
zhengyouhua 發(fā)表于 2019-10-15 18:30
加個顯示屏  顯示呢

論壇有的,,我看到有顯示屏的做法
回復(fù)

使用道具 舉報

6#
ID:689745 發(fā)表于 2020-2-3 17:41 | 只看該作者
圖1  Arduino Pro Mini 測量 2 節(jié) 7 號電池電壓和容量


圖2  硬件連接 Arduino Pro Mini 和 電池



圖3  APP 實時顯示電池電壓和容量





謝謝您的介紹,按這個原理實現(xiàn)了 Arduino Pro Mini 測量 2 節(jié) 7 號電池(電壓=2.93V,電量=94%)。算法原理和實驗過程,請參考《花 1 小時,開源設(shè)計 LoRa 檢測電池容量》  https://blog.csdn.net/jiangjunjie_2005/article/details/104070668
回復(fù)

使用道具 舉報

7#
ID:85865 發(fā)表于 2020-2-4 13:20 | 只看該作者
cr8526 發(fā)表于 2019-10-15 15:10
我用Arduino DUE板做的,,做不出來,,上面就是錯誤報警

DUE 好像不行的哦,
回復(fù)

使用道具 舉報

8#
ID:373684 發(fā)表于 2021-1-6 23:39 | 只看該作者
252622979 發(fā)表于 2020-2-4 13:20
DUE 好像不行的哦,

要什么板??
回復(fù)

使用道具 舉報

9#
ID:373684 發(fā)表于 2022-2-27 22:04 | 只看該作者
252622979 發(fā)表于 2020-2-4 13:20
DUE 好像不行的哦,

原來是這樣 啊,,明白了
回復(fù)

使用道具 舉報

10#
ID:593198 發(fā)表于 2022-10-11 21:02 | 只看該作者
樓主的程序計算出的容量應(yīng)該是AS(安秒),這一句“capacity=capacity+Idown;  //換算為電池容量值”改為
   “capacity=capacity+Idown/3.6;  //換算為電池容量值” 單位才能用mAh.   
回復(fù)

使用道具 舉報

11#
ID:138707 發(fā)表于 2023-7-29 17:57 | 只看該作者
原來是這樣 啊,,明白了
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 国产精品中文字幕一区二区三区 | 欧美视频精品 | 天天艹天天干天天 | 精品国产一区二区三区免费 | 国产精品一区久久久 | 精品福利在线 | 国产精品久久久久久久久污网站 | 国产成人在线视频播放 | 午夜精品一区二区三区在线播放 | 亚洲在线免费观看 | 黄色一级电影免费观看 | 日本三级做a全过程在线观看 | 免费观看黄a一级视频 | 老牛影视av一区二区在线观看 | 亚洲网站在线观看 | 91综合网 | 给我免费的视频在线观看 | 人人性人人性碰国产 | 黑人久久| 国产成人精品一区二区三区四区 | 国产日韩欧美二区 | 精品国产91| 九九久久99 | 日韩高清中文字幕 | 人妖一区| 免费成人av网站 | 中文在线a在线 | 网黄在线 | 天堂素人约啪 | 久久久青草婷婷精品综合日韩 | 少妇午夜一级艳片欧美精品 | 欧洲一级视频 | 欧美日韩在线观看视频网站 | 欧美一级大片 | 视频一区二区在线观看 | 欧美综合一区二区三区 | 中文一区二区 | 成人精品国产免费网站 | 玖玖玖在线观看 | 天天综合网永久 | 精品国产乱码久久久久久蜜退臀 |