Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] PIC Volt Meter and Battery Charging Techniques

Status
Not open for further replies.
It usually happens when Your multimeter 9V battery is ended. Try replacing it with a new one and then check again. Before that measure the voltage using same meter with old 9v battery for comparison.

---------- Post added at 03:00 ---------- Previous post was at 02:59 ----------

Where do you live danny?
Live in Sahiwal
I think the problem is here that i am using 10bit adc but trying to limit the values remain in 8 bit so i can use Low bits files
so check the software again
 

I have done also a voltmeter based on PIC16f690 and I got the same result when I read using voltmeter.

this voltmeter can measure up to 15vdc

**broken link removed**

---------- Post added at 06:05 ---------- Previous post was at 06:04 ----------

that is tachometer but there is a voltmeter function
 

I think the problem is here that i am using 10bit adc but trying to limit the values remain in 8 bit so i can use Low bits files
so check the software again

If you dont have outnumbering pin issues then go with 10bit. you can measure up to 102.4V---> 0.1V per bit. If you want to work with its 8 pins then 5/1024 = 4.8828 mV per bit, multiplying it by 256 gives 1.25V. So now you have to build you voltage division network so that it gives 1.25V at 30V. Your problem would be solved.

But if you are using external ADC then using 8bit ADC would reduce your effort and expense.

What 10Bit ADC you are using?
 

If you dont have outnumbering pin issues then go with 10bit. you can measure up to 102.4V---> 0.1V per bit. If you want to work with its 8 pins then 5/1024 = 4.8828 mV per bit, multiplying it by 256 gives 1.25V. So now you have to build you voltage division network so that it gives 1.25V at 30V. Your problem would be solved.

But if you are using external ADC then using 8bit ADC would reduce your effort and expense.

What 10Bit ADC you are using?

Buitlt in using pic16F676

Romel:

i also made a rpm counter for a diesel testing machine but i used a sensor the small industry owner give me calls proximity sensor price in Pakistan $2 . But he dont know that i didn't know electronics at all actually i made a digital speed o meter for my bike with youtype optocoupler counting rpm and speed and trip distance and odo metre. I wan testing it in football ground. He was also there . he saw that readings were matched with the real bike metre so he asked one design for him as he used china made rpm counter. So i made one for him with lcd and also give him the .hex file only in so much low money. He is happy that he made me fool and got unlimited rpm counter in just half price of one but i am happy that my rpm meter are exporting to UAE. and it is working proper as i have visit his factory :twisted:

Here is the first code i use for my speedo metre may be it is not the final as i have not ever made a proper record of my hobbies




processor PIC16F676
#include <p16f676.inc>
__config _HS_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF

d1 equ 21h
d2 equ 22h
d3 equ 23h
r1 equ 24h

; Binary To Decinal Locations
o1 equ 25h
o10 equ 26h
o100 equ 27h
t1 equ 28h
w2 equ 29h
L_byte equ 2A
H_byte equ 2B
aac0 equ 2C
aac1 equ 2D
aac2 equ 2E
aac3 equ 2F
aac4 equ 30

;MUL Locations

mulcnd equ 31h ; 8 bit multiplicand
mulplr equ 32h ; 8 bit multiplier
stmr equ 33h
;H_byte equ High byte of the 16 bit result
;L_byte equ Low byte of the 16 bit result
Same equ 34h



org 0x00
goto main
org 0x04
goto int

main:

banksel ANSEL
movlw B'00000000'
movwf ANSEL

banksel CMCON
movlw d'7'
movwf CMCON

banksel PORTA
clrf PORTA
banksel TRISA
movlw b'00000100'
movwf TRISA

banksel PORTC
clrf PORTC
banksel TRISC
clrf TRISC

InitializeLCD:

banksel PORTC
bcf PORTC , 2
call t10ms
movlw d'56'
movwf r1
call serout
call t10ms
movlw d'56'
movwf r1
call serout
call t10ms
movlw d'56'
movwf r1
call serout
call t10ms
movlw b'00111000'
movwf r1
call serout
call t10ms
movlw B'00001000'
movwf r1
call serout
call t10ms
movlw b'00000001'
movwf r1
call serout
call t10ms
movlw b'00000010'
movwf r1
call serout
call t10ms
movlw b'00001100'
movwf r1
call serout
call t10ms

