12v Solar battery monitor
-
Looking over the schematic you have connected the 5V from the LM2596 directly to the 5V PIN over the arduino.
Is this correct ?
Don't we have to connect it to the VIN PIN?? -
Yes @mrc-core as far as I am aware it is fine to supply 5v directly to this pin. If you have a look at the Nano spec page @mfalkvidd has listed above you will see that under the power heading it says
"The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply (pin 30), or 5V regulated external power supply (pin 27)."
Pin 27 is the 5v pin so all should be ok. Of course you must take care that you only supply 5v or you may damage the arduino.
While the input voltage for the nano VIN is shown as from 6-20V they recommend keeping within 7-12V , when the solar panel is charging the voltage could at times exceed 14V and from what I have read elsewhere I would expect the nano regulator could get quite warm.
The Lm2596 module has an input voltage of up to 40V and can deliver 2A so will work very well for this application. They are also very cheap so well worth using i think.
-
I have made a change to the Sketch. I was saving my data to the same EEPROM positions that MySensors use for their data. So i have now moved well away from that area.
Edit: No I wasn't so no changes were needed
-
-
I have made a change to the Sketch. I was saving my data to the same EEPROM positions that MySensors use for their data. So i have now moved well away from that area.
Edit: No I wasn't so no changes were needed
@Boots33 said:
I have made a change to the Sketch. I was saving my data to the same EEPROM positions that MySensors use for their data. So i have now moved well away from that area.
Are you're sure, that 514 and 515 are vaild values? API documentation states, that pos parameter in saveState/loadState must be between 0 and 255. AFAIK data stored by saveState are written into a separate section of EEPROM, which doesn't interfere with MySensors own configuration data.
-
@Boots33 said:
I have made a change to the Sketch. I was saving my data to the same EEPROM positions that MySensors use for their data. So i have now moved well away from that area.
Are you're sure, that 514 and 515 are vaild values? API documentation states, that pos parameter in saveState/loadState must be between 0 and 255. AFAIK data stored by saveState are written into a separate section of EEPROM, which doesn't interfere with MySensors own configuration data.
@googlyeyz thanks for that info. I should have looked closer at the API. I originally used positions. 0 and 1 and thought that would conflict but I will now change back
-
Hi.
I'm having some troubles trying to use the project.
I have the solar pannel that goes directly to the solar regulator. In the solar regulator i have the battery connection and the load connection.
In the battery connection i have my 12V battery connected and i have connected the arduinos over the load connection.My problem is that i dont see were to connect the ACS712 module on the solar regulator.
At this moment i had connect the ACS712 over the load connection in the solar regulator but the values i'm getting are not correct...
Can anyone give me a help to fiz this problem.
Thanks. -
The correct hookup for that type of regulator should look something like the picture below.

Remember in this position the acs712 is reading current to and from the battery only. So if you had a load of 5A and your panel was supplying 3A then your readout would show a discharge of 2A
If your reading is showing a discharge when it should be showing a charge then just reverse the connections at the acs712.
-
How much current were you expecting to see
-
@Boots33 To be honest i just thought the values i was getting were too hight since the battery is 12V 20AH and i only have 4 arduino nano with some sensors using the power from the battery.
Today with one day having the changes made like you have said to do, i have value from the battery between hight 8.2A and 6.6A low, but the media value is almost always on 7.4A.

On the voltage side i'm getting high value 8.8V and low value 7.8V.

