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
    #4

    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.

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

      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

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

        Here is a picture of the finished board

        0_1463174828044_board.jpg

        I have used the PCB designed by @sundberg84

        1 Reply Last reply
        1
        • Boots33B Boots33

          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

          googlyeyzG Offline
          googlyeyzG Offline
          googlyeyz
          wrote on last edited by googlyeyz
          #7

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

          Boots33B 1 Reply Last reply
          0
          • googlyeyzG googlyeyz

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

            Boots33B Offline
            Boots33B Offline
            Boots33
            Hero Member
            wrote on last edited by
            #8

            @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

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

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

              0_1466375985934_30 amp solar regulator.jpg

              Can anyone give me a help to fiz this problem.
              Thanks.

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

                The correct hookup for that type of regulator should look something like the picture below.

                0_1466382424289_regulator hookup.jpg

                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.

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

                  Thanks for the reply, i'm going to make the changes tonight.
                  I'm getting readings from 8A to 18A this is not correct.

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

                    How much current were you expecting to see

                    mrc-coreM 1 Reply Last reply
                    0
                    • Boots33B Boots33

                      How much current were you expecting to see

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

                      @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.
                      0_1466547160448_chart.png

                      On the voltage side i'm getting high value 8.8V and low value 7.8V.
                      0_1466547276667_chart (1).png

                      Is this good values, correct values for a 12V battery ??

                      1 Reply Last reply
                      0
                      • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          22

                                          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