Start_LCD_DATA:

bsf PORTC , 2

movlw 'S'
movwf r1
call serout

movlw 'p'
movwf r1
call serout

movlw 'e'
movwf r1
call serout

movlw 'e'
movwf r1
call serout

movlw 'd'
movwf r1
call serout

movlw ' '
movwf r1
call serout

bcf PORTC , 2

movlw d'139'
movwf r1
call serout

bsf PORTC , 2

movlw ' '
movwf r1
call serout

movlw 'k'
movwf r1
call serout

movlw 'm'
movwf r1
call serout

movlw '/'
movwf r1
call serout

movlw 'h'
movwf r1
call serout

bcf PORTC , 2
movlw d'192'
movwf r1
call serout

bsf PORTC , 2

movlw ' '
movwf r1
call serout


movlw 'r'
movwf r1
call serout

movlw 'p'
movwf r1
call serout

movlw 'm'
movwf r1
call serout

movlw ' '
movwf r1
call serout

bcf PORTC , 2

movlw d'203'
movwf r1
call serout

bsf PORTC , 2

movlw ' '
movwf r1
call serout

movlw ' '
movwf r1
call serout

movlw 't'
movwf r1
call serout

movlw 'd'
movwf r1
call serout

bcf PORTC , 2

movlw 04h
movwf r1
call serout


Timers:

banksel OPTION_REG

bsf OPTION_REG , 5
bcf OPTION_REG , 4
bsf OPTION_REG , 3

banksel INTCON

bsf INTCON , 7
bsf INTCON , 6

banksel PIR1

bcf PIR1 , 0

banksel PIE1

bsf PIE1 , 0

banksel T1CON

bcf T1CON , 6
bsf T1CON , 4
bsf T1CON , 5
bcf T1CON , 3
bcf T1CON , 1

movlw B'11011100'
movwf TMR1L
movlw B'00001011'
movwf TMR1H
bsf T1CON , 0

goto fin

table:
addwf PCL , f
retlw d'48'
retlw d'49'
retlw d'50'
retlw d'51'
retlw d'52'
retlw d'53'
retlw d'54'
retlw d'55'
retlw d'56'
retlw d'57'
fin:
goto fin

int:
movf TMR0 , 0
movwf stmr
bcf T1CON , 0
movlw B'11011100'
movwf TMR1L
movlw B'00001011'
movwf TMR1H
clrf TMR0
bsf T1CON , 0
bcf PIR1 , 0

bcf PORTC , 2

movlw d'202'
movwf r1
call serout
bsf PORTC , 2

movf stmr , 0
movwf L_byte
movlw d'60'
call multiply

movf aac0 , 0
call table
movwf r1
call serout

movf aac1 , 0
call table
movwf r1
call serout

movf aac2 , 0
call table
movwf r1
call serout

movf aac3 , 0
call table
movwf r1
call serout

movf aac4 , 0
call table
movwf r1
call serout

bcf PORTC , 2

movf stmr , 0
movwf L_byte
movlw d'6'
call multiply

movlw d'138'
movwf r1
call serout

bsf PORTC , 2

movf aac0 , 0
call table
movwf r1
call serout

movlw '.'
movwf r1
call serout

movf aac1 , 0
call table
movwf r1
call serout

movf aac2 , 0
call table
movwf r1
call serout

movf aac3 , 0
call table
movwf r1
call serout

retfie

t10ms:

movlw 0xCE
movwf d1
movlw 0x08
movwf d2
t10ms_0
decfsz d1, f
goto $+2
decfsz d2, f
goto t10ms_0
goto $+1
nop
return

serout:

movlw 0x08
movwf d3

testbit:
bcf PORTC , 4
btfsc r1 , 7
bsf PORTC , 4
bsf PORTC , 3
bcf PORTC , 3
rlf r1 , f
decfsz d3 , f
goto testbit
bsf PORTC , 5
bcf PORTC , 5
return

