15 comments on “Raspberry Pi Solar Charger Current Sensor

  1. Cool project 🙂
    Really nicely written too.

    Just miss the full circuit you used that would be handy for anyone that wants to build it to like me.
    I would be really grateful if you could post it or email it to me.

  2. Very nice blog, I will be attempting to replicate it soon. As I am not only an electronics noob, linux noob and a python noob is it ok if I post here for help?

  3. Opps first mistake i bouht the ACS712 chip without the board. I realise i can still use it but how am i going to connect my beefy battery cables, carrying up to 20A to it…? Bigger solar panels coming soon!
    i will need somekind of termination block to connect. I bought the 20Amp version by the way. The little jumper leads on my bread board would surley melt with 20A going through them.
    I realise i should move it form a bread board after testing.

    I also have a question about the 3.3v VREF.

    I understand (i think) what a voltage divider is and why you have it. BUT isnt the VREF just for refeference and not for providing power?

    If it is for reference then you could use the PI’s 5v instead of 3v without effecting the PI and no longer need the voltage divider.

    I apologise if i have missed the obvious.

    Any valuable time you spend putting me right is greatly appreciated.

    • Yes, 20A is quite a bit of current and more than I’d want to run through a bread board. I used the voltage divider because the current sensor board and the Raspberry Pi board were at different voltage levels. If I pushed a 5 volt signal into the Raspberry Pi board, I could destroy the Pi. Thus, I needed to scale it down to something in the range of 0 – 3.3 VDC.

      The Raspberry Pi’s power (5V and 3.3V) and ground pins are not GPIOs. The GPIOs on the Pi need to protected against voltages higher than 3.3 VDC.

  4. Ok all working except
    i have connected the acs712 amp terminals to my battery feed from the solar charger.
    i cut the positive wire and put it in inbetween.
    But the power does not flow through the acs712…
    From looking at the diagram and googling the wiring i believe i have done it correctly.

    any ideas

    Also i get 4.5 V out of my PI not 5v so my voltage divered is a bit off
    I get 2.25 out of acs712 and 1.5 after divider. im sure i can accomodate this in the programming

    • I’m not sure what could be causing your problem. If you are getting a reading somewhere between 0 and 3 VDC from your current sensor, then it appears that it is sensing the current. Can you try putting in a known value (one you can measure first with a multimeter) and testing the output? In the software, I had to try a number of things to get a reading that appeared to match my multimeter, so it is possible you will have to address it with the programming.

  5. Hi, thanks for the information, I was wondering how you got the current sensed equation:

    current_sensed = (1000.0 * (0.0252 * (current_reading – 492.0))) – correction_factor

    And why did you set the correction factor to 94.

    Thank you

    • It has been a long time since I came up with that equation. I believe I used a multimeter and measured different values. Then I made the equation to fit the values I had measured. You might want to also check the data sheet for the current sensor to see if they give any recommended equations.

  6. Hi

    I have the ACS712 from ebay: https://www.ebay.com.au/itm/ACS712ELC-20A-20A-Current-Sensor-Module-Ammeter-Arduino-Pi-Hall/132283768812

    Have wired up the rest of the project on the breadboard – I’m not 100% sure on where the 100k and 51k resistors go plus the black/grey and red wires (to the potentiometer) in the arduino project. I’m figuring black > GND..as for the others?

    I’ve looked up voltage dividers at: https://learn.sparkfun.com/tutorials/voltage-dividers/all – still lost…what connects to the VCC and OUT pins on the ACS712.

    Many thanks in anticipation!

    • It was quite a while ago that I set this up, but if I recall correctly, I used the voltage divider to get the output from the current sensor down to a value that wouldn’t burn out the input pin from the Raspberry Pi. The current sensor outputs 5 volts DC, and the Pi accepts only a 3.3 volt DC input. Your reference to voltage dividers at Sparkfun is correct, and the first circuit image on the left side of that page should work. I’d use the current sensor output as the Vin (which if it is 5 volts is then being lowered by the resistors down to 3.3 volts at Vout). R1 would be the 51k resistor, and R2 the 100k resistor. You can check this with their calculator on their page (5 volts in, R1=51000, R2=100000, and Vout calculates to 3.31 volts). Good luck, I hope everything turns out well with your project!

Leave a Reply

Your email address will not be published. Required fields are marked *