h2o

Water Filtration Construction Phase 10

Posted by admin on May 18, 2009
Water Filtration Build / No Comments

This week we are working on the filter box again. We will be redoing the float switch and explaining to you how we burned out our Arduino Board so that you won’t copy our mistake :) .

First of all, the original float switch was just barely small enough to fit through the bung hole in the barrel. However, we found another water bottle that is smaller in diameter and wanted to make another float. This new bottle fits in the bung hole much nicer than the previous bottle.

We also had to change the code to the Arduino a little since we changed the float switch to a more convenient type. We had to change the code because this switch’s natural state is normally on, while the other switch was normally off. The new switch is seen below:

switch1

Sorry the picture is kinda blurry, but this is a standard switch found at your local Ace Hardware. Thought they would be more readily available than the other one we used.

float

The new bottle is seen in this image. It is much smaller in diameter than the previous bottle and has the same volume. This means it triggers the push button with sufficient safety factor.

We think this second float switch is much better than the first. We still used the same technique as the other one to make this one. So if you need the how-to guide for making the float switch, go here.

The second event of the weekend entailed burning out the Arduino. This happened after we did a few crucial things to the circuit though, like supplying power to the Arduino via the plug seen below:

plug

This is a 2.1mm ID DC Coaxial Plug that will fit into the power supply plug on the Arduino Board

plugwire1

An Image of the same plug with the proper wiring attached. Note that the Arduino needs center positive on these plugs.

littlebox2

An image of the correctly placed plug going into the Arduino control box.

Once we had the plug installed into the Arduino correctly and all the wires routed correctly, we had to program the Arduino again. As we mentioned previous, the new float switch is normally on while the old one was normally off. We updated the code to reflect this change and loaded it into the Arduino.

program

Here’s the code:

//Pin Assignments.
int pinClean = 10;
int pinDirty = 9;
int pinPower = 2;
int pinValve = 3;

//Floatswitch States.
int cleanState;
int dirtyState;

//Debounce stuff.
int cleanPrevious = LOW;
int cleanReading;
long cleanTime = 0;
long cleanDebounce = 100;
int dirtyPrevious = LOW;
int dirtyReading;
long dirtyTime = 0;
long dirtyDebounce = 100;

void setup()
{
pinMode(pinPower, OUTPUT);
pinMode(pinValve, OUTPUT);
pinMode(pinDirty, INPUT);
pinMode(pinClean, INPUT);
dirtyState = digitalRead(pinDirty);
cleanState = digitalRead(pinClean);
digitalWrite(pinPower, HIGH);
}

void loop()
{

if ((dirtyState==LOW) && (cleanState==HIGH))
{
digitalWrite(pinValve, HIGH);
}
else
{
digitalWrite(pinValve, LOW);
}

//Read and debounce the switchs.
cleanReading = digitalRead(pinClean);
if (cleanReading != cleanPrevious && ((millis() – cleanTime) > cleanDebounce))
{
if (cleanState == HIGH) {cleanState = LOW;}
else {cleanState = HIGH;}
cleanTime = millis();
}
cleanPrevious = cleanReading;

dirtyReading = digitalRead(pinDirty);
if (dirtyReading != dirtyPrevious && ((millis() – dirtyTime) > dirtyDebounce))
{
if (dirtyState == HIGH) {dirtyState = LOW;}
else {dirtyState = HIGH;}
dirtyTime = millis();
}
dirtyPrevious = dirtyReading;

}

The red-lettered code is the part we changed from last week. It simply reflects the logic states of the new switches as being normally on as opposed to being normally off. Simple!

Then it was time to test the filter box by plugging it in to the wall outlet in the house. The dirty water pump turned on as expected. Next, we wanted to test it under load–i.e. pumping dirty water–so, we took it outside and hooked the hose up to it and ran it to the rain barrel. The pump worked fine for awhile but then we started smelling some funny things. The Arduino wasn’t acting correctly in that it didn’t shut off the solenoid valve as it should have when triggered by the float switches. Also, we later discovered that we were directing 15V into the power inlet of the Arduino. The max voltage of the Arduino board is 12V max for continuous operation.  So we burnt out the voltage Vcc  pin on the Arduino’s FTDI chip….yay us…thirty bucks down the drain:

burnt

So we are in the process of ordering 2 new Arduino boards. The funny thing is that our fuse did not blow out before the board because we had too high of a fuse. So for these applications 500mA is way too large of a fuse…maybe something along the lines of 50mA is more practicable. Better to burn out a $2 fuse than a $30 board.

Further inspection showed that we were also not supplying 24 Volts to the solenoid valve as we thought we were. Either we made a huge mistake when testing the pins of the transformer for 24 volts AC or we wired something up incorrectly. We may end up buying a small 24V 1 amp power supply from Fry’s and be done with it. This seems like the easiest solution if not the most cost effective. The power supplies run something like $20-$30 US. This still doesn’t answer how the solenoid was actuating correctly in our previous tests but we are getting tired of messing around with this particular subsystem of the filter box.

Until next time, be safe and sustainable…and don’t burn out your Arduinos!

P&S


Share This Post

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,