decimal:
swapf L_byte,w
addwf L_byte,w
andlw 0x0f
skpndc
addlw 0x16
skpndc
addlw 0x06
addlw 0x06
skpdc
addlw -0x06
btfsc L_byte,4
addlw 0x15+0x06
skpdc
addlw -0x06
movwf aac0
swapf H_byte,w
addwf H_byte,w
andlw 0x0f
skpndc
addlw 0x16
skpndc
addlw 0x06
addlw 0x06
skpdc
addlw -0x06
btfsc H_byte,0
addlw 0x05+0x06
skpdc
addlw -0x06
btfsc H_byte,4
addlw 0x15+0x06
skpdc
addlw -0x06
addlw 0x06
addwf aac0,w
skpdc
addlw -0x06
movwf aac0
movwf aac1
swapf aac1,f
movlw 0x0f
andwf aac0,f
andwf aac1,f
rrf H_byte,w
andlw 0x0f
addlw 0x06
skpdc
addlw -0x06
addlw 0x06
addwf aac1,w
skpdc
addlw -0x06
btfsc L_byte,5
addlw 0x03+0x06
skpdc
addlw -0x06
btfsc L_byte,6
addlw 0x06+0x06
skpdc
addlw -0x06
btfsc L_byte,7
addlw 0x12+0x06
skpdc
addlw -0x06
btfsc H_byte,0
addlw 0x25+0x06
skpdc
addlw -0x06
btfsc H_byte,5
addlw 0x09+0x06
skpdc
addlw -0x06
btfsc H_byte,6
addlw 0x08+0x06
skpdc
addlw -0x06
btfsc H_byte,7
addlw 0x06+0x06
skpdc
addlw -0x06
movwf aac1
swapf aac1,w
andlw 0x0f
btfsc H_byte,1
addlw 0x05+0x06
skpdc
addlw -0x06
btfsc H_byte,5
addlw 0x01+0x06
skpdc
addlw -0x06
btfsc H_byte,6
addlw 0x03+0x06
skpdc
addlw -0x06
btfsc H_byte,7
addlw 0x07+0x06
skpdc
addlw -0x06
movwf aac2
swapf aac2,w
movwf aac3
movlw 0x0f
andwf aac1,f
andwf aac2,f
andwf aac3,f
rrf H_byte,w
movwf aac4
rrf aac4,w
andlw 0x0f
addlw 0x06
skpdc
addlw -0x06
addlw 0x06
addwf aac3,w
skpdc
addlw -0x06
btfsc H_byte,6
addlw 0x16+0x06
skpdc
addlw -0x06
btfsc H_byte,7
addlw 0x32+0x06
skpdc
addlw -0x06
movwf aac3
movwf aac4
swapf aac4,f
movlw 0x0f
andwf aac3,f
andwf aac4,f
return

multiply:

mult MACRO
btfsc STATUS,C
addwf H_byte,F
rrf H_byte,F
rrf L_byte,F
ENDM

clrf H_byte ;* 1 cycle
rrf L_byte,F ;* 1 cycle

mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
mult ;* 4 cycles
call decimal
end

---------- Post added at 07:54 ---------- Previous post was at 07:49 ----------

i have stolem binary to decimal and multiplying routines from PICLIST web ;-)
But i dont know how he is using this negative signs in mathematics -0x06 etc
Is it possible to use minus or nagative digits as -255 or -250
and can i use 2.50 or -2.65
as i have used the point with in my speed calculation manually
addlw -0x06
movwf aac0
swapf H_byte,w
addwf H_byte,w
andlw 0x0f
skpndc
addlw 0x16
skpndc
addlw 0x06
addlw 0x06
skpdc
addlw -0x06
btfsc H_byte,0
addlw 0x05+0x06

---------- Post added at 07:54 ---------- Previous post was at 07:54 ----------

and what is mult?
i cant find this mult instruction in PIC data sheet????????:sad:
 

Afterlinks: Here is something about 12v Dc to 220V AC inverter please correct it for me

1 = Theoretically the transformer windings are 12+12 secondary and 220 primary

(Practically)

2 = For only standard inverter the windings are 9+9 secondary and 260 primary

3 = For only standard inverter with charging (UPS) the primary windings are 0+220+260 and secondary are 9.5+9.5

4= IN Pakistan we use 10.5 + 10.5 secondary and 0+220+280 primary

Please correct specially Pakistan UPS transformer windings we use with asifbrothers or IMRAN UPS kits K un ki secondary kitni hoti hay 10.5 + 10.5 or different and un main primary kitni hoti hay as i think it is 0 + 220 for charging + 280 for output
Plz Plz Plz correct it as u made UPS in lahore k transformer k yeh loop kitni Vac hotay hain
 

