November 21, 2024, 07:51:42 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Connecting Photoelectric Sensor (Monsterguts) to Prop-1

Started by mnewmanholden, October 14, 2011, 06:53:11 AM

Previous topic - Next topic

mnewmanholden

Hi All,

I am using the Photoelectric Sensor (NPN) from Monsterguts (http://monsterguts.com/index.php?act=viewProd&productId=192) to trigger my prop. I am looking for direction on how to connect the 4 wires (brown, black, whit, blue) to the Prop-1 board.

Any guidance or redirection to documentation would be appreciated.

Thanks!
Mark

JackMan

There's no docs available from your link. Look at the instructions, I would have to say 2 of the wires are for power to the sensor but you'll have to figure out which 2. The other 2 wires look to be configurable for either NO or NC operation. You want NO operation and these 2 wires would connect to R and W of your trigger PIN on the Prop-1 (same as a manual switch as in the docs).

JonnyMac

October 14, 2011, 05:28:10 PM #2 Last Edit: October 19, 2011, 12:26:32 AM by JonnyMac
If you already have the NPN configuration, that's okay.  With four wires I expect that two of them are for device power, the other two are the (optically-coupled?) output. 

Find the power wires; connect the positive side to V+ and the negative side to GND.  Find the sensor outputs; for an NPN device one will be GND and the other will be the NPN output.  Cut one of our 14" connector cables in half; connect the NPN output to the WHITE wire, the ground side of the sensor output circuit to the BLACK wire.  You will plug this into P6 on the Prop-1.

Two more steps: move the P6 SETUP jumper to the UP position and clip off pin 2 of the ULN2803.  This link will help with that:
-- http://www.efx-tek.com/php/smf/index.php?topic=130.0

You must clip off pin 2 of the ULN2803 to prevent it from interfering with the NPN input.

Finally, here's code template that is set for an active-low trigger.


' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = UP


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 0                     ' active-low (NPN) trigger
SYMBOL  TrOff           = 1

SYMBOL  IsOn            = 1                     ' active-high outputs
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = B2                    ' for debounce loop


' -----[ Initialization ]--------------------------------------------------

Power_Up:
  ' put code here that only happens at power-up/hard reset

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs


' -----[ Program Code ]----------------------------------------------------

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

  ' program code here

  GOTO Reset


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

mnewmanholden

Jon,

Many thanks for the detailed info..(as always!). You always have the answer....

I have powered the sensor from the Prop-1 (12v) andf I get 4V between the sensor outputs while the beam is unbroken. (0v when a body breaks the beam.)

Quick question on the info in the link. IT mentions using a ULN2003 or removing pin 1 of the ULN2803. I do have a ULN2003 available that I could use - please confrim that I should stay with the ULN2803 and remove pin 2.

Thanks again!

Mark

bsnut

QuoteQuick question on the info in the link. IT mentions using a ULN2003 or removing pin 1 of the ULN2803. I do have a ULN2003 available that I could use - please confrim that I should stay with the ULN2803 and remove pin 2.
You don't need to remove pin 1 on the ULN2003 at all for what you are trying to do. The only time you need to remove any pins on the ULN2003 is when you plan to use more I/O pins for serial comms (RC-4 or AP-16) and also have a pot connected to the Prop-1. Here is an example what I am talking about for your case when you need to remove any pins on the ULN2003.

Trigger = Pin7 no setup jumper remove
RC-4 serial = Pin6 remove Pin 1 on the ULN2003
Pot = Pin5 remove Pin2 on the ULN2003   
William Stefan
The Basic Stamp Nut

mnewmanholden

Thanks bsnut. Maybe my follow up question was confusing....

Base upon Jon's response and the link that he provided:

I am looking for confirmation on whether to:

1) Use the ULN2003 (per the link)
2) Use ULN2803 with pin 1 removed (per the link)
3) Use ULN2803 with pin 2 removed (per the posted comments)

Also:
In Jon's reply on Oct 14th it states in the comments to "move the P6 SETUP jumper to the UP position"...

...but the code template has the following line

SYMBOL  Trigger         = PIN6                  ' SETUP = DN

Thanks again to all for your time,
Mark

bsnut

Mark,

QuoteMaybe my follow up question was confusing....
Its starting too , but that is ok.
Jon provided you a basic template program for connecting NPN Photoeye to the Prop-1. The link is to show you, that replacing ULN2803 with the ULN2003 is easier to do, because you don't have to remove any pins. That is what the link the Jon is pointing you to.
QuoteIn Jon's reply on Oct 14th it states in the comments to "move the P6 SETUP jumper to the UP position"...

