2
\$\begingroup\$

I have a float switch that has three possible positions- open when above the water level, closed when below the water level, and rapidly opening and closing (freq~=0.1s) when its near the water level. I need to be able to distinguish bouncing around from the other two while only sampling the voltage across the switch every 1-2 seconds. I thought I could use an RC circuit to do this but my electronics background is fairly weak. I put together the following diagram:

schematic

simulate this circuit – Schematic created using CircuitLab

I think this circuit has a time constant of 1s which should roughly give me the average switch value over the last 1 second or so. I think the current should be 1mA, which I think is appropriate for reading on an Arduino. Should this work? Is it a good way of solving this problem?

\$\endgroup\$
  • \$\begingroup\$ Can you replace your switch with a variable resistor? if so then you can simply define the calculated resistance values (voltage) in your code and determine a range for each level. The added advantage is you could also determine how far above or below your thresholds the float is and thereby infer the actual level. \$\endgroup\$ – BenG Aug 3 '15 at 21:26
  • \$\begingroup\$ @BenG No, unfortunately there are not a lot of cost effective sensors available. The float switch is $20 and anything with more detailed output is $200+. Definitely cheaper to solve with electronics. \$\endgroup\$ – ericksonla Aug 4 '15 at 1:48
1
\$\begingroup\$

What is V1 exactly, does it have any internal resistance? Does the switch has any internal resistance?

I think you may have two choices:

  1. Since the switch only changes at 10Hz. You may sample the signal with Arduino ADC at 100Hz, which is easy for Arduino to achieve. Then you can implement averaging algorithm in your Arduino. Say you need the readings every one second, then you can average 100 points every second, using a timer.

  2. Do it in analog way, like yours. You may need a voltage follower, which has low output resistance. The output resistance of your current circuit is high for the input resistance of an ADC. And you may get an inaccurate result. This is a voltage follower: http://www.learningaboutelectronics.com/Articles/Voltage-follower

\$\endgroup\$
0
\$\begingroup\$

Do you need to distinguish between all 3 states or are you interested only whether the level is significantly above or below the threshold?

If all you need is two states, a long time constant RC filter will give you what you want.

Things are a tiny bit more complicated if you want to distinguish between all 3 states. That will take 2 separate filters and at least one a/d input.

I'm on site right now. But I'll post a schematic when I get in front of my computer.

\$\endgroup\$
  • \$\begingroup\$ I don't need particularly high fidelity but the controls certainly get easier if I can detect some differentiation in the near-threshold zone. \$\endgroup\$ – ericksonla Aug 4 '15 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.