Shop OBEX P1 Docs P2 Docs Learn Events
How do I stabilize fluctuations in a switch circuit - BUTTON will not work in t — Parallax Forums

How do I stabilize fluctuations in a switch circuit - BUTTON will not work in t

ArchiverArchiver Posts: 46,084
edited 2000-10-03 02:01 in General Discussion
I am doing a fluid control application currently that uses float
switches. I used to have the circuit built strictly using AC with no
microelectronics.

The circuit basically has a manually acutated switch. When you flip the
switch into an upward position, it opens an AC valve which fills a
container until the float switch is tripped. Upon tripping the float
switch, the valve is deactivated simply because the float does not allow
sufficient AC to pass and activate the 120V Valve's coil (thus opening
the valve). You can then flip the three-position manual switch to the
down position, at which time it opens a second valve and dispenses the
liquid from the container. When the switch is in the middle, all
circuits are off.

I am trying to move this to a microcontrolled version to ensure that the
users of the application are not leaving the switch in the "down"
position and burning up expensive valves. I admit that I am a rookie
when it comes to microelectronics, however, I was a CIS major in college
- so the programming comes easy. My problem is the following:

The same float switch used in the above AC applications is supposed DC
current (it's just a switch). I'm assuming that there is some form of
magnetic switch in the stem of the switch, and the float contains
magnetic elements which "close" or "open" the switch (depending on NO or
NC operation) simply by pulling it closed via magnetic field when the
float surrounds the portion of the stem holding the switch element.
Samples of the valves are at www.madisonco.com.

I tried to do a simple circuit today with a LED and the float switch.
The program simply set the output equal to the input and the switch was
wired from Vdd to P15. When I moved the float up and down, I saw some
fluctuations in the LED but it did not turn off. Debug output also
showed that the switch appeared to be fluctuating between off and on
states.... If I applied a PAUSE 600 command in the loop that was
checking the switch - the light would randomly turn on and off.

I am assuming that this switch is reliable, however, the magnetic nature
probably "opens" and "closes" the switch rapidly CONSTANTLY (which means
BUTTON is not a sufficient solution). I even monitored PULSIN, and the
pulses from the switch vary greatly depending on how "quickly" the float
is acutated.

I tried hooking the swtich from Vss to P15 also, with similar results. I
also tried using 100,000k resistor in series with the valve to dampen the
level a little, but still the same effect occured. I was going to try
using an OP-AMP, however, I dont think that would be appropriate in this
instance, because I dont think it's a "threshold" voltage issue, it's an
issue where the reed in the switch is vibrating constantly rather than
"staying put"

Any ideas on how I can stabilize this circuit to provide accurate
results?

Bob.

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk! For your FREE software, visit:
http://dl.www.juno.com/get/tagj.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-10-01 21:53
    >I tried to do a simple circuit today with a LED and the float switch.
    >The program simply set the output equal to the input and
    > the switch was wired from Vdd to P15.
    >When I moved the float up and down, I saw some
    >fluctuations in the LED but it did not turn off. Debug output also
    >showed that the switch appeared to be fluctuating between off and on
    >states.... If I applied a PAUSE 600 command in the loop that was
    >checking the switch - the light would randomly turn on and off.

    Do you have a pulldown resistor from P15 to Vss? It won't work reliably
    without it.


    | switch
    Vdd
    o~o
    ;---- P15
    |
    |
    Vss
    /\/\
    '
    10k

    Sometimes it is a good idea to put a 0.1uf capacitor in parallel with the
    resistor to knock out the switch bounce or induced noise.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-02 02:59
    At 10/1/2000 -0400 03:43 PM, you wrote:
    >I am doing a fluid control application currently that uses float
    >switches. I used to have the circuit built strictly using AC with no
    >microelectronics.
    >
    >The circuit basically has a manually acutated switch. When you flip the
    >switch into an upward position, it opens an AC valve which fills a
    >container until the float switch is tripped. Upon tripping the float
    >switch, the valve is deactivated simply because the float does not allow
    >sufficient AC to pass and activate the 120V Valve's coil (thus opening
    >the valve). You can then flip the three-position manual switch to the
    >down position, at which time it opens a second valve and dispenses the
    >liquid from the container. When the switch is in the middle, all
    >circuits are off.
    >
    >I am trying to move this to a microcontrolled version to ensure that the
    >users of the application are not leaving the switch in the "down"
    >position and burning up expensive valves. I admit that I am a rookie
    >when it comes to microelectronics, however, I was a CIS major in college
    >- so the programming comes easy. My problem is the following:
    >
    >The same float switch used in the above AC applications is supposed DC
    >current (it's just a switch).

    All switches have specific characterisitcs which must be observed in their
    application. Sadly I see no such specifications on the website. However, if
    a switch has silver contacts, DO NOT use it in DC applications. The contact
    can weld shut if the current and voltage are high enough.

    > I'm assuming that there is some form of
    >magnetic switch in the stem of the switch, and the float contains
    >magnetic elements which "close" or "open" the switch (depending on NO or
    >NC operation) simply by pulling it closed via magnetic field when the
    >float surrounds the portion of the stem holding the switch element.
    >Samples of the valves are at www.madisonco.com.

    Your presumption is correct. The "switch" is called a reed switch, and the
    magnet inside is circular,. Thus. when the central part of the reed switch
    passes thru the magnetic flux, it actuates the switch. Just for the record
    these switches are made in N.O. (normally open) and NC (normally closed)
    configurations. I'd guess this was a NO switch whcih closes when the reed
    switch actuates.

    >I tried to do a simple circuit today with a LED and the float switch.
    >The program simply set the output equal to the input and the switch was
    >wired from Vdd to P15. When I moved the float up and down, I saw some
    >fluctuations in the LED but it did not turn off. Debug output also
    >showed that the switch appeared to be fluctuating between off and on
    >states.... If I applied a PAUSE 600 command in the loop that was
    >checking the switch - the light would randomly turn on and off.
    >
    >I am assuming that this switch is reliable, however, the magnetic nature
    >probably "opens" and "closes" the switch rapidly CONSTANTLY (which means
    >BUTTON is not a sufficient solution). I even monitored PULSIN, and the
    >pulses from the switch vary greatly depending on how "quickly" the float
    >is acutated.

    All that is true, EXCEPT. it should reach a fully open state somewhere in
    that passage through the magnetic ring. Just remember from grade school
    demonstrations with magnets that the flux area is circular and opposite (in
    direction; ergo - perpendicular). So there may be a LARGE area where
    activity takes place. It's hard to determine how large, and how strong
    without instrumentation (a gaussmeter).

    >I tried hooking the swtich from Vss to P15 also, with similar results. I
    >also tried using 100,000k resistor in series with the valve to dampen the
    >level a little, but still the same effect occured. I was going to try
    >using an OP-AMP, however, I dont think that would be appropriate in this
    >instance, because I dont think it's a "threshold" voltage issue, it's an
    >issue where the reed in the switch is vibrating constantly rather than
    >"staying put"

    Try using a Schmidt trigger gate or a one-shot inline with the logic
    circuitry, if you have one around. Otherwise this may indeed be a "speed"
    issue.

    >Any ideas on how I can stabilize this circuit to provide accurate
    >results?

    A copy of that section of your program might help - just to check it.

    >Bob.

    Regards,

    Bruce Bates

    >________________________________________________________________
    >YOU'RE PAYING TOO MUCH FOR THE INTERNET!
    >Juno now offers FREE Internet Access!
    >Try it today - there's no risk! For your FREE software, visit:
    >http://dl.www.juno.com/get/tagj.
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-02 11:40
    >At 10/1/2000 -0400 03:43 PM, you wrote:
    >I am doing a fluid control application currently that uses float
    >switches. I used to have the circuit built strictly using AC with no
    >microelectronics.
    >
    <SNIP>
    >The same float switch used in the above AC applications is supposed DC
    >current (it's just a switch).

    In my experience, float switches used to be mercury tilt switches. Since
    mercury is now poisonous, recent designs use a metal ball that rolls into a
    set of contacts when the float rises (float rolls over as it does so).
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-02 23:21
    Bob,

    Are you using independent pins for your inputs and
    outputs?...Also, are you supplying your float switch
    with a +5vdc and sending that signal through a N.C.
    contact within the switch to a pin on the stamp?...
    Assuming you are, you should have a pull down
    resistor attached to your input pin which connects
    to your (0)vdc supply. This resistor is used to drain
    any residual current that may remain on the pin when
    your switch is opened. Without this resistor in place
    you may get unpredictable results. As far as the float
    switch, it should work for you...It is a magnetic reed
    switch and changes states "only" when you raise/lower
    the float. It doesn't pulse an output....I know you said
    that you have alot of programming knowledge, but are
    you sure it isn't in your program?...please don't be
    insulted I am only trying to help if I can...I am
    giving you some basic sample code below...If you already
    know this then disregard...

    start:
    LOW 0
    IF IN8=1 Then start2 'This is input to start cycle
    goto start
    start2:
    pause 10
    IF IN9=0 Then start 'This is input from float level
    HIGH 0 'This is output for a relay to run 120vac
    goto start2

    I hope that maybe this will help a little bit and if you already
    know this then let me know. Once again I am only trying to help.
  • ArchiverArchiver Posts: 46,084
    edited 2000-10-03 02:01
    bstampman@j... wrote:
    >
    > I am doing a fluid control application currently that uses float
    > switches. I used to have the circuit built strictly using AC with no
    > microelectronics.

    the fact that you were previously using the circuit on 120AC may be
    part of the problem. Contacts in relays and switches have a minimum
    current rating as well as a maximum, the minimum also referred to as
    the "wetting current". Contacts rated at 120 volts have rather high
    wetting currents. Even bifurcated contacts - meaning they are
    optimised for low voltage and low current, need around a milliamp to
    get consistent current flow. So a pulldown resistor of 5K or less
    would be called for.

    Also, it's good to use contacts that are "clean" in the sense that
    they've never switched 120AC, especially into inductive loads.
    Arcing always occurs and some pitting and carbonizing of the
    contacts results. While 120 volts AC easily breaks this resistance,
    5 volts DC may not.
Sign In or Register to comment.