Shop OBEX P1 Docs P2 Docs Learn Events
proximity sensor problem — Parallax Forums

proximity sensor problem

AHMET AKSUAHMET AKSU Posts: 62
edited 2007-03-29 13:58 in Propeller 1
·


··· I use proximity sensor for producing count pulses topropeller.I use· resistance and diode for· interface proximity to the propeller


·the problem is that same times sensor produce 2 or 3 pulse for one thing.I using for counting that code


CON
········ Sensor = 4····· 'Sensor pin number
······· _clkmode······· = xtal1 + pll16x
······· _xinfreq······· = 5_000_000
VAR
······· long· count
·······
OBJ
······· term··· : "vga_text"
·······

PUB start | i
· 'start the tv terminal
· term.start(16)
·
· 'setup Counter A for positive edge counting on Sensor pin
· phsa := 0
· frqa := 1
· ctra := %01010 << 26 + Sensor
·
·repeat······················
··· term.str(string($A,12,$B,1))
··· term.dec (phsa)

Comments

  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-03-29 12:17
    Hi,

    Those sensors usually have rather long transition times when going from low to high or vice versa. Times like several microseconds are not unusual. Considering that the Prop counter can increment 80 times in a microsecond and that there's always noise on the signal, it is probable that you count noise during the transition through the threshold voltage, which I only a few minutes ago found to be around 47 % of Vdd - i.e. 1.55 V, At least on my board. There doesn't seem to be any hysterisis on the inputs.

    Two solutions: 1 A hardware Schmitt trigger 2 A software solution. Do the counting in Spin instead of using the very fast counter. Spin code takes something like nx10 microseconds to execute one instruction so a loop counting your input will never see more than one transition.
  • AHMET AKSUAHMET AKSU Posts: 62
    edited 2007-03-29 12:23
    thanks skogsgurra I want to use a schmitt triger .my sensor is pnp do you know how can I make hardware solution
  • SkogsgurraSkogsgurra Posts: 231
    edited 2007-03-29 13:38
    PNP means that you are sourcing from the positive supply. So your input voltage will probably be +12 or +24 or some other "industrial voltage".

    Your question, as you put it now, makes me wonder if you are running without any load resistor between sensor outout and Vss. A simple solution, that I think you should try first is to load the sensor output with a resistor to ground. Make it pull as much current as it can take - if 12 V supply voltage, a 400 mW resistor can handle 33 mA. So, if you make the resistor 390 ohms, you will be safe. If you have 24 V you will need to make the resistor 1500 ohms.

    Try that first. I assume that you have the necessary series resistor (around 10 kohms) to protect the Prop input.

    If that doesn't help, put the schmitt between sensor signal and Prop. Remember that the schmitt also needs a series resistor. But the Prop doesn't need it if you are using a TTL/5V CMOS schmitt. Also, the schmitt usually inverts your signal. You may need to count the other edge.
  • AHMET AKSUAHMET AKSU Posts: 62
    edited 2007-03-29 13:58
    actualy I m using zener diode and resistor for nonverting 12v signal which came from sensor to 3.3 v but I need that how can I clean the signal of sensor can you send me abaut schimit triger how can ı do it
Sign In or Register to comment.