Musical Water Fountain – Part 2

Project 2

Musical Water Fountain

By James Winters


The aim of my second project was to produce a water fountain which switches on and off with music accompanied by LED lights. I wanted to produce 5 water jets which would fire water when the DB of the music got above a certain value

How It Works

  1. Music/Sound is detected by the Sound Detector
  2. The Sound Detector digitally reads Decibel value
  3. If the Decibel value is between a low and high value (a threshold) then

The Arduino will tell the particular Water Solenoid to open (letting the water flow through) and the particular LED to light up

If the Decibel value read is not between the assigned threshold values then the Arduino will tell the particular Water Solenoid to remain closed (water will not be allowed to flow through) and the particular LED not to light up

This will continue to loop and create a water display with lights to the given music!!

Electrical Components Required

  • Jumper Wires (any sort), but I used (Male/Male)

  • Arduino (I used an Uno)
  • Breadboard (to build your circuit onto)
  • Solderless Header adaptors
  • 5 x TIP 120 Transistors

  • 5 x Adafruit Water Solenoid Valves (requiring 320mA)

  • In my case I needed 10 x Female Spade connector to fit the positive and ground from the Arduino to the 5 Water Solenoids
  • 5 x LED bulbs (any sort), but I used (bit jazzy)

  • 5 x 1K ohm resistors (brown, black, red, gold)

  • 5 x 560 ohm resistors (green, blue, brown)

  • 12v Water Pump
  • 12v power supply which can be connected one set of power rails on the breadboard

Mine came via a used agricultural sprayer pump. As long as it can provide a decent amount of pressure and is 12v which can be plugged into the Breadboard

Mechanical Components/Tools

  • Solder
  • Copper Plumbing bends
  • Copper Plumbing diameter reducers (I was unable to find any so I produced my own)
  • 5 x Copper Plumbing T connectors
  • Mechanical Water Pressure Regulator
  • Pump supply pump (water supply to the pump)
  • Feed pipe (water supply from the pump)
  • Pressure Regulator pipe (if all the solenoids are closed this allows for the water to go back into the tank. If pressure is too high this will allow for relief of the water)
  • Solder
  • Soldering equipment (I used a hand-held gas torch)

Initial Testing – Electrical

I split the components into little chunks and got those working reliably and then combined. I split the components into:

  • 1 LED to work with the Sound Detector and getting the LED to switch on and off

(There are 5 LED’s in the project which all work in the same basic way. Once the code can work for one it can then be replicated 5 times)

  • 1 Water Solenoid to work with a 12V supply and the Arduino with some test code

(Again like the LED’s there are 5 solenoids, but the basic code will only have to be altered again for the different Arduino control pins.)

Getting The Solenoid To Open And Close

P2 1 P2 2

Solenoid Test Circuit

The Solenoid test circuit comprises of:

  • 12v Power Supply (to the rail)
  • 1KΩ Resistor (base to Arduino pin 13)
  • TIP 120 Darlington Transistor
  • Diode (to collector rail)
  • Water Solenoid (+ to rail, – to collector of Transistor)

The Water Solenoid required two Female spade connectors in order to connect to the breadboard. Other wire needed to be used, using an electrical wire stripper to expose the wire and then compress the spade connector onto the wire and then push the connectors onto the Water Solenoid.

Source Website:

I produced the code from scratch

Sample Code (remember Arduino pin 13)


int solenoid=13; //assign Solenoid to pin 13 on the Arduino

