Opto sensor for triggering
Archiver
Posts: 46,084
Hello to all.
I'm looking for some shoulders to stand on regarding circuitry to trigger
actions based on an optical sensor.
Should be similar to a revolution counter but it won't count the turns but act
any time the machinery does a revolution.
Also code to read the pulse would be useful
Many thanks in advance and regards.
I'm looking for some shoulders to stand on regarding circuitry to trigger
actions based on an optical sensor.
Should be similar to a revolution counter but it won't count the turns but act
any time the machinery does a revolution.
Also code to read the pulse would be useful
Many thanks in advance and regards.
Comments
and pull low when active. Then read the input pin on the stamp with the
'button' command and jump to whatever routine necessary to do whatever you
want to do.
Original Message
From: Pablo Roufogalis L. [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=0q_5Rpmxty3HYym-L1p6mVhnPJzoOfN1F1onDuQIMZQmcpdp8Q19106_fDUaxu3L1KgbYSTcIYZ7]proufo@c...[/url
Sent: Sunday, March 09, 2003 12:49 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Opto sensor for triggering
Hello to all.
I'm looking for some shoulders to stand on regarding circuitry to trigger
actions based on an optical sensor.
Should be similar to a revolution counter but it won't count the turns but
act any time the machinery does a revolution.
Also code to read the pulse would be useful
Many thanks in advance and regards.
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> Just set up the sensor you are using to pull the pin high when not active
> and pull low when active. Then read the input pin on the stamp with the
> 'button' command and jump to whatever routine necessary to do whatever you
> want to do.
Hello Jim and thanks for your reply.
Is there a circuit for this available somewhere? As far as I understand, just
the pulse from the sensor directly to the pin is not enough.
I have plenty of time between pulses, about 1.3 seconds.
Totally new to most of this stuff.
Thanks in advance.
Just select the pin on the stamp you want to use as an input and connect a
resistor (4.7K to 10K) between the pin and the supply positive (+5v). This
will hold the pin high. Then connect the sensor to the same pin and when
the sensor triggers, it pulls the voltage down through the resistor to near
ground. Set up your code to look for a low on the pin and you have detected
the sensor action.
Jim
some code of a similar application:
'{$STAMP BS2}
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
cwbut var byte 'cw limit switch
ccwbut var byte 'ccw limit switch
'Program written by J. Forkin, 2-27-03 for motor control
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
gosub initial
initial:
high 15 'set ctrl1 off [noparse][[/noparse]inverse logic]
low 8 'set ctrl6 on [noparse][[/noparse]inverse logic]
low 10 'set ctrl5 off
high 13 'set ctrl2 on
gosub clockwise
return
clockwise: 'makes both motors rotate clockwise
loop:
button 0,0,255,250,cwbut,0,nopresscw
low 13 'set ctrl2 off
high 10 'set ctrl5 on
high 8 'set ctrl6 off [noparse][[/noparse]inverse logic]
low 15 'set ctrl1 on [noparse][[/noparse]inverse logic]
nopresscw:
goto loop1 'looks for other limit switch
return
countercw: 'makes both motors rotate countercw
loop1:
button 2,0,255,250,ccwbut,0,nopressccw
high 15 'set ctrl1 off [noparse][[/noparse]inverse logic]
low 8 'set ctrl6 on [noparse][[/noparse]inverse logic]
low 10 'set ctrl5 off
high 13 'set ctrl2 on
nopressccw:
goto loop 'looks for other limit switch
return
Original Message
From: Pablo Roufogalis L. [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=6JMSy3tZwB4twB1bh_Nh1fJ6yFIdpGyqhHVRdXE28A7j1r5KP3w7sCvLKwBl9Oa8n0NjChPB7F7XMw]proufo@c...[/url
Sent: Monday, March 10, 2003 11:25 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: Opto sensor for triggering
--- In basicstamps@yahoogroups.com, "Jim Forkin" <jjf@p...> wrote:
> Just set up the sensor you are using to pull the pin high when not active
> and pull low when active. Then read the input pin on the stamp with the
> 'button' command and jump to whatever routine necessary to do whatever you
> want to do.
Hello Jim and thanks for your reply.
Is there a circuit for this available somewhere? As far as I understand,
just the pulse from the sensor directly to the pin is not enough.
I have plenty of time between pulses, about 1.3 seconds.
Totally new to most of this stuff.
Thanks in advance.
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> some code of a similar application:
Thanks again Jim.