Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. 12v Solar battery monitor

12v Solar battery monitor

Scheduled Pinned Locked Moved My Project
59 Posts 8 Posters 34.5k Views 15 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Boots33B Offline
    Boots33B Offline
    Boots33
    Hero Member
    wrote on last edited by Boots33
    #14

    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.

    mrc-coreM 1 Reply Last reply
    0
    • Boots33B Boots33

      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.

      mrc-coreM Offline
      mrc-coreM Offline
      mrc-core
      wrote on last edited by
      #15

      @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.

      1 Reply Last reply
      0
      • Boots33B Offline
        Boots33B Offline
        Boots33
        Hero Member
        wrote on last edited by
        #16

        I should think 5.02v will be close enough. What value resistors are you using for your voltage divider.

        1 Reply Last reply
        0
        • Boots33B Offline
          Boots33B Offline
          Boots33
          Hero Member
          wrote on last edited by Boots33
          #17

          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 is

          ArduinoIn = (BatVolts/voltsPerCount25)*voltsPerCount5
          

          first 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
          
          
          1 Reply Last reply
          0
          • Boots33B Offline
            Boots33B Offline
            Boots33
            Hero Member
            wrote on last edited by
            #18

            Here are what my graphs look like. You can see your voltage should be a bit higher if all is well

            0_1466593668390_graphs.jpg

            1 Reply Last reply
            0
            • mrc-coreM Offline
              mrc-coreM Offline
              mrc-core
              wrote on last edited by
              #19

              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

              1 Reply Last reply
              0
              • mrc-coreM Offline
                mrc-coreM Offline
                mrc-core
                wrote on last edited by
                #20

                @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??

                1 Reply Last reply
                0
                • Boots33B Offline
                  Boots33B Offline
                  Boots33
                  Hero Member
                  wrote on last edited by
                  #21

                  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

                  1 Reply Last reply
                  0
                  • mrc-coreM Offline
                    mrc-coreM Offline
                    mrc-core
                    wrote on last edited by
                    #22

                    I'm going to try this way and see what values i'll get.
                    Once again thanks.

                    1 Reply Last reply
                    0
                    • mrc-coreM Offline
                      mrc-coreM Offline
                      mrc-core
                      wrote on last edited by
                      #23

                      I really don't get this.
                      Has i can see i did everything correct but i'm still getting weard values.... In the charge regulator that i have the solar30 i'm connecting the ACS712 like you told.
                      The voltage dividir i had it connected also on the battery vcc for the 30K resistor and ground on the 10K resistor, over the code i ahd change the "voltSenseMax" to 20000.

                      With this changes the House battery went from 8.4V to 16.2V but when i make the reading off the battery with a multimeter i get 13V and also the charge regulator screen shows 13V...
                      The charge current is over 0A now but is night at my place ill wait until tomorrow to see if this values change over the morning and day.
                      The load current is 9.1A this one i dont get it...
                      0_1466710930859_chart.png
                      0_1466710939397_chart (1).png
                      0_1466710946717_chart (2).png

                      0_1466711310363_Sem Título.jpg

                      1 Reply Last reply
                      0
                      • Boots33B Offline
                        Boots33B Offline
                        Boots33
                        Hero Member
                        wrote on last edited by
                        #24

                        When you were measuring 13v at the battery what was the voltage at pin A0 on the arduino. You will need to compare the readings to see if the divider is working correctly. Have you removed the comments on the serial print lines , you can then check those results with your other measurements. Also check the resistance of the resistors in your voltage divider with your multimeter to make sure they are close to the values you expect.

                        From what I can see in the picture the asc712 looks to be hooked up OK. They are very sensitive to electromagnetic interference so you may want to try it further away from your regulator.

                        1 Reply Last reply
                        0
                        • mrc-coreM Offline
                          mrc-coreM Offline
                          mrc-core
                          wrote on last edited by
                          #25

                          Hi.
                          Ok i did not measure the pin A0 when i was measuring de 13V over the battery but i can do that.I have removed the comments but i hook up the arduino in the battery box and did not look over the serie monitor on PC, once again i'll do that today.
                          I think the voltage divider i ok, i did a check using a 3,7V battery and the values ia had get with the voltage divider were 0,20% differente from the ones i was getting over the multimeter, 3.2V to 3.4V

                          I'm going to mak some changes over the place were the asc712 is, i have a box on the wall 40cm to 80cm distance off the batteryes. That's were the ACS712 is going to be.

                          Thanks.

                          1 Reply Last reply
                          0
                          • mrc-coreM Offline
                            mrc-coreM Offline
                            mrc-core
                            wrote on last edited by
                            #26

                            Just took the readings from pin A0 and the values are 3.2V when the battery readins says 13V.
                            The house battery is fix at 16V or 16.2V but i could not move the acs712 to the box i wanted it's night now and i can't see well, sow this change will be done tomorrow. While i'm wainting let's see if this 16V changes during the day off tomorrow.

                            Well it's being dificult to get this project work like a charm but it's staring to get tune up thank's to your help Boots33.

                            1 Reply Last reply
                            0
                            • mrc-coreM Offline
                              mrc-coreM Offline
                              mrc-core
                              wrote on last edited by
                              #27

                              I've a mistake when said 4 arduino nano with some sensors, correcting this mistake:
                              1º arduino nano with UV sensor;
                              1º arduino nano with lux sensor, pressure sensor, temp/hum sensor and one anemometer; "this is my meteo box sensor"
                              1º arduino nano with the acs712, voltage sensor and the dallas temperature sensor
                              1º arduino nano controling a rain gauge.

                              It's 4 arduino nano with 7 sensors, i don't believe that all this put together are draining 8.6A from the battery. Isn't this a too high value ?

                              1 Reply Last reply
                              0
                              • Boots33B Offline
                                Boots33B Offline
                                Boots33
                                Hero Member
                                wrote on last edited by Boots33
                                #28

                                3.2v at A0 sounds about right for a 20v divider reading 13v at the battery. So your divider seems to be OK. you now need to check the results from those serial print statements and see how they compare.

                                The code for the voltage measurement is pretty simple with the map function doing most of the work. Not a lot to go wrong there I think. But we will know more when you get the above results.

                                8.6A is too high for the current. if you were drawing that much your 20ah battery would be flat in a couple of hours, so the reading is wrong. Can you check with your multimeter and see how much is being drawn. I would not think it would even be 1 amp with just 4 arduino's connected

                                1 Reply Last reply
                                0
                                • Boots33B Offline
                                  Boots33B Offline
                                  Boots33
                                  Hero Member
                                  wrote on last edited by
                                  #29

                                  With a 3.2v at A0 you should have a count of around 656 from the serial print

                                  1 Reply Last reply
                                  0
                                  • mrc-coreM Offline
                                    mrc-coreM Offline
                                    mrc-core
                                    wrote on last edited by
                                    #30

                                    Hi once again.
                                    Today i had to dismount all the solar system my arduino nano just died... don't now why and also the repeater node also dead...

                                    I had replaced the arduino for the solar system i had also put he battery inside my house to make all the tests.
                                    here is the serial monitor log:

                                    Requesting temperatures...
                                    sum count...511
                                    mapped volts...10.0
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...522
                                    mapped volts...10.2
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.2
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...506
                                    mapped volts...9.9
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:9.9
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...511
                                    mapped volts...10.0
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...511
                                    mapped volts...10.0
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...511
                                    mapped volts...10.0
                                    Milliamps...-95
                                    Requesting temperatures...
                                    sum count...511
                                    mapped volts...10.0
                                    Milliamps...-95
                                    Requesting temperatures...

                                    One thing i had notice now is that house voltage is 10V but solar regulator and multimeter says 13V, and i had moved the acs712 away from the battery.
                                    The test i made was one CPU fan connect to the solar regulator load, this fan is 12A - 0.25A.
                                    Running the fan the solar regulator shows a Load off 0.1A and the arduino shows values between 0A and 0.3A

                                    send: 6-6-3-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.1
                                    send: 6-6-3-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:3
                                    sensor started, id=6, parent=3, distance=2
                                    send: 6-6-3-0 s=255,c=3,t=11,pt=0,l=21,sg=0,st=ok:Battery Status Sensor
                                    send: 6-6-3-0 s=255,c=3,t=12,pt=0,l=1,sg=0,st=ok:1
                                    send: 6-6-3-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=fail:
                                    send: 6-6-3-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
                                    send: 6-6-3-0 s=3,c=0,t=38,pt=0,l=0,sg=0,st=fail:
                                    send: 6-6-3-0 s=4,c=0,t=39,pt=0,l=0,sg=0,st=fail:
                                    send: 6-6-3-0 s=5,c=0,t=39,pt=0,l=0,sg=0,st=fail:
                                    sum count...511
                                    mapped volts...10.0
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=fail:10.0
                                    find parent
                                    send: 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
                                    Milliamps...52
                                    send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.1
                                    send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=fail:0
                                    Requesting temperatures...
                                    send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:30.3
                                    send: 6-6-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:-127.0
                                    sum count...517
                                    mapped volts...10.1
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.1
                                    Milliamps...200
                                    send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.2
                                    send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                    Requesting temperatures...
                                    send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:29.9
                                    sum count...511
                                    mapped volts...10.0
                                    send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                    Milliamps...126
                                    send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.1
                                    send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                    Requesting temperatures...

                                    1 Reply Last reply
                                    0
                                    • Boots33B Offline
                                      Boots33B Offline
                                      Boots33
                                      Hero Member
                                      wrote on last edited by
                                      #31

                                      OK that is good you can now see the serial print lines. The voltage conversion seems to look ok .... a count of 511 shows a voltage of 10. So now I need you to get all the readings at once

                                      measure battery voltage
                                      measure pin A0 voltage
                                      and show the serial data as you have above

                                      then we can see where the trouble lies

                                      1 Reply Last reply
                                      0
                                      • mrc-coreM Offline
                                        mrc-coreM Offline
                                        mrc-core
                                        wrote on last edited by
                                        #32

                                        Battery Voltage - 13.09
                                        pin A0 - 1.055

                                        send: 6-6-3-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.1
                                        send: 6-6-3-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:3
                                        sensor started, id=6, parent=3, distance=2
                                        send: 6-6-3-0 s=255,c=3,t=11,pt=0,l=21,sg=0,st=ok:Battery Status Sensor
                                        send: 6-6-3-0 s=255,c=3,t=12,pt=0,l=1,sg=0,st=fail:1
                                        send: 6-6-3-0 s=0,c=0,t=6,pt=0,l=0,sg=0,st=fail:
                                        send: 6-6-3-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
                                        send: 6-6-3-0 s=3,c=0,t=38,pt=0,l=0,sg=0,st=fail:
                                        send: 6-6-3-0 s=4,c=0,t=39,pt=0,l=0,sg=0,st=ok:
                                        send: 6-6-3-0 s=5,c=0,t=39,pt=0,l=0,sg=0,st=fail:
                                        sum count...532
                                        mapped volts...10.4
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=fail:10.4
                                        Milliamps...347
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=fail:0.3
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=fail:0
                                        Requesting temperatures...
                                        send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:29.5
                                        send: 6-6-3-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:-127.0
                                        sum count...513
                                        mapped volts...10.0
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                        Milliamps...347
                                        Requesting temperatures...
                                        send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:29.4
                                        sum count...519
                                        mapped volts...10.1
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.1
                                        Milliamps...421
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.4
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                        Requesting temperatures...
                                        send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:29.5
                                        sum count...511
                                        mapped volts...10.0
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                        Milliamps...347
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.3
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                        Requesting temperatures...
                                        send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=fail:29.4
                                        sum count...511
                                        mapped volts...10.0
                                        Milliamps...347
                                        Requesting temperatures...
                                        send: 6-6-3-0 s=0,c=1,t=0,pt=7,l=5,sg=0,st=ok:29.5
                                        sum count...511
                                        mapped volts...10.0
                                        Milliamps...200
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.2
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                        Requesting temperatures...
                                        sum count...485
                                        mapped volts...9.5
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:9.5
                                        Milliamps...273
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.3
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=ok:0
                                        Requesting temperatures...
                                        sum count...510
                                        mapped volts...10.0
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                        Milliamps...347
                                        send: 6-6-3-0 s=4,c=1,t=39,pt=7,l=5,sg=0,st=ok:0.3
                                        send: 6-6-3-0 s=5,c=1,t=39,pt=2,l=2,sg=0,st=fail:0
                                        Requesting temperatures...
                                        sum count...501
                                        mapped volts...9.8
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:9.8
                                        Milliamps...347
                                        Requesting temperatures...
                                        sum count...511
                                        mapped volts...10.0
                                        send: 6-6-3-0 s=3,c=1,t=38,pt=7,l=5,sg=0,st=ok:10.0
                                        Milliamps...347
                                        Requesting temperatures...

                                        Once again i had connect the 12v fan to the load of the charge regulator

                                        1 Reply Last reply
                                        0
                                        • Boots33B Offline
                                          Boots33B Offline
                                          Boots33
                                          Hero Member
                                          wrote on last edited by
                                          #33

                                          If you are still using the 20v divider, with a battery voltage of 13.09 you should have a voltage of 3.27 at pin A0

                                          1.055v is way too low, check you connections to make sure they are tight. measure the voltage at the divider input to make sure the 13v is there as well.

                                          post results again

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          21

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular