Newbe needing Audrino Help

Have Arduino UNO and 2 voltage sensors. Will be monitering 2 12v battery banks. Bank A powering device and Bank B on charge to 13.5. When Bank A depleats to 10.2 v , stop charge B, Switch Bank B to powering device, start charge Battery Bank A. Moniter Bank A. When bank A reaches 13.5 V switch charge to dummy load and hold until battery Bank B depleated 10.2v. Repeat process continously.

Can all this be done with 1 Ardunio 2 voltage sensors, a low voltage realay and a High current double pole contactor ????? Is this feasable?? I would really appreciate some help.

dennisbeq

Should be easily done. Do you have data sheets for all of the devices? You will need a driver (transistor and diode plus a couple resistors) for the relay. Is the small relay driving the contactor?

I'd suggest 2 relays - pretty sure there will be times when you don't want to be charging either battery.

hmm I made something like that befure check my blog :slight_smile: If you need any help just let me know

If you are using 12v lead acid batteries I suggest not to deplete them as far as 10.2v. I think I would stop at about 11.5v

What capacity (amp-hrs) are the batteries and how fast (amps) are you discharging them ?

...R

Robin2:
If you are using 12v lead acid batteries I suggest not to deplete them as far as 10.2v. I think I would stop at about 11.5v

What capacity (amp-hrs) are the batteries and how fast (amps) are you discharging them ?

...R

Using 6v Trojan deep cycle batteries connected in parallel for an output per bank of 12v. Rated at 75 amps for 185 minutes or 25 amps for 766 minutes . The load is a 5kw inverter and current draw varies.

groundfungus:
Should be easily done. Do you have data sheets for all of the devices? You will need a driver (transistor and diode plus a couple resistors) for the relay. Is the small relay driving the contactor?

Data sheets for Batterys only so far. For controlling load current I was thinking of using 2 High Current SCRs instead of a concactor. I should be able to control these with a 5v on signal from the arduino? (please note the question mark) Still looking for the SCRs and their data sheet. Have the voltage sensors but no data sheet , or code to run. Will be checking back with the source.

narzan:
hmm I made something like that befure check my blog :slight_smile: If you need any help just let me know

Thanks. Needing lots of help and suggestions. If you would, please contact me @ denaraenterprises@gmail.com for direct contact.

dennisbeq062:
Using 6v Trojan deep cycle batteries

They are not cheap. Treat them well - not at 10.2 volts!

The reason I asked about the current draw is that it affects the voltage. At a higher current draw the voltage will appear lower, but it will recover after a few hours of inactivity. This phenomenon is generally referred to as Peukert's law.

Consequently if the current draw is higher the voltage will appear lower.

If my maths is correct, 5kW would be over 400 amps at 12v - unless you have a lot of batteries connected together I would certainly not go there. 75 amps would be 900 watts.

I have 200AHr deep cycle batteries (US2200, not Trojan) and I run my engine when I want to power my 800w microwave.

...R

Here you go with only one relay :slight_smile:

Of course don't forget to use some protections maybe someone here can tell you how! because I don't know :sweat_smile:

This circuit will work exactly like what you want
The code work on serial display with temperature sensor

int thermistorPin = A1;
int Relay = 2;
float vPow = 4.7;
float r1 = 50000.0;
float r2 = 4400.0;
void setup() {
Serial.begin(9600);
Serial.print("\x1B");
Serial.print("[2J");
Serial.print("\x1B");
Serial.println("[H");
Serial.println("--------------------");
Serial.println("DC VOLTMETER");
Serial.print("Maximum Voltage: ");
Serial.print((int)(vPow / (r2 / (r1 + r2))));
Serial.println("V");
Serial.println("--------------------");
Serial.println("");
delay(2000);
}
void loop() {
float v = (analogRead(0) * vPow) / 1024.0;
float v2 = v / (r2 / (r1 + r2));
int thermistorReading = analogRead(thermistorPin);
Serial.print("\x1B");
Serial.print("");
if (thermistorReading <= 35) { digitalWrite (2,HIGH);
}
else if (thermistorReading >= 40) { digitalWrite (2,LOW);
}
if (v2 <= 2.1) { digitalWrite (2,HIGH);
}
else if (v2 >= 2.0) { digitalWrite (2,LOW);
}
Serial.println(thermistorReading);
Serial.println(v2);
delay(8000);
}

and this code with LCD display 16*2 + temperature sensor

//Enjoy :) 
#include 
int thermistorPin = A0; //analog pin 0
int Relay = 2;
float vPow = 4.7;
 float r1 = 50000.0;
 float r2 = 4400.0;
 LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
 void setup() {
   Serial.begin(9600);
   lcd.begin(16,2);
   Serial.print("\x1B");
   Serial.print("[2J");
   Serial.print("\x1B");
   Serial.println("[H");
   Serial.println("--------------------");
   Serial.println("DC VOLTMETER");
   Serial.print("Maximum Voltage: ");
   Serial.print((int)(vPow / (r2 / (r1 + r2))));
   Serial.println("V");
   Serial.println("--------------------");
   Serial.println("");   
}
 void loop() {
   float v = (analogRead(1) * vPow) / 1024.0;
   float v2 = v / (r2 / (r1 + r2));
   int thermistorReading = analogRead(thermistorPin); 
   Serial.print("\x1B");
   Serial.print("");
Serial.println(thermistorReading);
Serial.println(v2);
lcd.setCursor(0, 0);
lcd.print(v2);
lcd.print(" V");
lcd.setCursor(0, 1);
lcd.print(thermistorReading);
lcd.print(" Temp");
if (v2 <= 5.39 ) { digitalWrite (4,HIGH);
}
if (v2 >= 5.40 ) { digitalWrite (4,LOW);
}
delay(8000);
}