Afterlinks: Here is something about 12v Dc to 220V AC inverter please correct it for me

1 = Theoretically the transformer windings are 12+12 secondary and 220 primary

(Practically)

2 = For only standard inverter the windings are 9+9 secondary and 260 primary

3 = For only standard inverter with charging (UPS) the primary windings are 0+220+260 and secondary are 9.5+9.5

4= IN Pakistan we use 10.5 + 10.5 secondary and 0+220+280 primary

Please correct specially Pakistan UPS transformer windings we use with asifbrothers or IMRAN UPS kits K un ki secondary kitni hoti hay 10.5 + 10.5 or different and un main primary kitni hoti hay as i think it is 0 + 220 for charging + 280 for output
Plz Plz Plz correct it as u made UPS in lahore k transformer k yeh loop kitni Vac hotay hain

For economical reasons same transformer is used for inverter and charging.
If you consider about differnt requirments for a transformer in ups aplication, you can modify design acording to your needs.
1. It has to fully charge a 12V battery at high current (12 to 18 ampers).
2. Give an output of 220V rms with a battery depleted down to 10.5V.
It is obvious 9+9 cant charge to 14.5V at high current and 12+12 cant output 315V(peak sine wave). So design has to be optimised.
Transistor and FETs switching is different. At 12V it is more obvious.
Now there are situations
Many times mains voltage is 10-20 volts less during summer due to heavy loads and you have one to two hours for charging. You have to cope with it. you will see many people complaing that ups is not charging. Then they go for generator.
When there is less load, output voltage is so high that ( battery fully charged delivering more than 13V) their energy savers lamps and mobile chargersare burnt.
Burning of ups due to overload is seperate issue.
As energy shortage is continual process, after 5 years of experience comercial kits have improved a lot.
Transformers available in market have tapings on primary side ranging from 180V to 280V for Charging and inverter output adjustments. If kit is built with pwm voltage regulator , high voltage tapping is used. When there is need set tap for fast charging.
 
Last edited:

OK!
I have seen that transformers.
i just want to ask 2 things.
We in Pakistan attached the load at 280v winding or there is another loop more than 280
And you have not mentioned above the secondary winding? it is 10.5 + 10.5 ?????????
 

I prefer 12+12 because charging is important issue.
 

I prefer 12+12 because charging is important issue.
My friend,if we use 12+12v secodery for charging,i think current become higher and harm the battery plates.
And after a some time battery voltage level will increase and control board will cut off the charging relay.
Thus specific gravity of electrolyte will very low,and we can not get optimal time from battery.
 

My friend,if we use 12+12v secodery for charging,i think current become higher and harm the battery plates.
And after a some time battery voltage level will increase and control board will cut off the charging relay.
Thus specific gravity of electrolyte will very low,and we can not get optimal time from battery.

So what is bette
in my ups secondary is 11.50 + 11.50
i have maintained the charging at 12.70 volts
after cut the battery charging there is 12.70 volts into the battery
battery is 140 ampere 21 plates
the battery is fully charged at 13.20 volts

---------- Post added at 14:03 ---------- Previous post was at 14:00 ----------

My friend,if we use 12+12v secodery for charging,i think current become higher and harm the battery plates.
And after a some time battery voltage level will increase and control board will cut off the charging relay.
Thus specific gravity of electrolyte will very low,and we can not get optimal time from battery.

What values do u use?
for primary and secondary
and where do u attache the load
at 280v loop ???
 

If we keep secondery 12+12 volt,than we are compell to wind 280 volts primery for inverter.
I think 10.5+10.5.and primary till 260v enough.
Purpose of battery charging is only to dillute acid,s crystals from plates into water.
Which should be 1.250(specific gravity).that means battery is full.
Here we think if battery voltage level is 14.4vdc than battery is ok and full.
But practicaly its not true.
If battery voltages are 14.4v and that time charging current is near 800ma or 1 amp.
Now we can measure gravity 1.250 now battery is fully charged.
A battery need 10 hour to fully charged,and we are forced to keep max charge rate 1/10 of battery,s total capacity.
 

