Shop OBEX P1 Docs P2 Docs Learn Events
Reading a pin with a very low voltage — Parallax Forums

Reading a pin with a very low voltage

ryfitzger227ryfitzger227 Posts: 99
edited 2013-09-24 10:58 in BASIC Stamp
Hello everyone!

I've been working with the propeller the last couple of months, but something came up that I need to fix and it would be much simpler to just use a Stamp. This is very simple. All I need the stamp to do is wait for a pin to become high (=1) and then set another pin high to light an LED. The only problem I'm having is the stamp reading the input pin from the computer. When you say DEBUG ? IN0 it will equal zero (because it's connected to ground through a 10K pull-up resistor) but it won't equal 1 when it's supposed to (when the computer sends a short pulse of power). What's happening is the computer that is sending a short pulse of +5VDC is 725ft away. When I stuck a meter on the wire it measured anywhere from .3 volts to .7 volts. The first question I'm asking is that enough for the stamp to pick up? If not, how could I make it work? If you have any questions, just ask.

- Ryan

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2013-09-24 08:13
    Is your ground connected? That voltage seems really low.... Even at 1000 feet, a 22 gauge wire will only have about 16.14 Ohms of resistance. What is the duration of the pulse?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-09-24 08:27
    First of all, your meter averages what it sees, so a meter reading of 0.3V to 0.7V is not unexpected since that's the average voltage over a period of time (1/2 second more or less). 725ft is a bit far to send a 5V pulse. It will get very distorted over that distance and will be subject to noise pickup. You'd be much better off using RS232 voltage levels to send this pulse. There are conversion ICs like the MAX232 that can translate voltage levels back and forth.

    This might work (not well though) if you make the 5V pulse long enough ... a sizeable fraction of a second would be best.
  • ryfitzger227ryfitzger227 Posts: 99
    edited 2013-09-24 09:11
    I can't do anything to the computer. The old system had a voltage comparator and 2 555 timers working as a one shot. The way it worked is that it was monitoring 2 different pins. Which ever one had the highest voltage (0 vs .5 for example) it would set the one 555 timer high which in turn would light the led for about 8 seconds. Using a microcontroller for this would be so much easier in my opinion, so that's what I'm trying to do. I just can't get the stamp to see that one of those pins equals 1. I am connecting the ground. Do you think that it's just the stamp can't pick it up because of the low voltage? Will the propeller do any better?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2013-09-24 09:28
    "The old system had a voltage comparator ... . The way it worked is that it was monitoring 2 different pins..." - This sounds like a crude differential signaling. Is there anyway on the computer side to make sure that the two pins that are monitored are 180 Deg out of phase?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-09-24 09:30
    Maybe a bit more information would help about what's connected to what. What part of the old system are you keeping? What's actually connected to the Stamp over the long cable? Both the Stamp and the Propeller have digital I/O pins, not analog. These have a fixed threshold, roughly Vcc/2. Both the Propeller and the Stamp can measure analog voltages using a few external passive components although the Stamp is relatively slow at that. Look at the RCTIME statement and this webpage for Stamp information on this. The BS2px does have a built-in voltage comparator if that's what you'll need.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-09-24 10:12
    If the remote system provides a differential output, you can still use a comparator ahead of the BASIC Stamp. I would be more inclined, however, to isolate the two systems using an optocoupler. It will help you to avoid ground loops and other nasties that long cables can entail:

    attachment.php?attachmentid=104060&d=1380042668

    The input from the remote system could be signal and ground, as shown above. Or, in the case of differential signalling, the two signal lines.

    -Phil
    560 x 186 - 3K
  • ercoerco Posts: 20,257
    edited 2013-09-24 10:41
    How old the "the old system"?

    When in doubt, carefully check all conductors in your 725 feet of old wire. They may not be the continuous pieces of shiny copper wire that they used to be. Broken strands of wire, high resistance connections, rats chewing on wire insulation, sun/weather damage, all takes its toll after a few years. I'd bet that merely replacing the wire will improve system performance considerably. If possible, replace with shielded cable and ground the shield.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-09-24 10:55
    erco wrote:
    If possible, replace with shielded cable and ground the shield. ...
    ... at one end only. If you do this, use a separate conductor for the ground return, not the shield itself.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2013-09-24 10:58
    Good point Phil (reference post #7). It might also be true that the computer is already providing an isolation to ground, therefore when trying to measure the voltage on a single pin with reference to 'ground' you might be getting a false reading. In that case, BOTH pins are required to detect the signal in a differential manor.
Sign In or Register to comment.