Shop OBEX P1 Docs P2 Docs Learn Events
Input impedence of ports (pins) of BS2 — Parallax Forums

Input impedence of ports (pins) of BS2

po2lepo2le Posts: 76
edited 2008-10-13 06:22 in BASIC Stamp
I have a Basic Stamp Homework Board with a BS2.· Can anyone tell me what the imput impedence of the pins are?· (The input/output pins 0-15)

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-10-10 07:33
    The BS2 uses the Microchip PIC16F57 controller IC. Check out that device's datasheet for the info you seek.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-10-10 12:16
    About 10 Megohms. But do check the PIC datasheet at www.microchip.com
  • davejamesdavejames Posts: 4,047
    edited 2008-10-10 18:43
    ...errrrrr, how can you get 25mA through 10Mohm with 5V?

    DJ
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2008-10-10 18:58
    The input impedance is more like a small capacitor of a few picofarads. It is the gate of a CMOS transistor. There is also a leakage current through the substrate diodes, but at room temperature that will be on the order of low picoamps. For most practical purposes, the input resistance is infinite. If you attach a 0.1 uF capacitor charged to 5 volts to a Stamp input pin, it will retain its charge for minutes provided of course that there are not external leakage paths. The leakage current increases with temperature. At high temperatures (85 degrees Celsius) the leakage current may go as high as one microamp, according to the data sheet.

    >> ...errrrrr, how can you get 25mA through 10Mohm with 5V?

    The input impedance is in parallel with the input, not in series. The output impedance of the PIC is around 60 ohms for low currents.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • davejamesdavejames Posts: 4,047
    edited 2008-10-10 19:16
    So the data sheet lists 25mA source/sink for the I/O pins.· Are you saying that in Input mode, the impedance is 10Mohm?· And since impedance is frequency dependant, at what frequency does this 10Mohm occur?

    DJ
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2008-10-10 21:38
    The 25mA for souce/sink is a limit not to be exceeded for individual pins, and there are also separate limits for groups of pins. The pins should not be short circuited to the supplies or to one another, because they can source or sink more than their safe limits.

    As to input impedance, I don't think it is 10 MΩ. That came from an earlier question. The input resistance is practically infinite, and the leakage current is also very low, unless the input moves out of the 0 to 5 volt input range or the temperature is very high. The leakage current is usually modeled as a current source/sink, not a a resistance, because is obeys I=constant more closely than I=V/R. As for the reactive part of the input impedance, suppose the input capacitance is 10pF. Its Xc would become 10 MΩ at an input frequency of around 1600 Hz. That would only be an issue if you happened to be driving the input at that frequency from a device with a very high output impedance. For example, pH probes have a very high output impedance which can exceed 10 or even 100 MΩ, but things like that are not done at 1600 Hz. Any current into the input pin has to charge and discharge that 10pF capacitor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • po2lepo2le Posts: 76
    edited 2008-10-10 22:25
    In other words, the pins are considered a current source, which means I would need to dig out a EE ckts. analysis book, which I haven't looked at for many years.
    I can deliver a neg. pulse to the input port of about 1.4v neg. (I'm working on getting it pos.), but when I apply the pulses to the port, the pulse volts drop to less than half a volt. Since I'm trying to use the BS2 to count pulses, those low voltage pulses are not detected and counted. Vas ist los?

    If I can draw the circuitry, then show it on here, I'll give it a try.
    po2l
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2008-10-10 23:25
    po2le, I don't think you need to dig into EE circuit analysis on account of the Stamp's input current and capacitance. Really the point of what I was trying to say is that they are very small effects. The Stamp pin as an input for most purposes is simply a perfect voltmeter monitoring the voltage you apply to the pin.

    However, there is probably something about your circuit that is not right. Please do draw out your circuit and explain the goal and the source of the pulses. When you say, "1.4 volt negative pulse" that could mean a couple of different things, like, going from 5 volts down to 3.6 volts, or, from zero volts down to -1.4 volts, or.....? When you say the pulses drop to less than half a volt, that immediately brings to mind the characteristic drop across a diode. Vas ist? The voltage seen by the Stamp has to cross its 1.4 volt threshold.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-10-11 18:01
    DaveJames, the 25 mA figure is for the pin as an Output. It can Output High, in which case it can 'source' 25 mA out of the pin. It can Output Low, in which case it's connecting the output pin to ground, and can 'sink' 25 mA into the pin from the external circuit.

    An LED circuit makes the best example here. If you connect the 'other' end of the LED (with current limiting resistor) to 'ground', then you need to Output a High to turn on the LED, and current flows from the I/O pin to the LED/resistor, to ground.

    If you connect the 'other' end of the LED/resistor to Vdd, you need to Output a Low to turn on the LED. In this case, current flows from Vdd through the LED/resistor INTO the Output pin. This doesn't make the pin an "Input", this means it's sinking that current.

    When you do set up the I/O pin as an INPUT, then the output drivers are disabled, and what you have is an Input with very high impedance (10 Megohms) which can be used to 'sense' what voltage some other device is putting on that pin.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-10-11 18:17
    Thats a good explanation to me as a hobbyist allanlane5, other parts of the discussion are over my head and I wonder if they really matter, maybe a day will come when it does freaked.gif

    thanks

    Jeff T.
  • po2lepo2le Posts: 76
    edited 2008-10-12 01:25
    Thanks all. Its coming to me, slowly. I need to rethink what I'm doing with the ckts. that I'm trying to use. Since the original pulses go from a positive (12v) to ground for about five milliseconds, then back to +12 for a varying amount of time (12 - 18 msec), they could just as well be considered positive pulses. I was concerning myself with the negetive portion, which only goes to ground. However the positive portion has a distortion, at the top of the pulse, just after it rises from 0v to 12v, that I need to cut off. The distortion actually bounces above 12v for about 2 msec, then comes back down to 12. The pulses are from the ignition of a motorcycle, at the ( - ) end of the primary to the ignition coil. (the same point from which the electronic tachometer is fed).

    po2l
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-12 01:40
    If you're not using 5V logic levels (as it sounds), you're in risky territory. The Stamps do have protective diodes on the I/O pins which will clamp voltages greater than +5V to the +5V supply line and voltages below ground to the ground line, but, if these out of range voltages are sustained at all or have much energy available, they can destroy your Stamp. You need to have a series resistor that would limit any "fault current" to a few milliAmps. For something on the order of 12V, a 4.7K or 10K resistor is a good choice. Since the I/O pin input impedance is several orders of magnitude higher, this extra resistance won't affect normal input I/O pin functioning.
  • po2lepo2le Posts: 76
    edited 2008-10-12 04:13
    I'm using a volt divider to bring the 12v down to 4v or less. I'm being careful not to exceed the five volt level. Most of the ckts. that I'm using are experimental ckts. in house, which are powered by batteries of 9v or less with the voltages applied to the stamp being less than 4v. I experiment with ckts. in house to see if I can get one to work with my motorcycle ignition. (counting pulses from he mc ignition) I've tried a few different ckts., but haven't found one that works satisfactorily.

    The only time that I come off of a twelve volt system is when I actually connect to the motorcycle ignition, but from that I use the voltage divider, which is comprised of somewhat large resistances (series 220k and 110k to gnd), and reading across the 110k. I was advised to use this type of divider by a motorcycle mechanic/advisor who is also an electronic hobbyist. I'm concerned that using less resistance in the divider will possibly put too much load on the electronic ignition. However, I might be wrong about that also. I had a 5.1v zener diode across the output of the divider, but the high resistance of the divider wouldn't allow enough current into the zener to make it operable. And I think the high resistances also cause problems further down the line with other ckts that I tried using to clean up the ignition output pulses.

    A problem with the ignition pulses is "ringing" (if that term is still used) at the top of the positive portion of the output pulses. The 'pulses' go from 12v to 0v (gnd) for about 5 msecs, then back up to 12v for about 12 to 18 msecs, depending on RPM. When the pulse rises back to 12v, it shoots past 12v with a short peak of about 2msecs, then back to 12. Its a
    'bouncing' short peak. This causes problems with the COUNT routine of the stamp; too many inconsistant counts.

    I kept trying to use the negative going portion of the pulses, since they are flat bottomed and square, but have been mostly unsuccessful. Schmitt trigger worked so-so, a monostable MV sometimes worked; mostly not. I think that I will have to go with the pos. portion; I'm going to try a clipper ckt. I found a ckt, in house, to use that somewhat simulates the ignition pulses. If I can get that system to work, maybe I'll have half a chance of getting the mc ignition pulses to work. I'm an old retired guy with time to spend on a hobby that I find quite interesting.

    Thanks for the help and information
    Pat
  • Dave-WDave-W Posts: 94
    edited 2008-10-12 15:32
    Hello Pat,

    Why can't you use a level shifter to change the 12 volt into a 5 volt max signal. You only have to measure the time it is high or low. Attached is a quick method to achieve this change.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave W.
  • po2lepo2le Posts: 76
    edited 2008-10-12 16:26
    Thanks Dave-W, I shall give it a try.

    Pat
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2008-10-12 21:21
    The zener across the output of the divider is still a good idea. It normally won't activate, but it is extra insurance against over voltage spikes. A 3.9 or 4.7 volt zener would also be okay. Also, there should be a capacitor in parallel with the output of the voltage divider. Since the pulses are around 5 milliseconds low and 18 milliseconds high, the time constant should be less than 1 millisecond. With the 220k/110k voltage divider, that would mean a capacitor of around 0.001 or 0.005 uF. The capacitor is there to suppress the "ringing" and also to help the circuit avoid noise that might come in the form of electromagnetic fields. Keep the RC voltage divider output close to the pin and avoid large pickup loops!
    The transistor circuit that Dave-W suggested is good. A 0.001uF capacitor in parallel with the Stamp input pin where it joins the output of the transistor could help with noise rejection. The Stamp pin has to have a very clean waveform to COUNT accurately.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • davejamesdavejames Posts: 4,047
    edited 2008-10-13 05:04
    AlanLane5,

    "When you do set up the I/O pin as an INPUT, then the output drivers are disabled..." - gotcha, understood.

    DJ
  • po2lepo2le Posts: 76
    edited 2008-10-13 06:22
    Thank you, Tracy. Valuable information.

    Pat
Sign In or Register to comment.