pump control

Status
Not open for further replies.

jd911

Member
Is there a way to make this pump A empty and then A full with float switches?

Thanks

if read x or y == high
write A high
else
write A low

Untitled.jpg
 
You are missing a lot of information to answer that one since there are a lot of mechanical or electrical ways to get a toggle.

Given you posted here though arduino code would be:
declare a variable at the top of your code (global scope)
byte pumpRunning =0;

And then in the main body check the inputs and set that variable
if (digitalRead(inputX)==high) pumpRunning=1;
if (digitalRead(inputY)==low) pumpRunning=0;

and then use that variable to define the pump state
digitalWrite(motorPinA,pumpRunning);
delay(10); //keep cycle rate sane


So a variable deceleration, two inputs, one output pinmodes in setup and then two if statements in your main code

The above shouldn't be used in any real world application without a fair bit more engineering around the switches, the pump and the operating environment.
 
Thats not what i was wanting to know. My question is will it work with just float switches. cycle rate implies a the time it takes to empty/fill the tank. so i guess not.
 
Sorry, at least to me, it is hard to understand exactly what it is you wish to do.

I think I am reading it the same way as GremlinWrangler is, and that is you would like to turn on Pump A when X pump switch goes logically high. When I say logically High, this depends on how your switch works. Is it high when float rises to the top mark or does it go low then... Again I am assuming that the Y switch would work the same way, so you would then want to turn the pump off when Y goes logically LOW.

I think his cycle rate code is a simple switch debouncing when it reaches the end points, which may or may not be needed. That is assuming X and Y are far enough apart and you don't mind if maybe a little fluctuation of level at the bottom, may not necessarily get you the last drop...

As for mechanically and electrically hook up ... In my Pump House, the logical Y is actually hooked up to the 220v pressure pump, such that no power will go to the pump if level low...
 
say you have float switches w and x on tank A/pump A,
and you have float switches y and z on tank B/pump B.

w 1 x 1 y 0 z 0 A 1 B 0
w 0 x 1 y 0 z 1 A 1 B 0 here a and b are on
w 0 x 0 y 1 z 1 A 0 B 1
w 0 x 1 y 0 z 1 A 0 B 1 here a and b are on

always a half a glass
 
but say you could add a counter to keep it straight as to which side had water to be pumped before turning the other pump on, how would you do that?
like??:
t = 0
t = t + 1
if t = 1 && x or y == high

i cant wrap my mind around..
thanks for youre help
 
if (digitalRead(inputX)==high) pumpRunning=1;
if (digitalRead(inputY)==low) pumpRunning=0;

and then use that variable to define the pump state
digitalWrite(motorPinA,pumpRunning);
delay(10); //keep cycle rate sane

thanks for your response and sorry for not understanding java arduino that well..

So are you by saying "pumpRunning" that you keep up with the pump's state and have them run separately using that in addition to the float switch states?

i really appreciate it and thanks for your patience
 
Arduino is closer to C than Java but yes, program logic is to just cycle quickly through the loop,

If the upper float is active set the pump value to start
If the lower float goes inactive set pump value to stop

If nothing else happening leave the value alone.

Then output the motor state

wait a bit to let Arudino do background stuff and let physical world catch up with program actions.

Key thing is that if you start pump, then sit in a loop waiting for it to stop then your code blocks - doesn't do anything else. Running with the variables you can do multiple things at once so you can add more if statements and another pump variable to managed your second pump. If there is logic between the two pumps I'm not getting then you can add that within the if statements by using and/or logic, to say stop both pumps running at once or whatever this application is.

https://www.arduino.cc/en/Reference/Boolean

As I stated above all this code does is execute the logic, there would be a lot more design to making a physical thing.

If you are new to this really suggest doing a mock up of this in the desktop programing environment of your choice, since basic program structure and logic is much easier to learn when you can see it.
 
Status
Not open for further replies.
Back
Top