void setup(){

pinMode(solenoid,OUTPUT); //define Solenoid as an Output

Serial.begin(9600); //Allows for you to use Serial Monitor to get messages from the Arduino


void loop(){

digitalWrite(solenoid,HIGH); //Opens Solenoid

Serial.print(“solenoid on”); // Message on Serial Monitor that Solenoid is open

delay(2000); // 2 second delay

digitalWrite(solenoid,LOW); //Closes Solenoid

Serial.print(“solenoid off”); // Message on Serial Monitor that Solenoid is closed

delay(2000); // 2 second delay


Getting The Solenoid To Open And Close & LED

The next thing was to try and combine an LED into the system. The LED works via the 5v power supply from the Arduino, not the 12v external power supply. The LED requires a 560 ohm resistor.

P2 3

Code – LED on pin 2 of Arduino

int solenoid=13;

int led=2;

void setup(){





void loop(){



Serial.print(“solenoid on”);




Serial.print(“solenoid off”);



The Sound Sensor

The next component required to make up the display is the LED’s which are designed to work with the Sound Sensor to light up when they get to a particular Decibel value, a threshold, determined by what I set it at in the Arduino code

The Sparkfun Sensor which I used came with no pins attached to it to allow for it to be pushed into the breadboard for connection so therefore I required a 5 pin Solderless Headers.

P2 4


int DO = 3; //Pin for Digital Output – DO

int DA = A0; // Pin for Analog Output – AO

int threshold = 200; //Set minimum threshold for LED lit

int sensorvalue = 0; //Initial sensor value

int LED=2; // LED to Digital Output 2

void setup() {




void loop() {

sensorvalue = analogRead(DA);

if (sensorvalue >= threshold) { //Compare analog value with threshold

digitalWrite(LED, HIGH);

Serial.print(sensorvalue);//prints Sound Detector value to the Serial Monitor in order to view the values


else {

digitalWrite(LED, LOW);





Princetronics website was very useful. Using the Sparkfun example code that I got with the Sound Detector was very hard to decipher and understand what was happening. This was a lot easier and could be applied to the Sparkfun.


Combining Them Both

Once I was able to get the Solenoid to open with code and an external 12v power supply and the Sound Sensor code was able to work reliably, it was then time to combine the code to allow the LED and Solenoid to open once a particular value has been reached on the Sound Detector threshold. This job required combining of the two circuits and Arduino code which had been created.

Wires To The Sparkfun Sound Detector

Pin of Sound Detector Wire Colour On Fritzing Connection To
GND Brown GND on 12v rail
VCC Red 5v Arduino Power Supply
GATE Green Digital Pin 3
ENVELOPE Yellow Analog Pin 0
AUDIO No Need For Connection No Need For Connection


This video shows me testing the Sound Detector with the Solenoid

Replicating Five Times

Now I was able to produce the code and circuits for one complete system I could then replicate it another four times.

This wasn’t hard to do as I’d built the code up from the start in small chunk so as soon as I’d added to it, it worked perfectly! Debugging had already been done.

P2 5

Why I chose a TIP120 Darlington Transistor over a Relay?

When I was working on this project I was researching for ages in a way to allow for a 12v item to be controlled by an Arduino. An Arduino is only able to produce a very small amount of current and only be able to cope with a maximum of 5v.

In order to control these more powerful higher voltage and higher current items I required as I researched either a Transistor or a Relay.

The Relay and Darlington Transistor are able to allow for 12v items to be controlled by the Arduino because there are no 12v electrical connections to the Arduino itself. If it did and with a high current, I wouldn’t have had an Arduino for long! I’m controlling in this case the Transistor through the Arduino and whether it open and closes 12v power to the Solenoid; not the Solenoid straight.

The benefit of the Transistor over the Relay is that although they perform in exactly the same way the Transistor for this project I could produce the same result and control of the Solenoids in much fewer components.

The Relay Way

P2 6


This video by a chap called Roman Kozak was very helpful in understanding what was going on and how to build the circuit. I found this first before moving onto the Darlington TIP120 Transistor.

The Plumbing

In order to distribute the water through the five Solenoid’s I produced a “Manifold” which split the water supply into five ways. Similar to that of an engine with the exhaust pipes coming out and generally going into one. This is exactly the same but in reverse.

The Manifold I produced couldn’t be bought off the shelf so I had to fabricate one myself using general plumbing Copper pipe and fittings. A combination of cut to size straight sections of pipe, 90° corner, Tee and end tap threaded sections were used to create the Manifold. I used solder ring fittings as they were easier to fit and work with containing the solder already inside so I just needed to heat the solder up to temperature to melt it and let it run. Heating the Copper up required a small hand-held gas torch.

How It Works

P2 7 P2 8 P2 9 P2 10

The water pump has two pipes, one to draw in from the water bucket and then one out which goes to the Water Feed to the Manifold.

The water pump is continuously drawing in water and feed it to the Manifold, but when all the Solenoid’s are closed where does the water go? Therefore I required a Pressure Regulator in order to relieve water out of the system when the Solenoid’s are closed. This water relief valve lets the water go back into the bucket again.

The Solenoid’s screw onto the end of the Manifolds which are radiator tap fittings with a sealing washer in between.

Water Distribution

After being split up into the five Solenoids by the Manifold the water is then distributed by small pipes to different p-ositions in the water bucket. Water goes into a small green pipe using a downsizing adaptor which I made for each. The pipe was super glued into the end of the adaptor. A rubber seal was placed over the end and then a nut over the top to seal the system.

Getting Water To The Solenoids (Out The Box)

Water was got to the Solenoids by the water pump feed pipe simply being placed in the box where the pump would draw up the water and into the Manifold.

Excess Water

When the Solenoids are shut and don’t require water the Manual Water Pressure Regulator allows for the relief of water which down another pipe which is placed back into the water bucket.

P2 11


The five solenoids are placed on the ends of the Manifold with the electrical pins facing up in order to reduce the chance in getting in contact with water. Female spade connectors were used for fittings and then long wires run to the Arduino and the 12v power rail on the breadboard.

Water From Solenoids To Jet

Water from the Solenoids to the end jet was carried by small rubber pipe with tight plastic fittings attached to the box. The diameter of the pipe was reduced to make the design more elegant as well as making less of a mess with a mass of water.


Testing of the set up using a power pack

LED Lights

The LED lights were placed on the outside of the box in order to keep the electrics protected from the water. The side of the water bucket was drilled in order to let the top of the LED poke through into the box and then with clear silicon sealant sealed to keep the water on the inside! Long cables then simply ran to and from the Arduino and breadboard. I used stripped telephone cables and then stuck the route of the wires to the side of the water bucket to stop them snagging.

Wiring Between Breadboard & Solenoids

Although they aren’t directly linked, slightly thicker wires were required to allow for 12v power between the Breadboard and Solenoids. I was using stripped telephone cable as the wires was relatively small and rigid and fitted perfectly into the Breadboard slots.

References That I Found Useful (on top of ones already mentioned) (Similar to what I used but placing the Diode in a different position) (Best way to drive a 12V DC solenoid valve) (VERY HELPFUL!)