Solar-powered fountain — advice needed

Mod edit:
This is related to the OP's previous topic:

Hi everyone,

I'm building a small solar-powered fountain and I'm trying to make it run for long periods, ideally during the day from the solar panel and then from the batteries after sunset.

My components

  1. Water pump: 5V, approximately 300–500 mA
  2. Battery: 3 × NiMH AA batteries
  3. Motor driver: DRV8833
  4. Solar panel: 5V, 5W — in good sunlight I can actually measure around 1A from the panel
  5. Solar charging module:
    https://www.aliexpress.com/item/1005005428598186.html
  6. Controller: ATtiny85
  7. Voltage booster:
    https://www.amazon.se/dp/B07L56BN8W

How I connected everything

The basic arrangement is:

Solar panel
     │
     ▼
Solar charger module
     │
     ▼
  POWER RAIL ◄──────► 3 × NiMH batteries
     │
     ├──────────────► ATtiny85
     │
     ▼
Voltage booster
     │
     ▼
DRV8833
     │
     ▼
5V water pump

ATtiny85 ─────────► DRV8833 IN1 / IN2

So the solar charger feeds the main power rail, the batteries are connected to the same rail, and the ATtiny85 controls the DRV8833.

The voltage booster raises the battery/rail voltage to what the pump needs, and the DRV8833 drives the pump.

I have also created schematics in KiCad:

SolarPindDrawing.pdf (257.6 KB)

Attiny code

int pumpPin1 = 0;
int pumpPin2 = 1;
int indicatorPin = 4;

int first_run = true;

bool pumpRunning = false;
int BATTERY_PACK_RUN_VOLTAGE = 4000; // (the idea is to charge it until I see 4V), and to start the batteries
int BATTERY_PACK_STOP_VOLTAGE = 3000; // (the idea is that I want to stop the system at 3v, which is a critical level for 3x NiMH batteries)


void start_pump(){
  analogWrite(pumpPin1, 210);
  digitalWrite(pumpPin2, LOW);
  delay(1000);

  // reduce power
  analogWrite(pumpPin1, 200);   // ~78% PWM
}

void stop_pump(){
  digitalWrite(pumpPin1, LOW);
  digitalWrite(pumpPin2, LOW);
}

long readVcc4() {  
  // Read 1.1V reference against AVcc
  // set the reference to Vcc and the measurement to the internal 1.1V reference
  #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
    ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
    ADMUX = _BV(MUX5) | _BV(MUX0);
  #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
    ADMUX = _BV(MUX3) | _BV(MUX2);
  #else
    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  #endif  
 
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Start conversion
  while (bit_is_set(ADCSRA,ADSC)); // measuring
 
  uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
  uint8_t high = ADCH; // unlocks both
 
  long result = (high<<8) | low;
 
  result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000    
                         
  return result;
  
}


void blink(int battery) {
  int blinks = battery / 100;   // 1000 mV steps

  for (int i = 0; i < blinks; i++) {
    digitalWrite(indicatorPin, HIGH);
    delay(100);
    digitalWrite(indicatorPin, LOW);
    delay(300);
  }

  delay(2000); // pause between measurements
}

void blink(int num, int delay_ms) {
  
  for (int i = 0; i < num; i++) {
    digitalWrite(indicatorPin, HIGH);
    delay(delay_ms);
    digitalWrite(indicatorPin, LOW);
    delay(delay_ms);
  }
}



void setup()
{
  pinMode(pumpPin1, OUTPUT);
  pinMode(pumpPin2, OUTPUT);
  pinMode(indicatorPin, OUTPUT);

  digitalWrite(pumpPin1, LOW);
  digitalWrite(pumpPin2, LOW);
  delay(3000);
}

void loop()
{
  long battery = readVcc4();
  if (first_run){
    blink(10, 100);
    first_run = false;
  }
  
  // Start only when battery is sufficiently charged
  if (!pumpRunning) {
      if (battery > BATTERY_PACK_RUN_VOLTAGE) {
          pumpRunning = true;
          start_pump();
      }
  }
  else {
      if (battery < BATTERY_PACK_STOP_VOLTAGE) {
          pumpRunning = false;
          stop_pump();
      }
  }

  // Wait before measuring again
  delay(60000);
}



