Hello everyone, I'm new to the forum, soo please forgive me for any noob like questions that have been answered 1000 times lol. Im currently designing an arduino Mega based system, that will read the level of a 36v battery system, and based on the voltage level, one of three 12v LEDs will light up. Red for below 12v, blue for between 12v-24v, and lastly green for 24v and above. I understand the coding part, its connecting the circuit that is giving me issues.
I have two buck converters to drop 36v to 7v( that will be applied to the arduino via a DC jack adapter as the arduino's main power source) and 12v( that will be applied to the positive end of the 12v LEDs, and will go through n-channel MOSFETS). I'm also using a voltage divider circuit to scale the 36v from the battery system down to 3.6 volts that will be read from the arduino via the A0 pin.
My main issue is with the grounding of my whole system. I dont know if i should have common ground between the 36v battery system negative terminal and the arduino board ground. I already damaged one board because the input in the A0 pin was matching the 36v and not the regulated 7 voltages from the first buck converter. I now see that my understanding of ground isnt that great, any help and clarification would be greatly appreciated.
Post a (hand drawn) circuit diagram of how you think it should be connected.
With resistor values.
Then we can advise of something should be changed.
Leo..
ikehigh05:
Hello everyone, I'm new to the forum, soo please forgive me for any noob like questions that have been answered 1000 times lol. Im currently designing an arduino Mega based system, that will read the level of a 36v battery system, and based on the voltage level, one of three 12v LEDs will light up. Red for below 12v, blue for between 12v-24v, and lastly green for 24v and above. I understand the coding part, its connecting the circuit that is giving me issues.
I have two buck converters to drop 36v to 7v( that will be applied to the arduino via a DC jack adapter as the arduino's main power source) and 12v( that will be applied to the positive end of the 12v LEDs, and will go through n-channel MOSFETS). I'm also using a voltage divider circuit to scale the 36v from the battery system down to 3.6 volts that will be read from the arduino via the A0 pin.
My main issue is with the grounding of my whole system. I dont know if i should have common ground between the 36v battery system negative terminal and the arduino board ground. I already damaged one board because the input in the A0 pin was matching the 36v and not the regulated 7 voltages from the first buck converter. I now see that my understanding of ground isnt that great, any help and clarification would be greatly appreciated.
You two separate Buck Inverters? #1) 36 Volts to 12 Volts for the Lights? #2) 36 Volts to 7 Volts for the Power-In Jack on the Arduino?
Do you have the negative (-) output of the 12 volt buck-inverter connected to Arduino Ground?
The negative (-) output of the 7 volt buck-inverter is connected to Arduino Ground via the Jack.
Hi,
Thanks for the schematic.
Why do you want these levles on a 36V battery supply?
Red for below 12v, blue for between 12v-24v, and lastly green for 24v and above.
A 36V system if it is lead-acid should not be allowed to get below 33V.
I think you had better consult the specs of your battery array before going any further.
By the time you're system reaches 24V, you will have severly damaged some cells.
You are correct regarding the 2 buck converters and yes i do have the 12v negative terminal connected to ground. I was just curious as to should the 36v negative terminal be connected to anything else besides the negative terminals of the two buck converters and the end of the voltage divider circuit?
TomGeorge,
Well Im really just over the coding and electronics of my project, not the power system portion. Me and my partner are basically building a solar assisted electric vehicle. We have a 36v solar panel connected to a solar charger connected to the 36v battery system. I will inform him about your comments regarding the lead acid battery, because he is indeed using deep cycle lead acid batteries. I can reconfigure the code to activate the leds for any range of voltages, i just wanted to make sure that my connections are correct, because i dont want to fry another arduino board again lol.
Swap the values of the voltage divider.
90k goes to +36volt and 10k to ground.
Better to use the Mega's stable 2.56volt Aref for voltage measurements.
And a 10k:180k divider.
Better, but more complex, is to monitor the individual batteries.
A 12volt lead/acid battery drained below 11volt will quickly die. Even a deep cycle one.
Lead/acid battery voltage is not a very good indiator of remaining charge.
Read up about coulomb counters.
I hope you use current limiting resistors for your LEDs.
Not sure why you use a 12volt rail and mosfets.
Common 20mA LEDs can be driven directly by an output of the Mega.
Only the bigger ones or a LED strip needs mosfets.
Leo..
We are using 12v rated LEDs in this project, i didnt want to use the Mega output to drive those LEDs because i thought the Mega can only output 5v per I/O pin. Also, yes we are using current limiting resistors at the LEDs. I did read a little but on the AREF, but i did not understand the whole idea regarding that pin. Thank you guys for your responses so far.
/*
Mega only!!
displays the voltage of a 36V battery
uses the internal 2.56volt reference
10k resistor from A1 to ground, and 180k resistor from A1 to +batt
100n capacitor from A1 to ground for stable readings
*/
float Aref = 2.562; // change this to the actual Aref voltage of ---YOUR--- Mega | calibration!
unsigned int total; // running total
float voltage; // converted to volt
void setup() {
analogReference(INTERNAL2V56); // use the Mega's internal ~2.56volt reference
Serial.begin(9600); // set serial monitor to this value
}
void loop() {
total = 0; // reset value
analogRead(A1); // one unused reading
for (int x = 0; x < 19; x++) { // 19 analogue readings and 1/19 voltage divider
total = total + analogRead(A1); // add each value to the total
}
voltage = total * Aref / 1023; // convert readings to volt
// print to serial monitor
Serial.print("The battery is ");
Serial.print(voltage);
Serial.println(" volt");
delay(1000); // use a non-blocking delay when combined with other code
}
Thanks alot. You made that code very understandable, i will surely implement that when i get in the lab tomorrow morning. Just for clarification, im connecting the 10k resistor from A1 to the 36v ground correct?
Maybe wise to connect the 10k resistor directly between the analogue input and a ground pin of the Mega.
And connect the 180k directly to the positive battery terminal.
Now it doesn't matter if the wire between those two accidently touches/shorts to ground.
Battery negative should already be connected to Mega ground via the DC/DC converters, (assuming they are the normal non-isolated version).
Leo..