Arduino Controlled Solar Fountain

A fountain can make a nice decorative fixture for your garden. But it isn’t always easy to run a power cord out to where you want it. So I decided to run it on solar power. The system is controlled by an Arduino. This allows you to save energy by programming when the fountain will be turned on.

Arduino Controlled Solar Fountain

Step 1: Powering the Fountain

A standard solar panel and battery provide the power for the fountain and the control circuit. Since most fountain pumps run on 120VAC, you will also need a small power inverter to run the pump.

Solar Panel:
The size of the solar panel determines how many hours a day the fountain can be on. If you want the fountain to be on all the time, then you will need a larger panel. If you only want it to run for a few hours each day, then you can get by with a much smaller panel.

Battery:
The battery needs to be a 12V rechargeable battery (preferably one that is designed for solar power applications). It should have a high enough capacity to be able to run the pump for a few hours on a single charge.

Power Inverter:
The power inverter just needs to be strong enough to power the pump. A small 80 watt inverter should be more than sufficient to power most fountains.

Step 2: Relay Driver Circuit

Relay Driver Circuit

The control circuit in this project uses a relay to turn the fountain on and off. You could do this with a commercial relay shield. Or you can make your own relay driver.

To make a relay driver, the first thing that you need is a relay. I recommend using a 12V relay. This lets you power it directly from the battery. Then you need a power transistor to activate the relay. I chose a IRF510 MOSFET but other power transistors can also work.

Lastly, you need to add a diode in parallel with the relay’s coil in order to protect the transistor from voltage spikes that can occur when the relay turns off.

Wire up the relay driver circuit as shown in the diagram and you are ready to connect it to the Arduino.

Step 3: Connect the Relay Driver Circuit to the Arduino

To power the Arduino, you need to connect the negative terminal of the battery to the GND pin on the Arduino and connect the positive terminal of the battery (or the +12V line from the relay driver circuit) to the Vin pin. The Vin pin has a built-in voltage regulator and most Arduino models can accept 7V-12V.

Lastly, you need to connect one of the digital pins (in this case pin 13) to the gate of the transistor. This will provide the signal that will turn the relay on and off.

Step 4: Connect the Solar Panel, Battery and Inverter to the Relay Circuit

I decided that the most convenient way to connect the other components was to wire them all to the circuit board of the relay driver.

If your solar panel does not have a built-in blocking diode, then you need to add one before connecting it to the rest of the circuit. This prevents electricity from flowing back through the panel when it is dark and draining the battery. The negative terminals of each component can be wired together as a common ground. The positive terminals of the solar panel, the battery, the Arduino, and the relay driver can also be wired together. The positive line going to the inverter is connected to the output of the relay.

Step 5: Make a Housing for the Relay Driver and the Arduino

To help keep things a little more organized, I made a simple housing for the relay driver and the Arduino. I cut slots in one side of the box for a pair of wires that connect to the battery. On another side I drilled two holes and added a pair of screws that I used to attach the clamps from the solar panel. On a third side, I made a 1 1/8″ hole and added a 12V DC power outlet for the inverter.

Step 6: Put the Components into a Weather Proof Enclosure

Since your electronics will be outside, you need to protect them from the weather. I just used a cheap plastic tub with a slot cut in the side for the power cords. It isn’t completely air tight but it will keep the rain out. For a better seal, you can add weather stripping along all the edges.

Step 7: Basic Operation

Electricity that is produced by the solar panel is stored in the battery. The battery then uses this stored electricity to power all the other components. When the Arduino sends a HIGH signal to the gate of the transistor, the relay is activated. This connects power to the inverter and turns it on. The inverter then takes the 12VDC from the battery and converts it into 120VAC which powers the fountain.

Step 8: Program the Arduino

Now you need to create a program to control the fountain. The first thing that you need to do is set one of the digital pins to output mode. Then you need to decide on which conditions should cause the fountain to turn on. For instance, maybe you want the fountain to turn on at certain times. Below is a simple example. This program turns the fountain on for one hour after being activated. The fountain will then continue to turn on every day at this time. You can also use environmental conditions such as light intensity to activate the fountain. However, this will require you to add some additional sensors. A few examples are given in the following steps.

int RelayPin = 13;                 // relay driver connected to digital pin 13

void setup()
{
pinMode(RelayPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
digitalWrite(RelayPin, HIGH);   // turns the fountain on
delay(3600000);                     // waits for an hour
digitalWrite(RelayPin, LOW);    // turns the fountain off
delay(82800000);                        // waits for 23 hours

}

Step 9: Battery Voltage Sensor

Because the output of a solar panel is dependent on the weather, you can’t always count on it to keep the battery fully charged. So it might be a good idea to have the Arduino monitor the battery’s voltage. This would enable the system to turn itself off if the battery gets too low.

You can easily use the AnalogRead function to measure a voltage. Unfortunately, it can only measure voltages up to 5V. So you need to make a voltage divider to reduce the voltage to something that can be measured. To make one, you will need two resistors. One of them should be twice the value of the other. Connect one lead of the larger resistor to the 12V+ line from the battery. Connect the other lead of the larger resistor to one of analog pins in input mode. Also connect one of the leads of the smaller resistor to this same analog pin. Then connect the other lead of the smaller resistor to the negative terminal of the battery or the GND pin of the Arduino. Then you can use the AnalogRead function to measure a voltage as an integer between 0 and 1023. To convert this into volts you can use the formula: V=AnalogRead*0.0049*RLarger/RSmaller. Here is an example of how you could use this setup to monitor the battery’s voltage and turn off the fountain when the battery gets low. The chosen resistors are 10K and 4.7K.

int RelayPin = 13;                 // relay driver connected to digital pin 13
int analogPin = 3;                 // Center of voltage divided connected to analog pin 3
int val = 0;                           // variable to store the value read

void setup()
{
pinMode(RelayPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
val = analogRead(analogPin);    // read the input pin
if (val< 720)          //if the battery’s voltage is less than 11
//with the chosen resistors of 10K and 4.7K, the voltage divider turns 11V into 3.5167V
//this is read by the analogRead function as 720
{
digitalWrite(RelayPin, LOW);    // turns the fountain off if the battery’s voltage is below 11V
}

if (val> 785)          //if the battery’s voltage is greater than 12
//with the chosen resistors of 10K and 4.7K, the voltage divider turns 12V into 3.8364V
//this is read by the analogRead function as 785
{
digitalWrite(RelayPin, HIGH);   // turns the fountain on if the battery’s voltage is greater than 12V
}
delay(60000);                            // waits for one minute
}

 

For more detail: Arduino Controlled Solar Fountain


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top