No announcement yet.

Interuptor to PIC

  • Filter
  • Time
  • Show
Clear All
new posts

  • Interuptor to PIC

    Using PBP3. I have a photo-interuptor PM-45 (attached data sheet) using the 'black' wire ('light-on'). I'm trying to interface to the PIC and I can't figure out proper output to the PIC's input to get the proper on signal to the micro.
    The 'load' is connected to +V and 'out' of the sensor.
    I hooked it up to power and used a meter on the load/V+. That works fine.
    Is a transistor necessary before the PIC input pin to interface?
    I'm using the PIC16F1823.

  • #2
    You don't say if you have pnp or npn version but either way a pull up/down resistor is necessary for the selected output
    Attached Files


    • #3
      Thanks Richard. I was thinking on those lines but unsure. Mine is the NPN version.


      • #4
        Just watch the power supply to the sensors. I see that they are able to be powered by 5 > 24 volts. Make sure that the sensors are powered by the same supply as the PIC.
        Dave Purola,


        • #5
          Thanks David. Yes they share the same power supply as the PIC at 5 volts.


          • #6
            So in the same vein, the sensor is output to the PIC and the PIC in turn is outputting to a solid-state-relay in my circuit. My relay is the G3VM-31ER(TR05). On page 2 of the data sheet (attached), I am using connection 'A'.
            On page 3 we see a schematic and turn-on and turn-off times. Is this using the same idea of a pullup as in the sensor? The relay out is working with a different voltage than the sensor and rest of circuit (12 V). If indeed this is a pull-up I need, I assume it would go to the 12V supply, yes?

            Last edited by Keith55555; 6 days ago.


            • #7
              If indeed this is a pull-up I need, I assume it would go to the 12V supply, yes?
              no way

              the input to the device is a led diode , with a forward voltage of 1.18 to 1.48 volts typ 1.33v
              to turn the dev on the led needs a current of 5 to 25 mA typ 10 mA
              a series resistance is employed to limit the led current to this range when energized by your triggering device
              r = (v trigger - v diode) / current
              ie r = (5v - 1.48 )/ 10mA = 352 ohms
              Last edited by richard; 6 days ago.


              • #8
                Yeah, I got that calculated and covered. I'm confused by the output. It doesn't look like it emulates a mechanical relay whereby you have an open circuit and then a closed circuit (or visa versa). I'm using pin 4 and pin 6. I'm using it for DC. Looks like 4 is ground and then there's half the load on 6 and power between the two. Don't get it.


                • #9
                  I'm using pin 4 and pin 6. I'm using it for DC.

                  that's mode A the least optimum for dc loads

                  mode A is ac/dc and is not polarity conscious, has highest "contact" resistance
                  mode B is polarity conscious, has lower "contact" resistance
                  mode C would have the lowest switching loss for a dc load ie. least "contact" resistance, but it is polarity conscious

                  the input and output are optically isolated


                  • #10
                    Yes, I chose the AC alternative for a reason and can tolerate the 'on' ohm-age. My real question was did the output behave as a mechanical relay behaves (interrupt a circuit with the output pins and have it 'close' once the LED was activated). I decided to bite the bullet (I initially was fearful of damaging the output) and do just that with a simple LED circuit turning the relay on and off with the PIC. Happily, it does behave the way expected. Thank you.