you need to change some values to be exactly for your needs if you want any help Just let me know

Inside the code there is ONE voltage sensor, Just copy the first one and of course don't forget to change the pin for the second one
This part for resistors you can use any resistors you want But don't forget to change these values

float r1 = 50000.0;
float r2 = 4400.0

NOTE
If the first battery A under your values the relay will disconnect battery A and connect the second battery B while the first one charging, BUT when the second battery B under your values the relay will not disconnect battery B simply because this code only for one battery, you only need to copy/edit the code for the second one

I am interesting to see your project when you finish it good luck :wink:

narzan:
Here you go with only one relay :slight_smile:

@Narzan, I have not studied your diagram or your code to see if they are correct, so I am assuming they are.

However I will repeat what I have said to many others - it is much too easy to misinterpret Fritzing diagrams. Please draw a proper schematic - just a photo of a pencil drawing will be much less ambiguous.

In your Fritzing diagram you seem to have two series of staggered resistors. First, are they meant to be connected in series - because that is not obvious in your diagram. Second, why not use a single resistor.

...R

Hi,
What is/are your charging sources?
Tom.... :slight_smile:

hmm ok :slight_smile:
That's more clear

In your Fritzing diagram you seem to have two series of staggered resistors. First, are they meant to be connected in series - because that is not obvious in your diagram. Second, why not use a single resistor.

ya only 2 resistors for each battery will work too ::slight_smile:

There is two problems here!
Case one
Battery A under/equal 10.2v Arduino will disconnect battery A and connect battery B, battery A will be on charger to reach 13.5 V
If the charger not fast enough to charge battery A "not reach 13.5 V " while in the same time battery B under/equal 10.2v Arduino will connect battery A
Case two
If the charger was too fast buttery A not under/equal 10.2v and battery B is fully charged "13.5 V" in this case you need other relay to disconnect the charger like what CrossRoads said

@Narzan, I have not studied your diagram or your code to see if they are correct, so I am assuming they are.

Yup the code work perfectly on one battery look here
and please feel free to correct me if i am wrong in anything

@Narzan, that is certainly much clearer. I had not realized you had voltage dividers in the First diagram

However ... you don't show the charger Positive.
And you don't show the load circuit - that also has to be switched.
These may affect the ability to measure voltages

Why not switch the charger Positive rather than GND ?

It is probably not a good idea to drive an electormechanical relay directly from an Arduino I/O pin. A suitable solid state relay would be a different matter - but may be inappropriate or too expensive for this application.

...R

However ... you don't show the charger Positive. Where does that go?

He is an engineer he will know :sweat_smile: of course to the battery directly

Why not switch the charger Positive rather than GND ?

That's a good question It's weird to control GND ok flip the wires, but it will work too!

It is probably not a good idea to drive an electormechanical relay directly from an Arduino I/O pin. A suitable solid state relay would be a different matter - but may be inappropriate or too expensive for this application.

Yup of course I said that he need some protection too from sparks to protect his relay, I only give him an idea how the circuit will be, only worked on small batteries I don't know how to control big things anyway I mean this relay and of course with different values not 10A

Of course don't forget to use some protections maybe someone here can tell you how! because I don't know :sweat_smile:

And you don't show the load circuit - that also has to be switched.
These may affect the ability to measure voltages

2 voltage sensors and both measuring the Voltage always.
you mean measure the loud that's the device made?! but why?! there is other voltage sensor on the charger!? ::slight_smile:

worked perfectly on small applications but for big things of course you need to edit things

narzan:
you mean measure the loud that's the device made?! but why?! there is other voltage sensor on the charger!?

No, I was not thinking of measuring the load. I was wondering if the existence of the load would make it difficult to get separate measurements for the two batteries. Obviously that depends on how the load is connected to the batteries.

I have two batteries that I alternate approx every 3 days so that each gets a period of rest and charge without any discharge. I have not bothered to automate the switch over because I would not get sufficient value for the extra complexity and cost. Of course if the OP's batteries are at a remote site manual switch-over is out of the question.

I do have an automatic (relay) system for paralleling the two batteries when the engine is running to charge them and also to break the parallel system if I want to use a large (2kw) inverter. And the switching is also arranged so the inverter won't work unless the engine is running - though that can be over-ridden.

...R

No, I was not thinking of measuring the load. I was wondering if the existence of the load would make it difficult to get separate measurements for the two batteries. Obviously that depends on how the load is connected to the batteries.

wait :o you just give me an idea there is two voltmeter sensor here right!
Lets say battery A on loud and B on charger, If B is fully charged and A still not reach the lower value 10.2v Arduino will switch it too so Arduino will look on both battery in the same time, now you don't even need 2 relay and everything will work perfectly

that depends on how the load is connected to the batteries

I forget that, I hope he's not using the circuit for Solar cell what you said extremely true
In this case
If he measure the voltage only when the battery on charger That's will solve everything from what I know it's ok if you charge this kind of battery any time you want even if the battery is not reach the lower limits, but you will destroy it from over charging :slight_smile: Mission Accomplished

narzan:
If B is fully charged and A still not reach the lower value 10.2v Arduino will switch it too so Arduino will look on both battery in the same time, now you don't even need 2 relay and everything will work perfectly

I don't understand that and I am concerned that it may not be correct. There is an AWFUL LOT of smoke in a Trojan battery. A short circuit will melt steel or start a fire or cause a sulphuric acid explosion. Post a schematic diagram showing what you have in mind.

My real concern is that I do not know whether The OP is sufficiently competent to avoid something unsafe if advice is ambiguous and, in one interpretation, could be unsafe.

...R