...but the code template has the following line

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
Since you are using NPN sensor, the setup jumper needs to be set in the up position because the Prop-1 is using the pull-down resistor due to the fact that NPN sensors are providing voltage to the Prop-1 pin when the the sensor is not triggered.

Are you planning on using a serial control board like the RC-4 or AP-16+ in your Holloween prop as well as this NPN Photoeye? If you are using RC-4 or AP-16+ then you will need to remove pins on the ULN2803 so that the pull-up resistor in the ULN don't interfer with the serial comms. But if aren't using the RC-4 or AP-16+ then the ULN2003 is the better way to go and it saves you from removing any pins from a ULN2803.
William Stefan
The Basic Stamp Nut

JonnyMac

Believe it or not, I am human and do on occasion make errors.   I corrected the listing above.  We tend to use P6 in the DN position for SETUP; hence the code comment that I forgot to change.
Jon McPhalen
EFX-TEK Hollywood Office

mnewmanholden

Thanks to all for the clarifications and additional info!!!

(Hope I am not being a pain....I am sometimes nervous of damaging the Prop-1 with an incorrect connection/setting.)

I am not using a serial board and so will use the ULN2003.

Will test with Jon's code tonight.

Thanks again!
Mark

mnewmanholden

Hi Jon/bsnut,

I tested the sensor with the following config, as advised:

ULN2003
P6 setup jumper set to UP
P7 setup jumper set to UP (not sure this matters using a ULN2003...)
12V Power to Prop-1 (powering the sensor via V+ and GND)
WHITE and BLACK ouputs from sensor connected to W and B (respectively) on P6

When sensor is triggered nothing happens. The "active" light on the sensor stays on!
When the outputs from the sensor are disconnected from P6, then the "active" light on the sensor will turn off.

If it helps, these are the voltages on the output wires from the sensor:

Beam NOT broken (active light on sensor on): 4V accross the two wires. 4.5V across WHITE and GND(prop-1), 0.5 across BLACK and GDN(prop-1)

Beam broken (active light on sensor off): 0V accross the two wires. 4.5V across WHITE and GND(prop-1), 9.5 across BLACK and GDN(prop-1)

Not sure where to go from here. Any advice appreciated.

Thanks,
Mark

bsnut

Mark,

Your config here is ok since you are using the ULN2003.
QuoteULN2003
P6 setup jumper set to UP
P7 setup jumper set to UP (not sure this matters using a ULN2003...)
12V Power to Prop-1 (powering the sensor via V+ and GND)
WHITE and BLACK ouputs from sensor connected to W and B (respectively) on P6
The only problem that I see now is, that you have your photoeye connected on Pin6 and it's interfering with the ULN pullup resistor. The easier thing to do is connect the photoeye output on Pin7, since the ULN isn't connected on this pin and change the code to match this change.

SYMBOL  Trigger         = PIN7                  ' SETUP = UP, No ULN

Or, you can leave the photoeye connected on Pin6 and bend the pin1 on the ULN2003 out of the way.

Make sure that the photoeye that you are using needs to see its refector, which keeps the trigger light off on the photoeye and this maybe the reason why you are getting the results you are getting.
William Stefan
The Basic Stamp Nut

mnewmanholden

No change when using the PIN7.

I think I need to mark this one down as a bad idea. (Although it's weird that no one has used this sensor with the Prop-1 before...)

I'll move on and see what I can do with a PIR and some PVC.

Thanks!
Mark

bsnut

Can you take a picture of your setup and post it so we can if we miss something. But, if you want to use a PIR that is fine for what you want to do as well.

What, I will do for you is try out your for myself with you code. Can you take a picture of your and
William Stefan
The Basic Stamp Nut

JackMan

 
Quote9.5 across BLACK and GDN(prop-1)

Mark,
    This statement is very odd, any of the "B" pins on the Prop-1 are constant ground so they are the same as the GND terminal, there shouldn't be any voltage present. Is there positive voltage coming from the black wire of the sensor? Check the 2 output wires of the sensor without them connected to the Prop-1 (beam unbroken and beam broken).

JonnyMac

Is it possible to get the part # from the sensor so that we can get a data sheet?  We're flying blind here and that is very dangerous.
Jon McPhalen
EFX-TEK Hollywood Office