I am strictly against this cut off method of battery charging. I have been making battery charger for more than a year. These Lead acid battery are charged to 75% if cutoff method is used, which deteriorate its life. These batteries are charged fully if charging current is remain less than 100mA. since accurate charger is much faster and expensive that is why local Ups apply full rectified voltage to charge batteries, ITs not even DC. To prove it just put a clamp meter on one wire while charging and you will find both AC and DC part of current.
 

So i need to increase the battery charging?
 

You need to charge batteries at regulated voltage since unregulated voltage cause damage. and you have to monitor current instead of voltage to detect that battery is charged or not.

MY local Ups exploded one of two batteries on my face and i was unable to hear anything for 30 sec.
 

PNJBTR
Sajjad khan

I also explode a battery excide ns140 so i purchased new battery and new kit which made me curious what is microcontroller. so i low the charging current and i think to make the charging current full dc by adding caps after the bridge is useless as the battery is the biggest capacitor in this world




Which microcontroller do u prefer to use?
Why 8051 have the 80 market of mictocontrollers
is 8051 better than pic as it has morw than 255 instructions
wots about the avr?
and the final do u know about any pakistani website about the microcontrollers or about the electronics books and market and from where to buy it etc and the directroy of good mcu webs and forums
If not should we make one with .pk domain www.name.pk
i know it is the most difficult task to make a website and maintain it
but i want yorur view about this as i know it is nonsense idea but i am seriously thinking about this
i have started electronics a 1 or 2 months before when i purchased a ups kit and pic was there and the same pic was in the remote control tape recorder so i think what is this the some ic
so i cant say i started the electronics but i have just done some chawals i mean some small things with pic microcontroller with out knowing it proper what is it and how it workd what is resistance and diode as my educational background is low the quality and based on arts.
but i am serious about making a site
 

You need to charge batteries at regulated voltage since unregulated voltage cause damage. and you have to monitor current instead of voltage to detect that battery is charged or not.

MY local Ups exploded one of two batteries on my face and i was unable to hear anything for 30 sec.
Of course it happens when one operate mispolarity or overcharged battery.
Last year a trickle charger kit with BTA16(TRIAC),MOC3021 is introduced in local market.
Which have function of CC-CV.
You can adjust constant charging current,and constant volt.
Even at low mains voltages,as alertlinks describe in his post above.
An other method i see in chinese inverters,they adjust 13.8v dc at battery bus bar.
Battery cut off system i see only here in our country
 

Ya as i have personally search on net the best thing is floating or trickle charging
i know to to constant volt or how to get 5 to 10 ampere from 7805 but dont know about constant current source
which microcontroller u prefer
i learn PIC from BIGDOGGURU
and pic chips in pakistan and their prices and good selection of pic mcu from ALERTLINKS
 

Oh no here trickle charging kit behaves like a fan dimmer.And main component triac (BTA16)used in series of transformer and phase.
you need 150volts loop from main transformer for charging current.
 

Attachments

  • trickle charger.jpg
    1,005.8 KB · Views: 359
Last edited:

Danny I want to know 2 things. 1. Since you just have started electronics may be you are freshman in some university. 2. How come you become a full member so fast?

Ok if you want to make things by yourself you need to learn in following ways. I hope you know calculus.

1. Fundamental of Electric Circuit --- by Alexander
2. Electronic devices and circuit theory by boylsterd, electronic devices by floyd.
3. The 8051 Microcontroller by I.scott Mackenzie.

There are lots of video tutorial on youtube but you have to access them step by step which you can do by taking topics from books and search.

8051 is the basic chip and everyone learns it first before jumping to PIC.I have only learned about 8051 because i dont want to jump. PIC and AVR are for high speed purpose. 8051 one instruction takes 1-3 microsec to execute. now if your battery is charged do you think you need to be informed in micro seconds?

One more thing. People here wont help you to give you source code and make circuits for you. A person own hard work is appreciated here. yes everyone here is available to guide and troubleshoot your problems.

Regarding web site i think its vain if it is not giving you money, it will be a total waste of time.
 

Electronic devices and circuit theory by boylsterd
The 8051 Microcontroller maknieze
I have these books physically bought 3 days ago. But i am much familiar with PIC as i have made many succesful devices with it
I hate math and calculus as it failed me 6 times and i am only B.A. now. Last math in matric 8 years ago

---------- Post added at 15:33 ---------- Previous post was at 15:33 ----------

and ya full memeber level got by asking so much questions daily
:twisted:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top