Is this good values, correct values for a 12V battery ??
-
I don't think those readings are correct. For a 12v battery it should be around 12.7v when full and not being charged. When it is being charged it should be up near 14v. Around 10.9v is considered fully discharged so your readings are way too low for a 12v battery. Your current readings seem too high as well for just a few arduino boards. Can you take some readings with a multimeter to cross check the data. Also check your 5v supply voltage, it is very important for this to be spot on 5v when taking analogue readings.
-
I don't think those readings are correct. For a 12v battery it should be around 12.7v when full and not being charged. When it is being charged it should be up near 14v. Around 10.9v is considered fully discharged so your readings are way too low for a 12v battery. Your current readings seem too high as well for just a few arduino boards. Can you take some readings with a multimeter to cross check the data. Also check your 5v supply voltage, it is very important for this to be spot on 5v when taking analogue readings.
@Boots33 Have check the voltage from the battery and is on 12V at this time is discharging the current i couldn't get but tomorrow i'll make new readings and see the values.
The 5V supply voltage is set to 5.02V will have to reduce the 0.02V to get just 5V.Thanks for your help.
-
I should think 5.02v will be close enough. What value resistors are you using for your voltage divider.
-
We appear to be operating in different time zones so have posted a couple of things to try.
The first thing to do is re-check all your wiring, I know you probably have done that already but best to make sure anyway.
Then you should try and isolate the cause of your problems.
lets start with the voltage readings.
This line of code in the sketch
int voltSenseMax = 25000;is where you set the maximum input voltage of your voltage divider. If you are not using the 25v voltage sensor module you will need to change the 25000 to suit your voltage divider, by changing that value up or down you can also make adjustments in the voltage reading to fine tune the output. Your reading seems to be out by a few volts so i think you should take a look at the voltage divider first and see if you can locate the reason.
I will show the way to check the 25v module and you can use the same method to work out the values if you have used a different divider.
Because we are using a voltage divider to alter the 12v battery voltage into a 5 volt representation that the Arduino can use we will need to work out what voltage we are expecting to see at pin A0
the formula we need isArduinoIn = (BatVolts/voltsPerCount25)*voltsPerCount5first we need the voltsPerCount25 for the 25v divider, so that will be 25/1024 which = .02441
then we need the voltsPerCount5 for the Arduino 5v input 5/1024 which = .00488
BatVolts is the actual battery voltage, you will need to measure this with your multimeter.
So as an example
If you measured your battery and it has 11.3v
(11.3/.02441)*.00488 = 2.26v
So if the voltage divider is working ok we would expect to see a voltage of around 2.3v at the arduino input. Which would = a count of (2.3/.00488) around 471
You can also remove the comments from the two Serial.print lines in this part of the sketch to see what the Arduino is producing
// ------------------ Start voltage readings -------------------- sample_count = 0; sum = 0; while (sample_count < NUM_SAMPLES) { // take a number of voltage samples sum += analogRead(voltagePin); sample_count++; delay(10); } //Serial.print("sum count..."); Serial.println((sum / NUM_SAMPLES)); // print the count result. will be between 0 and 1023 int voltageI = map(sum/NUM_SAMPLES,0,1023,0,voltSenseMax); // map the reading and get our result in millivolts //Serial.print("mapped volts..."); Serial.println(voltageI / 1000.0, 1); // convert millivolts back to volts and print. the 1 at the end determines how many decimal places to show -
Here are what my graphs look like. You can see your voltage should be a bit higher if all is well

-
Hi. i have read the post's you have made, one problem i have found its on the voltage sensing module don't now why it's not workin, simply dead, i have already bought 3 other modules and now i'm waiting for them to arrieved hope to get them until friday.
Have seen your graphs and they are really differents from mine.
Once again today with the multimeter i've made some readings from the battery and i got values in 13,2V - 12,9V and this values were measured at 19:00
Once again Thanks for helping me
-
@Boots33 said:
30k for R1 and 7.5k for R2
I was going to try to build the voltage sensing but i don't have any 7.5K resistor.... i can put 3 10k Resistors in serie to get the 30k Resistor but i cant make the 7.5K.
Can i use one 10K resistor in the place of the 7.5K, will this work ?? or will the values i'll get be rong??
-
Yes that would work. That would give you a maximum input of 20v so you will need to change relevant line in the sketch from 25000 to 20000
You can try different values on this web site. http://www.raltron.com/cust/tools/voltage_divider.asp
