Shop OBEX P1 Docs P2 Docs Learn Events
false edge counting on slow ttl signal w/a little noise — Parallax Forums

false edge counting on slow ttl signal w/a little noise

northcovenorthcove Posts: 49
edited 2008-03-23 03:01 in Propeller 1
I am counting positive edges of a relatively slow TTL signal (<50Hz) generated by an anemometer that probably uses an internal Hall effect transistor. The signal rise time is about 5usec. The signal unfortunately contains a bit of higher-frequency noise (~+/-0.05v) which is easily observed on my scope. My spin code works great but there is sufficient noise in the signal that the propeller's fast edge detection also counts noise edges around the low-hi transition voltage (eg. a bit of noise quickly puts the signal high then low during a true rising edge which increments phsa by 2 instead of 1 since the state comparison happens very quickly.) This effect exaggerates the anemometer's speed by about 5%. A hand-written counter which slowly reads the input <100Hz works but I'd prefer to use CTRA instead. Advice on making CTRA posedge counting not falsely trigger by noise is appreciated!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-18 04:06
    You could use a Schmidt trigger gate as a buffer. You could even add a little RC filtering to the Schmidt trigger input to filter out some of the noise.
  • northcovenorthcove Posts: 49
    edited 2008-03-18 16:31
    Thanks Mike - sounds great, will do.
  • matbmatb Posts: 39
    edited 2008-03-22 13:46
    I posted a few days ago some stuff for a event timing I hope to use for a very similar input, a pulse stream. In my case I expect the sensor can have mechanical alignment problems.
    I want to know if the alignment is bad, and also to correct what I can.

    I use 2 counters, one to simply record the (scaled) edge count, the second in level mode to record the time of the transition. I pre-load the counter value with system counter to allow it to time stamp the transition.

    At the moment I am just using the timestamps for instantaneous speed. The bit I need to do is to keeping a log of recent timestamps and do some calculation to detect impossible accelerations.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-22 14:27
    matb,
    Please start your own thread and include a clear question as part of your "subject". It helps attract attention to your question and it makes it easier for others to find answers to similar problems when they're searching. Your situation with the sensor is something that others may encounter as well and it would be useful for you to describe how you've solved it (when you're done) ... maybe in the Completed Projects forum.
  • LeonLeon Posts: 7,620
    edited 2008-03-22 20:45
    I once had a similar problem with an opto-switch detecting the speed of a IR chopper. I used a Schmidt trigger as Mike has suggested, which cured the problem.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-03-23 03:01
    It's Schmitt.
Sign In or Register to comment.