Need a Help for a Battery Charger for two 12V 6Ah Battery with a specific task

Status
Not open for further replies.

Alessa Bernales

Newbie level 6
Joined
Mar 22, 2014
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
89
hi! good day!
I am planning to do a 2 - 12 Volts battery charger with some specific task:
1. the Micro controller be able to know the actual percent rate of the 2 battery
2. if the battery 1 reaches less than 50% the device will recharge the battery
3. if the battery 1 reaches 80%, the device will disconnect the charging process in battery 1 and charge the battery 2 if its less than 80%.
4. if the battery 2 reaches 80%, the device will disconnect the charging of the two battery and do nothing until one of the two battery will reach less than 50% again.

PIC - PIC16F877A
disconnecting means - Relay
2 - 12 Volts Battery

i hope someone could help me in my project, my professor use Proteus for simulating he device then for the program he required us to use Mikro C. please i need help to those who know this one
 

not sure what help you need.
I see 5 areas to be solved;
code for PIC
battery charger circuit
control for battery selection
battery level detection
power supplies

You didn't say what type of battery which is necessary for a practical circuit
 

i am using a 12VAC 6Ah Battery and the actual percentage of the battery will be output in LCD 16X2
 
Last edited:

What is the condition if BAT2 goes below 50% and BAT1 is > 50%?

If BAT2 goes below 50% first then does the chargig of BAT2 start and then stop at 80%?

If BAT2 goes below 50% and and then charges to 80% and stop charging, does BAT1 start charging if it is < 50%?

Please provide a flowchart. It will be easy to write the code.

What happens if BAT1 goes below 50% and starts charging and then before it charges to 80% the MCU resets due to some reason? Will it again start charging only if it goes below 50% again or does it save the chargingFlag in EEPROM and then read it back on startup and continue charging BAT1 util it becomes charged 80% or more?

I am attaching mikroC code but it might need changes which can be done only after you answer the questions asked.
 
Last edited:

if battery 1 below 50% and battery 2 is 80% battery 1 will be charging mode and battery 2 do nothing

if battery 1 and 2 below 50% the device will charge first the battery 1 until it reaches 80% that's the time battery 2 will be now charge

if battery 1 is 80% and battery 2 is less than 50%, battery 2 will be now charge state while the battery 1 do nothing

if both is 80% the device will do nothing until one of the battery reaches below 50%

each percentage will be shown in LCD16x2
 

if battery 1 is 80% and battery 2 is less than 50%, battery 2 will be now charge state while the battery 1 do nothing

Few more things I need to know.

What if battery 1 is less than 80% but greater than 50% and battery 2 is less than 50%? Will battery 2 charge till it is >= 80% and then battery 1 starts charging until it is >= 80%?

What if battery 2 goes < 50% first and then battery goes < 50% next? It waits till battery 1 is < 50% and then charges battery1 to >= 80% and then start charging battery2 till it is >= 80%?


Oops I forgot to attach the file yesterday. I am attaching now. It is according to what you mentioned in post #1. It needs some changes.

(mikroC code + Proteus file)
 

Attachments

  • Battery Charger.rar
    112.3 KB · Views: 129


sir there's something missing? the battery 2 is not working even it reaches below 50%
 

Ofcourse code is not written for battery 2 to charge if it goes below 50%. Answer my questions which you have quoted in post #11.

Only these are implemented as asked in post #1.

1. the Micro controller be able to know the actual percent rate of the 2 battery
2. if the battery 1 reaches less than 50% the device will recharge the battery
3. if the battery 1 reaches 80%, the device will disconnect the charging process in battery 1 and charge the battery 2 if its less than 80%.
4. if the battery 2 reaches 80%, the device will disconnect the charging of the two battery and do nothing until one of the two battery will reach less than 50% again.

I had mentioned that it needs some change but can be done only after you answer the questions asked.
 
Last edited:

if battery 1 is <80% and >50% no charging happens at battery 1

