0
\$\begingroup\$

I have a solar system 12V connected to a PWM controller 20A and a lead-acid battery 80Ah deep cycle.

What kind of setup should I make to activate a pump (12V) if the battery is full ( >13.8V ) ?

\$\endgroup\$
  • 1
    \$\begingroup\$ You need some voltage level detect, of which there are many. Which then triggers the pump to turn on, which is possible in many ways. What is the pump? How is it controlled? What battery monitoring are you using? What controller are you using? \$\endgroup\$ – Puffafish Jul 2 '19 at 10:52
  • \$\begingroup\$ Ok thanks, let's say I buy a small PCB voltage detector and link it to my Raspberry PI. How should I plug it (voltage detector) into the system ? PWM controller load ? Directly on the 12V battery ? \$\endgroup\$ – bob dylan Jul 2 '19 at 11:03
  • \$\begingroup\$ The voltage detector needs to be connected across the important voltage, in this case the battery. \$\endgroup\$ – Puffafish Jul 2 '19 at 11:13
  • 3
    \$\begingroup\$ Note that turning on the pump will cause voltage to drop, so you need a small amount of "hysterisis" on the system so you don't immediately turn it off again. Such as a minimum run time. \$\endgroup\$ – pjc50 Jul 2 '19 at 12:31
  • \$\begingroup\$ @pjc50 Okay good to know, i will not forget to add that to the programming. \$\endgroup\$ – bob dylan Jul 2 '19 at 15:56
0
\$\begingroup\$

So here is what I did :

1 - I connected an Arduino to collect analog outputs from a voltage sensor PCB. (connected on 5v pin, ground and Analog 0 or A0)

2 - The analog data is sent through the usb cable to my raspberry pi. (You have to install on the raspberry pi : sudo apt-get install arduino arduino-mk)

ON RASPBERRY :

1 - Create a file named "Makefile" in the project's folder.

ARDUINO_DIR = /usr/share/arduino
ARDUINO_PORT = /dev/ttyACM*

USER_LIB_PATH = /home/pi/ARDUINO/librairies
BOARD_TAG = uno

include /usr/share/arduino/Arduino.mk

2 - Create the arduino code

void setup(){
  Serial.begin(9600);
}

void loop(){
    /* Voltage sensor on A0 */
    int volt = analogRead(A0);
    double voltage_a0 = map(volt, 0, 1023, 0, 2500);
    voltage_a0 /= 100;
    Serial.println(voltage_a0,1);
    delay(10000);
}

3 - Run the code on the arduino and check Serial output

make upload monitor clean

3 - Leave the monitoring system with CTRL + A and then CTRL + D

4 - Close all screen with screen -X quit (otherwise it will not be available)

5 - You can now read the arduino Serial manually with cat /dev/ttyACM0 but I created a script for reading it every 45 seconds, and write it in a file in a "logs" folder with the date as filename (keep running in the background with screen) :

#!/bin/bash
while [ 1 ]; do
        TODAY=$(date +%Y_%m_%d)
        read DUMP < /dev/ttyACM0 #DUMP
        sleep 2
        read ARDUINO_LINE < /dev/ttyACM0 #(arduino every 10s) Example : 14.7
        TIME=$(date +%R)
        if [[ "$TIME" != "$OLD_TIME" ]]; then
                echo "${TIME}=${ARDUINO_LINE}"
                echo "${TIME}=${ARDUINO_LINE}" >> "logs/$TODAY"
        fi
        OLD_TIME=$TIME
        sleep 45
done

6 - Now i have every day a file in logs called for example 2019_07_30 and it contains 1440 lines like this one : 14:40=14.2. I can use this file to create a graph with for example libre office.

7 - NOT DONE YET. I just need to add some relays that will be controlled by the raspberry pi. (I will edit this post as soon as it's done.)

\$\endgroup\$
  • \$\begingroup\$ Note that running a raspberry pi on battery is likely to be problematic, both due to the high power draw, and potential filesystem corruption from unexpected power loss. Also note that there will be some voltage variation depending on if charge is ongoing or not at any given time, that a good battery charger will vary the termination voltage with temperature, and that it will ideally do some periodic maintenance cycles - which is to say your data may be quite a bit more complex than imagined. \$\endgroup\$ – Chris Stratton Aug 1 '19 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.