What I wanted to achieve

My original goal was simply to have the fountain running for as long as possible using solar power.

Ideally, during the day the solar panel should provide enough power to run the pump, while any excess power charges the batteries. When the solar power becomes insufficient, the batteries should take over automatically.

After sunset, I would like the pump to continue running from the batteries for a couple of hours, and then shut down to avoid completely discharging them.

What actually happened

Initially, everything seemed to work.

With fully charged batteries, the pump could run for around 3–4 hours.

Then the pump stopped.

After some time it would sometimes start again, presumably because the battery voltage recovered somewhat.

This continued for a while. After approximately 3–4 days, I eventually measured almost 0V on the battery pack and nothing worked anymore.

The batteries only became usable again after I charged them from a normal mains-powered charger.

So apparently my system was eventually draining the batteries much more deeply than I expected, and the solar charging system did not recover them.

My main questions are:

1. Why did this circuit completely drain the NiMH batteries?

Is the problem with the way I connected the solar charger, batteries and load?

Could the voltage booster, DRV8833, ATtiny85, or some other part of the circuit be consuming the batteries when there isn't enough solar power?

2. Why didn't the solar charging module recover the batteries?

The solar panel is 5V/5W and can produce around 1A in good sunlight, so I expected that there should be enough power during the day to at least recharge the batteries.

However, it seems that the pump/load was able to consume more energy than the panel could replace.

3. Is my intended architecture realistic?

What I really want now is a system where the solar panel powers the pump directly during the day while simultaneously charging the batteries, and then the batteries automatically take over when solar power becomes insufficient.

NOTE:

I am a beginner in electronics (it's just a hobby for me).

The circuit design I originally came up with was suggested by an AI assistant. After several iterations and a lot of troubleshooting, I eventually realized that I should probably stop asking the robot and ask real people instead. :grinning_face_with_smiling_eyes:

So sorry if I have made some very basic or obvious mistakes. I'm mainly trying to understand what is wrong with my current design and what would be the correct architecture for this project.

Any advice or criticism is very welcome!

Take the worst case of 500mA then that is 2.5W

When you say you can measure 1A, under what conditions are you measuring and how are you measuring? I am going to guess that you are putting your meter across the wires from the solar panel with the meter set to amps and are getting 1A. If that's the case you are getting 1A and 0W because the panel is short circuit through the meter. The quoted 5W from the panel will be under ideal conditions, such as on the equator at the equinox and pointing straight up. I'm going to guess you don't live on the equator and you didn't test on the equinox. Anything less than idea conditions you won't get the 5W. You need to measure the actual current the panel can deliver into a real load.

What happens if you connect the solar panel to the pump without the battery? Does the pump run? What voltage and current do you measure?

What is the rated capacity of the batteries?

I would expect from the information you have given that the solar panel is no where near capable of running the pump let alone charging the batteries at the same time.

@oltarasenko ,
I it is pretty obvious this is related to your other topic, perhaps a continuation of it. I have placed a link into this topic back to the previous one so people have that as a reference if they need it.

Please do not duplicate topics. If you really must create a new topic for an existing project then at least link them.

Thank you.

Sorry.

  1. I live in Stockholm.
  2. The pump run normally if I connect it to the solar panel directly, but let me double check for a longer period of time, as I just plugged it in, heard the sound and called it's ok.
  3. Yes, indeed I was seeing 1A when connected the Multimeter to wires of the solar panel. Will try to check it over the load.
  4. The batteries capacity is 2450 mAh

OK, I live the UK, you are further north than me. I'd be surprised if you can get the full 5W from the panel even on mid summer's day with the panel carefully aligned to the sun. Either side of mid day the performance will be worse.

Yes, check how it really performs, then measure then current and voltage. Do you know how to measure the current?

Might be a translation into English problem, but 'check it over the load' makes me think you don't know how to measure the current. Break the circuit, insert the meter into the break.

So, for a 500mA load that's 2450/500 = just under 5 hours with no help from the solar panel. Is that enough?

Edit:
It's much less than 5 hours from the battery because of the boost to 5V. 3 NiMh cells gives 3.6V. To get 500mA at 5V requires about 700mA from the battery, plus some for the loss in the converter, so maybe 800mA total. 2450 / 800 = 3 hours.

Those panels are too small and sun is too variable to supply the Watts. Try charging- only. PANEL >> CHARGE MODULE >> BATTERY. If the batteries never increase in charge, changes are needed.

Three major changes are needed.

  1. Lithium batteries
  2. You need a MUCH more efficient pump
  3. You need a module that allows charging and using the battery at the same time. Adafruit has some.

You likely also need a much bigger solar panel. In your locale, overpanel by 100%.

10X larger solar panel would be a good place to start. For a fixed position panel, plan on full output for at most four hours per day, on a perfectly clear, sunny day.

How did you measure the pump current?
Higher currents may occur when the pump moves more water (lower head) (assuming centrifugal pump).
Also, motor currents are not easily measured accurately with meter in series (an ideal resitstor is assumed, but the motor is not an ideal resistor).

Quite likely because the (undocumented) charger is not sophisticated enough to recover completely drained batteries.

But why you call it solar charging module in the first place, there's nothing "solar" in that charger. It would be more correct to call it "USB charger" for example
.
Solar chargers have features to charge always at optimal current preventing panel voltage collapse.

I have made a test, trying to power the pump directly from the pannel. It worked on the full sun, and kind of stopped working when clouds covered the sun.

I broke the circuit and plugged the multimeter into it, to measure the current, and I see that it shows the output within 0.23(pump does not work here) - 0.60A (here it works wery well).

So that's what your pump draws. And it's also near max that your 1A panel can realistically provide in full sun. But in less ideal conditions (major part of day/year) your panel is not sufficient to run the pump and charge battery.
2 panels in parallel or single larger one would behave much better.

OK, good start.
You now know the panel can sometimes supply enough power (V * I) to power the pump, but not always. You don't know what the voltage is doing. Do you happen to have another multimeter to measure the voltage while measuring the current? That way you will get a better idea of what is happening.

From what you say I think it's clear to me that the panel can just about power the pump in strong sunshine, but not when it's cloudy. What it probably cannot do is power the pump and charge the battery at the same time, that's asking too much of it, even in bright sunshine.

All the replies after my reply #6 contain the information you need to need to progress, so I won't repeat that information here.

Side note, sorry, but I think putting a meter probe into breadboard like that will probably have damaged that contact in the breadboard. Ideally use a crocodile clip on a piece of wire like you have done for the negative / black connection.

I don't have a second multimeter, however I have tried to measure the Voltage separately (assuming that the current is similar when the pump is running). It shows 5V just after solar panel, however if I plug in multimeter after pump, it should 1.7 - 1.8 V. I don't quite understand what it means, maybe the Voltage drop on the pump is 5V - 1.8V = 3.2V?

I don't understand your results.

It would help a lot to see a schematic, hand drawn and photographed is fine. While the photos help they are not enough to be sure what his happening. If the voltage at the panel is not the same as at the pump then something has to account for the difference but from the photos I cannot see what that is. Maybe someone else can, but I can't. A schematic would make it clear.

That said, I don't think any more testing and measuring will change the conclusion: The panel is not big enough.

Assuming I will get another panel like this, what would be my option to:

  1. Power the pump from pannel
  2. Charge batteries from pannel
  3. Use batteries as a reserve for pump?

I can't answer, I don't have enough knowledge to make recommendations. I do think the replies other have given after my reply #6 go a long way to answering what you need. If those replies are not enough then I suggest replying to each suggestion asking for more details.

I suggest you to study how solar panels and solar chargers work.
Let's say you have a panel that can provide for example 0.3A at 5V in certain solar irradiance X.
Now if you try to draw more than 0.3A, it causes panel voltage to drop. If you try to draw significantly more, panel voltage collapses to the point that it can't power the pump, neither charge batteries.
You need better hardware or significant over-panelling.

Full sunshine may be 10 times brighter than a cloudy day.
Your panel does not follow the sun, so in the morning and afternoon it will deliver less power.
You may need at least 20 panels to run the motor and charge the panel on cloudy days.