43oh  # BDCoDE

Members

22

## Everything posted by BDCoDE

1. That was really great explanation, I'm new to electronics, not only Energia. And posts like yours helps a lot. I'm a little bit busy this days, but I will try to use your advices in practice as soon as possible. Thank you!
2. I run the test again with new code and got 1.55Ah. Here is the new output. Voltage= 0.00V Current= 0.00A Capacity= 0.00Ah Discharging time= 1.00s // battery isn't connected yet Voltage= 0.00V Current= 0.00A Capacity= 0.00Ah Discharging time= 2.00s // battery isn't connected yet Voltage= 3.60V Current= 0.28A Capacity= 0.00Ah Discharging time= 3.00s Voltage= 3.64V Current= 0.28A Capacity= 0.00Ah Discharging time= 4.00s Voltage= 3.64V Current= 0.28A Capacity= 0.00Ah Discharging time= 5.00s ...................................................................... .............................
3. The output of fully charged Li-ion battery can be up to 4.1/ 4.2 V. Therefor if I use 1k as R2 and 1.5k as R3 I'll get 4.15V * 1.5k /( 1.5k+1k) = 2.49V Almost the same as yours. Can't get the voltage to fit under 2.5V using this rule.
4. Like this? The schematic with voltage divider will then look like this. Are everything ??????? correctly now? // Very simple Arduino Lithium-ion battery capacity tester // from electronicsblog.net #define LED GREEN_LED #define resistor 13 float capacity=0, value,voltage,current, time=0; void measure (void) { analogReference(INTERNAL2V5); delay(1) value= analogRead(A5); voltage=value/1023*5; current = voltage/resistor; capacity=capacity+current/3600; time++; Serial.print("Voltage= "); Serial.print(voltage); Serial.print("V Current= "); Serial.print(cur
5. Thanks for advice, I will try it tomorrow. The test is finished. Here is the last lines of output file. As you can see the voltage is about 3.5V at the lowest, I don't know why but the voltage was constant 5.00V til 16653.00s :!!!: The test showed that battery is 1.87Ah. I think it's true, because the battery sticker says it's 2000mAh, but it's produced in China :grin:. Will run some more tests tomorrow, with voltage divider ;-) Voltage= 3.60V Current= 0.28A Capacity= 1.87Ah Discharging time= 17590.00s Voltage= 3.59V Current= 0.28A Capacity= 1.87Ah Discharging time= 17591.00s
6. How do you think this voltage divider will work?
7. No voltage divider, here is the actual schematic. Besides, I was getting 1.4V when I was using "voltage=value/1024*3.7;" , instead of "voltage=value/1024*5.0" as in your example. Now with "voltage=value/1024*5.0" I get constant 5.00V and 0.38A, but I'm not sure if it's correct. P.S Here is the new output. I used "voltage=value/1024*5.0" Voltage= 5.00V Current= 0.38A Capacity= 0.34Ah Discharging time= 3220.00s Voltage= 5.00V Current= 0.38A Capacity= 0.34Ah Discharging time= 3221.00s Voltage= 5.00V Current= 0.38A Capacity= 0.34Ah Discharging time= 3222.00s Voltage= 5.00V Curr
8. Your code is working well so far. The only thing I edited was resistance , from 6.9 to 13 Here is the output example:Voltage= 1.42V Current= 0.11A Capacity= 0.01Ah Discharging time= 430.00s Voltage= 1.35V Current= 0.10A Capacity= 0.01Ah Discharging time= 431.00s Voltage= 1.42V Current= 0.11A Capacity= 0.01Ah Discharging time= 432.00s Voltage= 1.37V Current= 0.11A Capacity= 0.01Ah Discharging time= 433.00s Voltage= 1.43V Current= 0.11A Capacity= 0.01Ah Discharging time= 434.00s Voltage= 1.37V Current= 0.11A Capacity= 0.01Ah Discharging time= 435.00s Voltage= 1.41V Current= 0.11A Ca
9. Edited: I was lucky and received my usb2uart converter now. It's based on CP2102 chip, if it makes any difference. I installed drivers and Windows shows it on COM11 post. I checked the code below, it's working just fine. But not the "Battery Test" code. I have no idea what to do... static uint8_t sensorPin = A5; int sensorValue = 0; void setup() { Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); delay(100); } Checked as well on my another code. This one works fine too. #define cmdL 'L' //UART command #define cmdR
10. Let me just ask you a stupid question because I'm REALLY new to all this stuff. How should I receive Serial.print()? Via usual USB cable I use to program the chip using terminal program or via USB2UART converter usin RxD & TxD pins? P.S I'm using M430G2553 chip
11. I don't know why, but there is still nothing :shock: P.S Updated source...
12. I tried with now, still no effect. P.S Updated source code in my previous message.
13. Ok, didn't noticed that part of you message. The code looks like this now: // Very simple Arduino Lithium-ion battery capacity tester // from electronicsblog.net static uint8_t sensorPin = A5; #define LED GREEN_LED #define resistor 13 float capacity=0, value,voltage,current, time=0; void measure (void) { value= analogRead(sensorPin); voltage=value/1024*5.0; current = voltage/resistor; capacity=capacity+current/3600; time++; Serial.print("Voltage= "); Serial.print(voltage); Serial.print("V Current= "); Serial.print(current); Serial.print("A Capacity= "); Serial.pr
14. Sorry, my fault. I was actually trying with both of them. The problem was in Serial.print(). I used Serial.println() instead. Here is the working source. static uint8_t sensorPin = A5; int sensorValue = 0; void setup() { Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); delay(1000); } But I still can't get this battery test working. Here is the code you gave me, is there anything wrong with it? // Very simple Arduino Lithium-ion battery capacity tester // from electronicsblog.net static uint8_t sensorPin = A5; #define
15. I do use Serial.begin(9600) P.S I read this thread and decided to check if it's working on mine board. I connected P1.5 pin to GND and used this code. Still can't receive anything in Serial Monitor. I tried both M430G2553 & M430G2452. What's the problem :x static uint8_t sensorPin = A5; int sensorValue = 0; void setup() { Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); Serial.print(sensorValue); delay(10); }
16. Well, now the LED is ON, before it wasn't. But I still can't get anything in terminal. Is the schematic right when I use "value= analogRead(7);" ?
17. Like this? #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER1_OVF_vect(void) { x=!x; digitalWrite(GREEN_LED, x); measure(); } void setup() { pinMode(GREEN_LED, OUTPUT); // I don't know the ATmega timers, but I will be assuming your timer clock is running at 1MHz and interrupts every 0x10000-0x0BDC = 62500 microseconds (every 62.5 milliseconds) _BIS_SR(GIE); // enabled global interrupt; TACTL = TAIE; // enabled timer overflow interrupt; TACTL |= MC_1; // normal operation page 366 (mode up); TACCR0 = 62500 - 1; // set overflow value to
18. Successfully compiled now. Thanks P.S Get some problems under testing. Here is the schematic I used. R1 = 5 x 68ohm 1/4W conecteted in parallel. And here is the full source code: // Very simple Arduino Lithium-ion battery capacity tester // from electronicsblog.net #define resistor 13 float capacity=0, value,voltage,current, time=0; void measure (void) { value= analogRead(7); voltage=value/1024*5.0; current = voltage/resistor; capacity=capacity+current/3600; time++; Serial.print("Voltage= "); Serial.print(voltage); Serial.print(
19. Hi, roadrunner84. When I use your code i get this error. batt_tester.cpp: In function 'void setup()': batt_tester.cpp:50:5: error: 'TACTL0' was not declared in this scope Is it something like inline assembler?
20. Ok, I'll try it now. Thank you very much
21. So I can use void loop() { measure(); delay(1000); } instead of this? ISR(TIMER1_OVF_vect) { TCNT1=0x0BDC; x=!x; measure(); } But what about the rest. Do you know where I can find the constants Energia uses? P.S Thanks for serial converter advise
22. Hi, I'm trying to build a simple Li ion battery capacity tester using this article. The code compiles fine until line 40, where it comes to interrupt handler. What should I use instead? Here is the code where I get errors: ISR(TIMER1_OVF_vect) { TCNT1=0x0BDC; x=!x; measure(); } void setup() { pinMode(LED, OUTPUT); TIMSK1=0x01; // enabled global and timer overflow interrupt; TCCR1A = 0x00; // normal operation page 148 (mode0); TCNT1=0x0BDC; // set initial value to remove time error (16bit counter register) TCCR1B = 0x04; // start timer/ set clock Serial.begin
×
• Blog

• #### Activity

×
• Create New...