Shop OBEX P1 Docs P2 Docs Learn Events
sensing 5 volts from an infrared sensor ( 0 or 5 volts DC ) — Parallax Forums

sensing 5 volts from an infrared sensor ( 0 or 5 volts DC )

ArchiverArchiver Posts: 46,084
edited 2004-05-23 20:42 in General Discussion
first you need to set the direction of the I/O pin that the sensor is
connected to be an input. Then check with the condition of the pin and
take appropriate action.

Sensor pin 0 ' infrared sensor connected to pin 0
input Sensor ' set pin 0 to input

MAIN:
DO
ON Sensor GOSUB Speaker_on, Speaker_off
LOOP

Speaker_On:
' speaker on code here
return

Speaker_Off:
' speaker off code here
return



At 10:45 PM 5/22/2004, you wrote:
>Hi,,
>
>I need to sense 0 or 5 volts dc from a sensor.
>Somebody knows an Stamp command for this?
>
>I need an alarm,
>If sensor is sending +5 then speaker sounds
>if sensor is sending 0 then speaker off.
>
>Help please: Joe
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Domains * Claim yours for only $14.70/year
>http://smallbusiness.promotions.yahoo.com/offer
>
>
>
>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.
>
>Yahoo! Groups Links
>
>
>
>

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-05-23 14:19
    I didn't see your requirements at the bottom of your email. to have the
    speaker turn on at +5V then we need to reverse the order of the gosub
    statements

    ON Sensor GOSUB Speaker_Off, Speaker_On

    At 08:12 AM 5/23/2004, you wrote:

    >first you need to set the direction of the I/O pin that the sensor is
    >connected to be an input. Then check with the condition of the pin and
    >take appropriate action.
    >
    >Sensor pin 0 ' infrared sensor connected to pin 0
    >input Sensor ' set pin 0 to input
    >
    >MAIN:
    >DO
    > ON Sensor GOSUB Speaker_on, Speaker_off
    >LOOP
    >
    >Speaker_On:
    > ' speaker on code here
    > return
    >
    >Speaker_Off:
    > ' speaker off code here
    > return
    >
    >
    >
    >At 10:45 PM 5/22/2004, you wrote:
    > >Hi,,
    > >
    > >I need to sense 0 or 5 volts dc from a sensor.
    > >Somebody knows an Stamp command for this?
    > >
    > >I need an alarm,
    > >If sensor is sending +5 then speaker sounds
    > >if sensor is sending 0 then speaker off.
    > >
    > >Help please: Joe
    > >
    > >
    > >
    > >
    > >__________________________________
    > >Do you Yahoo!?
    > >Yahoo! Domains * Claim yours for only $14.70/year
    > >http://smallbusiness.promotions.yahoo.com/offer
    > >
    > >
    > >
    > >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.
    > >
    > >Yahoo! Groups Links
    > >
    > >
    > >
    > >
    >
    >
    >
    >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.
    >
    >Yahoo! Groups Links
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-23 15:28
    Daryl,

    Without seeing a schematic this solution is not 100% guaranteed to work, but
    you should be able to make it work by simply connecting the grounds together
    of the separate power supplies.

    ===========================
    Thanks,

    The problem I have is that the sensor has a separate
    power supply.
    I have used an infrared sensor from parallax powered
    by the basic stamp VDD and now the sensor is powered
    by an external power supply.

    Is it necesary a kind of optocouple or I need the
    basic stamp only ?

    Thanks, Daryl


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-23 17:48
    Thanks,

    The problem I have is that the sensor has a separate
    power supply.
    I have used an infrared sensor from parallax powered
    by the basic stamp VDD and now the sensor is powered
    by an external power supply.

    Is it necesary a kind of optocouple or I need the
    basic stamp only ?

    Thanks, Daryl

    --- Daryl Berryhill <djberry@h...> wrote:
    > I didn't see your requirements at the bottom of your
    > email. to have the
    > speaker turn on at +5V then we need to reverse the
    > order of the gosub
    > statements
    >
    > ON Sensor GOSUB Speaker_Off, Speaker_On
    >
    > At 08:12 AM 5/23/2004, you wrote:
    >
    > >first you need to set the direction of the I/O pin
    > that the sensor is
    > >connected to be an input. Then check with the
    > condition of the pin and
    > >take appropriate action.
    > >
    > >Sensor pin 0 ' infrared sensor
    > connected to pin 0
    > >input Sensor ' set pin 0 to input
    > >
    > >MAIN:
    > >DO
    > > ON Sensor GOSUB Speaker_on, Speaker_off
    > >LOOP
    > >
    > >Speaker_On:
    > > ' speaker on code here
    > > return
    > >
    > >Speaker_Off:
    > > ' speaker off code here
    > > return
    > >
    > >
    > >
    > >At 10:45 PM 5/22/2004, you wrote:
    > > >Hi,,
    > > >
    > > >I need to sense 0 or 5 volts dc from a sensor.
    > > >Somebody knows an Stamp command for this?
    > > >
    > > >I need an alarm,
    > > >If sensor is sending +5 then speaker sounds
    > > >if sensor is sending 0 then speaker off.
    > > >
    > > >Help please: Joe
    > > >
    > > >
    > > >
    > > >
    > > >__________________________________
    > > >Do you Yahoo!?
    > > >Yahoo! Domains * Claim yours for only $14.70/year
    > > >http://smallbusiness.promotions.yahoo.com/offer
    > > >
    > > >
    > > >
    > > >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.
    > > >
    > > >Yahoo! Groups Links
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    > >
    > >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.
    > >
    > >Yahoo! Groups Links
    > >
    > >
    > >
    > >
    >
    >
    >
    > 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.
    >
    > Yahoo! Groups Links
    >
    >
    > basicstamps-unsubscribe@yahoogroups.com
    >
    >
    >





    __________________________________
    Do you Yahoo!?
    Yahoo! Domains – Claim yours for only $14.70/year
    http://smallbusiness.promotions.yahoo.com/offer
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-23 20:42
    that is absolutely correct. everything, BS, IR sensor, needs to have the
    common grounds connected together. no an opto-coupler probably won't be
    necessary. However, since its two separate supplies, you may need around a
    1K ohm or so currently limiting resistor in series with the I/O line and
    sensor. It also depends on how far the sensor is from the stamp. For the
    most part, The stamp I/O lines are pretty fault tolerate up to 5V but I
    tend to use a series resistor anyway just to be on the safe side.


    At 01:28 PM 5/23/2004, you wrote:
    >Daryl,
    >
    >Without seeing a schematic this solution is not 100% guaranteed to work, but
    >you should be able to make it work by simply connecting the grounds together
    >of the separate power supplies.
    >
    >===========================
    >Thanks,
    >
    >The problem I have is that the sensor has a separate
    >power supply.
    >I have used an infrared sensor from parallax powered
    >by the basic stamp VDD and now the sensor is powered
    >by an external power supply.
    >
    >Is it necesary a kind of optocouple or I need the
    >basic stamp only ?
    >
    >Thanks, Daryl
Sign In or Register to comment.