Building and testing a “flowing water light”

I’m a bit of a sucker for cheap little electronics. After playing around with single LEDs and traffic lights for a while I wanted something a bit more interesting, so just over a pound for an “8 Channel Flowing Water Light LED DIY Kit” seemed too much fun to pass up.


The circuit is very simple indeed – a single-in-line resistor pack, eight standard LEDs, a board, and a connector. Slightly better than my own LED attempts, as it has a separate current-limiting resistor for each LED which helps prevent the inadvertent dimming I noticed when more than one light was on in my traffic lights. Assembly was also simple. The only even mildly tricky bit was keeping the LEDs neatly aligned to avoid too much of a “snaggle-toothed” look to the finished article.

To test the board I decided to start by using an Arduino. They have plenty of digital io pins and its easy to write code to drive them. To start with I decided not to bother with brightness control using PWM, but to stick with just switching the lights fully on or off. Even this needed a few false starts, though.

The first problem was that the Arduino I tried (a genuine Uno R3) would not connect to the PC. It started up when USB power was applied, but never appeared as a virtual COM port for programming. This was very odd, as only a few weeks ago I had this happily running my traffic lights. After half an hour of fiddling to no avail I gave up with that board and tried another (a Sainsmart Uno R3) which I had bought because of its optional 3.3V support and easy sensor connection area. This one connected with no problem, so I was able to write code and run it on the board.


The next problem was choosing which pins to use. I needed eight digital out pins and Vcc. Being an orderly sort of person I started by connecting the board to pins 0-7. It turns out that this was not a good idea. pins 0 and 1 are also used by an on-board serial port and gave me some strange output. I expect that with a bit of research I could work out how to disable the UART and use these two pins as regular digital outputs, but it was easier to just bump all the connections along a bit and use pins 3-10 instead.

The final problem (and this was one I should have guessed from the board connections) was that the LEDs are wired in a common-anode circuit, so to switch a light on I needed to pull the output pin low. Eventually I arrived at the following Arduino sketch

int first = 3;
int last = 10;
void setup() {
  for (int i = first; i <= last; ++i) {
    pinMode(i, OUTPUT);

void showpin(int led) {
    digitalWrite(led, LOW);    // turn the LED on by making the voltage LOW
    delay(100);                // wait for 100ms
    digitalWrite(led, HIGH);   // turn the LED off

// the loop routine runs over and over again forever:
void loop() {
  for (int led = first; led < last; ++led) {
  for (int led = last; led > first; --led) {

Which produced a pleasing “Knight Rider” effect (click to play, excuse the cheesy GIF!)


Leave a Reply

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