Shop OBEX P1 Docs P2 Docs Learn Events
5V sensors and circuits — Parallax Forums

5V sensors and circuits

What is the Pin tolerance when using 5v sensors?
Is 10k ohm pull ups still acceptable?

Comments

  • kwinnkwinn Posts: 8,697
    If you have a 5V signal going into a Prop pin you need a series resistor (between the signal source and the Prop pin) Typically a 3.9K to 10K resistor. If the signal is very short/fast a small capacitor in parallel with the resistor may be needed.
  • If you have an open-collector/drain type device, then a pull-up to 5V is okay -- keep this in the same range suggested by Kwinn (3.9k to 10K). Note that this is based on limiting the current through the pin protection diodes. What we don't know is the current specification of those diodes for the P2, so these are the P1 values.
  • RaymanRayman Posts: 13,850
    edited 2020-11-20 02:42
    I'm curious... What kind of sensors are there that produce a 5V only analog output?
    I imagine these would be for the old Arduino boards (?). But, (and I'm not an expert) it seems like a lot of the new Arduino boards are 3.3 V I/O...

    Or, maybe this is a sensor for Basic Stamp?
  • jmgjmg Posts: 15,144
    bambino69 wrote: »
    What is the Pin tolerance when using 5v sensors?
    Is 10k ohm pull ups still acceptable?

    What sensors exactly ?

    Open collector digital output sensors can use internal P2 programmable pullups, if you want a very low parts count.
    10k is ok for moderate speeds, but 1k would be used for faster uses.

    CMOS drive 5V Logic outputs would need a series resistor to tolerate the 5V drive into P2's 3v3 clamping diodes.

    Analog 0-5V sensors would need divider resistors to give 0~3v3 change at the P2 pins. A decoupling cap may be added for noise filtering.
  • Open collector digital output sensors can use internal P2 programmable pullups, if you want a very low parts count.
    Good point -- I still have to think about them being available.
  • Maybe sensors was poor choice. Devices in general.
    As I go forward I am going to want to hook devices up to the P2. Like moths to a flame.
    Ping, RFID, Pir, DHT11, DS1620, etc
    Just curious about the pins tolerance so that I can confidently breadboard a circuit with any device I run across that require 5v.
  • RaymanRayman Posts: 13,850
    edited 2020-11-20 14:56
    Ok, well for digital signals, it's pretty much the same as P1... Just put a 3.3k .. 10k resistor between P2 I/O pin and 5V signal.

    For analog signals, it's more complicated. We now have ADC in every pin, so don't have to do delta-sigma using 2 pins and external resistors anymore, like P1.
    But, how to interface depends on (at least) the output impedance of the device.

    If it's a strong signal with low impedance, like the voltage of a battery, you can just use a voltage divider with two resistors (one from P2 pin to ground and one from P2 pin and signal).
    If it's a weak signal, you may need to do something more complicated, like a buffer amp, between signal and P2 pin.

    Update: Corrected lower resistor limit, thanks @Wuerfel_21
  • Wuerfel_21Wuerfel_21 Posts: 4,448
    edited 2020-11-20 14:29
    Rayman wrote: »
    Ok, well for digital signals, it's pretty much the same as P1... Just put a 1k .. 10k resistor between P2 I/O pin and 5V signal.

    As recently mentioned in another thread, 3.3kΩ is the smallest spec-compliant resistor if the clamp diodes are to be subjected to no more than 500µA.
  • Thank you Rayman.

    Anybody know how much a pin can sink in these situations?
  • thanks Wuerfel,
    Didn't see your post quick enough
  • 3.3kΩ is the smallest spec-compliant resistor if the clamp diodes are to be subjected to no more than 500µA.

    In the other threads I read 50 mA to be the max on a pin?
    .5 mA seems a little conservative.
  • RaymanRayman Posts: 13,850
    edited 2020-11-20 14:57
    The 500uA is for the clamp diodes, not the regular output current.
    The clamp diodes protect the pin from over or under voltage situations...

    I think you could get away with 1kOhm, but I don't want to give bad advise, so I'll correct my earlier post...
    I think I've always used 10kOhm when I've done this...
  • So 50 mA @ 3.3v, but overvoltage needs limited to .5 mA.
  • RaymanRayman Posts: 13,850
    I don't know why this info isn't in the documentation... That a bad oversight...
    I just added a comment on this to the docs...

    50 mA is kind of a lot. You probably can't do that on all the pins, but again, the total current limit should be in the docs too (but probably isn't yet).
  • jmgjmg Posts: 15,144
    Rayman wrote: »
    The 500uA is for the clamp diodes, not the regular output current.
    The clamp diodes protect the pin from over or under voltage situations...

    I think you could get away with 1kOhm, but I don't want to give bad advise, so I'll correct my earlier post...
    I think I've always used 10kOhm when I've done this...

    The other risk element with clamp resistors, is they will try to elevate the 3v3 rail. Most 3v3 regulators do not sink current.
    During P2 reset, the P2 current is quite low, so many 5V drivers being clamped, could elevate the 3v3 rails to damage levels.

    Regulators for DDR use can source and sink, but they tend to all use an external reference, so are not a one-part solution.

    I guess a 3v3 regulator could be used for some P2 (boot) pins and DDR-reg(s) used for those pins where many might encounter 5V sourcing drive.
  • I went back and read that post about 50mA again and realized it had taken me to a propeller 1 thread.
    I guess I'll just wait for something to get put in the Docs.
Sign In or Register to comment.