jump to navigation

Float Switch — values returned August 24, 2010

Posted by rik94566 in aquaponics, arduino, Float Switch.
Tags: , ,
trackback

Knowing the values returned from the switch makes it possible to write a Sketch using these values to accomplish the task of turning a pump on or off.  Being that this is a switch only two states occur.  ON or OFF.  We will now determine the values for the ON State and the OFF State.

Three things need to happen in order to generate values from the Float Switch.

1.  Arduino Sketch needs to be developed and load on to the arduino

2  Reading taken in the OFF state or bottom of the switch.

3. Reading taken in the ON state or top of the switch.

ARDUINO SKETCH DEVELOPED:

Sketch to test for values

// Sketch to determine values for FLOAT SWITCH

int FLOAT = 0;
int float_val;

void setup(){
Serial.begin(9600);    // open serial port

}

void loop() {
float_val = analogRead(FLOAT);   // read value from FLOAT switch
Serial.print(“Float Switch reads “);
Serial.println(float_val);
delay(5000);

}

Reading from the lowest level of the Float Switch:

Lowest leavel reading

Reading from the higest level of the Float Switch:

High level reading

We now know the values in the ON and OFF States of the Float Switch.

It is now possible to use this switch to control water levels and perform work functions.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: