Shop OBEX P1 Docs P2 Docs Learn Events
Need help ?rapid on & Off state — Parallax Forums

Need help ?rapid on & Off state

SiriSiri Posts: 220
edited 2007-07-22 20:18 in BASIC Stamp
I am working on project using BS2SX OEM module - with a pressure sensor circuit and ADC convertor.
I am using the pressure out-put to trigger a solenoid on and off .The solenoid is suppose to be ·"on" when there in no pressure and on when there is pressure detected and "Off" when pressure increases.
The problem is when there is very "little" pressure the solenoid continuously goes on and off untill higher pressure is detected and then the solenoid stays off and then when the pressure drops at very low level the the solenoid continues on and off untill pressure drops further down.

Since there is not a big difference in the pressure I did take the ADC out-put and converted· into ratiometric pressure toinlde 3 decimal points(3.432 cm H20) and then multipled by 1000 to get large numeric but proprtional values.Still even if the triggering values like <35· (solenoid - "Off") and >125 (Solenoid· "On") the triggering is not stable when the pressure is very low.

Is there a hardware or code or both that can fix this "Flikering problem"

Thank you,

Siri

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-16 17:38
    It would be helpful if you would post a diagram of your circuit and attach your program.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-07-16 18:52
    In general, "flickering" is caused by a lack of hysteresis. The cure for this is to make the turn-on threshold different from the turn-off threshold. In your case, you will want to make the turn-on threshold lower than the turn-off threshold. That is, once the solenoid is on, the pressure has to raise to a point higher than the turn-on threshold to go off. Likewise, when the solenoid is off, the pressure has to fall to a point lower than the turn-off threshold to go on. The difference between the two thresholds is the hysteresis, which you will need to adjust for optimal performance.

    -Phil
  • Lee HarkerLee Harker Posts: 104
    edited 2007-07-16 20:46
    Siri,

    Hysteresis as mentioned before is a good idea. You are probably experiencing some pneumatic "bounce". When you open a valve in a pressurized system, it will take a finite time to settle. You may need to delay a bit after the solenoid is open before you read the pressure and then delay and read it again. That way you can tell if it has settled.
  • SiriSiri Posts: 220
    edited 2007-07-16 23:18
    Thanks Mike,Phil and Lee for the quick response.
    ·I am atttaching the circuit and the code I am using so you can make more suddestions to solve the problem.

    Phil - I tried your sugesstion widening the threshold limits and it did slow it down but it still goes on and off at a slower rate when I widen any furtherit required more pressure to work and is not suitable for the project.

    Lee - I will try your suggestion to increse the inbetween reding times.

    Thanks once again for your help.

    Siri
  • SiriSiri Posts: 220
    edited 2007-07-16 23:22
    Sorry folks the circuit diagrm was uploaded updise down.

    Siri
  • SiriSiri Posts: 220
    edited 2007-07-17 17:35
    Lee,

    I already had programmed 30 milsec delay after readings· and I tried increasing and did not do any better.I am trying with pauses at different stages in the program just to see whether I can better the on & Off states.

    Thanks for your help

    Siri

    ··
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-07-17 18:00
    Siri,

    Another thing you might try is lowpass filtering your readings using a running average, for example, like this:

    CurrentReading = CurrentReading + NewReading >> 1
    
    
    


    NewReading is the value obtained from your sensor, and CurrentReading is the value you use in your program. (CurrentReading needs to be initialized at the beginning of your program by assigning it the sensor reading directly.)

    Along with the hysteresis and delays, this will help to keep small changes from tripping the solenoid unnecessarily.

    -Phil
  • SiriSiri Posts: 220
    edited 2007-07-22 17:38
    Thanks Phil - I tried your low pass filtering idea it did improve and the system now works close to what it was intended to do.

    Thanks again for helping out.

    Siri
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2007-07-22 20:18
    A method of throttling the flow might help. It souds like your trying to get linear control from an open/close valve. Sometning like a smoother steadier pressure increase as opposed to dumpimg a large volume all at once.
Sign In or Register to comment.