if battery 2 is <80% and >50% no charging happens at battery 2

if battery 1 is <80% and >50% no charging happens at battery 1 and battery 2 is less than 50% battery 2 will be now charge until it reaches 80%, if battery 1 become less than 50% while charging battery 2. battery 1 waits until battery 2 gets 80%, after battery 2 gets 80% battery 1 will be now charge until it gets 80%

if battery 2 is <80% and >50% no charging happens at battery 2 and battery 1 is less than 50% battery 1 will be now charge until it reaches 80%, if battery 2 become less than 50% while charging battery 1. battery 2 waits until battery 1 gets 80%, after battery 1 gets 80% battery 2 will be now charge until it gets 80%


i also notice in the proteus that it never charge the battery when its in charging mode?
 

i also notice in the Proteus that it never charge the battery when its in charging mode?

I have not drawn battery charging circuit. I have provided two connectors one for bat1 and another for bat2 to interface charger output to batteries. I don't know what charger circuit you will use.

Also in Proteus Battery model is a voltage source. It constantly gives set voltage. You cannot simulate battery charging in Proteus. However you can connect a 12V power supply part to battery charging connectors and set battery voltage ( connected to relay ) to 0V, so that when relay turns ON voltage across battery will be 12.0V. In real charger circuit the charging voltage might go up to 14V.


File attached.
 

Attachments

  • Battery Charger.rar
    73.8 KB · Views: 121
Last edited:
Nobody answered my question
How are you figuring to measure state of the charge of the batteries?
A 12V/100Ah battery stores approx. 1kWh of energy. How will you determine the remaining capacity of the battery 'cause the capacity is not the linear function of the current*time being drained drained.
It is soooooo easy to write the software.
If this is a "homework" a couple of IF..THEN..ELSE (Basic) or SWITCH (C) statements will do the job.

And, simulators are still far from real hardware. Maybe I'm an "old fart", but I don't trust the simulators and therefore I don't use them. Real hardware rulez
 

Attachments

  • Battery Charger.rar
    264.3 KB · Views: 114
sir rajik gud day! this project, i will defense it to my professor so i came up some possible questions that might be ask to me

1. whats the function of 4N28 in the circuit?
2. whats the use of the CONN-H2 the innner and outside part?
3. in the program, bat1PreviousVoltage = bat1CurrentVoltage;and bat2PreviousVoltage = bat2CurrentVoltage;? what does it mean?
 

1.

4Nxx is an opto-isolator for isolating Relay circuit from microcontroller circuit. You should use 2 power supplies, one to power PIC and one to power relay and opto o/p circuit.

PWR supply 1 will have a 7805 and it powers PIC.
PWR supply 2 will have a 7812 (to power relay if relay is 12V type) or 7805 to power relay (5V type) and opto's collector circuit.

GNDs of both PWR supplies should be different.

2. J2 and J4 are Bat1 and Bat2 outputs respectively. J1 and J3 are inputs to battery for charging.

3. batxCurrentVoltage holds current batx voltage and batxPreviousVoltage holds previous value of batx voltage. The code inside if() condition executes only if there is a change in bat1 or bat2 voltages. At the end of if() condition batxPreviousVoltage is set to the value of batxCurrentVoltage.
 
@milan.rajik:
You are wasting space and time using FLOAT variables. Float math takes a lot of time and RAM.
Try the Integer math instead.
Use the voltage divider that gives you 5V for 20.46V input, read ADC twice, adding the readings. You will have 0 to 2046 in a 16-bit variable, ....
 

@ZASto

Yes, but precise voltage is needed. I know 0.01 volts variation doesn't make much difference but anyway I will modify the code and post a new version tomorrow.

Use the voltage divider that gives you 5V for 20.46V input

Why 20.46V when battery voltage doesn't exceed 15V?

Modified project attached.
 

Attachments

  • Battery Charger rev1.rar
    265.5 KB · Views: 124
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…