Shop OBEX P1 Docs P2 Docs Learn Events
Testing a circuit — Parallax Forums

Testing a circuit

Dr.NoDr.No Posts: 60
edited 2008-08-02 02:04 in BASIC Stamp
I'm using a BS2 to test when a an external circuit is running or not.

The circuit carries 5VDC (+)and is hooked up to the IN1 (pin1) via a 220 resistor
To complete the connection the (-) circuit is grounded to the Vss (Homework board).

Everything works except I'm not picking up any 1s on the IN1 except 0s.

If anyone can give an help, I would greatly appreciate it.

Thanks.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-07-30 03:17
    Could we see your code?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-30 03:20
    Of course the other possibility is that the external circuit is not in fact carrying +5V to the Stamp I/O pin via the 220 Ohm resistor. Have you measured the voltage at pin 1?
  • Dr.NoDr.No Posts: 60
    edited 2008-07-30 04:20
    Thanks a lot.

    I had the pin on output!
    Which I quickly corrected.

    I noticed however (I have a indicator led that lights up when
    circuit is on) that the led keeps blinking (low) periodically even
    when output pin is set to low. Perhaps LOW means
    a very low current?

    Anyone knows what's the lowest detectable VOLT for an
    input pin?

    Thanks again so much.
  • Beau SchwabeBeau Schwabe Posts: 6,563
    edited 2008-07-30 06:05
    Dr.No,

    "LOW" sets the pin to LOW; it does not mean low current.... Depending on what your program looks like and how it terminates can cause a pin set as an output to periodically "blink".
    Please post the code that you have so far so that we can positively determine and confirm this behavior.

    The voltage threshold is around 1.4 Volts... anything above 1.4 Volts registers as a logic HIGH ("1"), anything below 1.4 Volts registers as a logic LOW ("0").

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Dr.NoDr.No Posts: 60
    edited 2008-07-30 12:53
    ' {$STAMP BS2}

    Start:
    DEBUG "Initializing..."
    OUTL =%00000000 'set 7-0 to low
    DIRL =%11111111 'set said to output
    PAUSE 5000
    DEBUG "Running"
    INPUT 1


    CIRCUITOFF:
    LOW 11
    PAUSE 500

    'During stage1, LED blinks.
    stage1: 'Pin 11 is connected to LED
    LOW 11 'added to turn off led (LED now only blinks dimly)

    IF IN1=1 THEN CIRCUITON

    GOTO stage1




    CIRCUITON:
    HIGH 11 'turn on LED, circuit is running

    stage2:

    IF IN1=0 THEN CIRCUITOFF

    GOTO stage2
  • Beau SchwabeBeau Schwabe Posts: 6,563
    edited 2008-07-30 14:30
    Dr.No,

    Sounds like you need a pull-up or pull-down resistor on your input pin....


    Based on this sentence you gave earlier...
    "Everything works except I'm not picking up any 1s on the IN1 except 0s."
    ...It sounds like you need a pull-up resistor on your input

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Dr.NoDr.No Posts: 60
    edited 2008-07-30 15:13
    Oh, it's working fine now... I just was curious about the dimly lit blinking LED.

    Thanks.
  • Dr.NoDr.No Posts: 60
    edited 2008-08-01 00:03
    This post if from What's Really Going On Here - Voltage Drop - the anomolies of voltage and current. Duplicate post
    __________________________________________________________________________
    The diodes was my first bet for the voltage drop. I was able to reduce the 5volts to less than 0.5volts
    and the stamp was still able to detect it. So, the stamp has a way of picking up
    that's it's really 5volts because it can't pickup 1.3volts. My guess it's in the current (ma).

    Using 1.3volts without diodes, the stamp did not pick it up.


    Someone told me about the 74LS IC family of chip. I haven't found a good link yet and then there's the coil but
    all this will probably equate to the same thing as the diodes.

    Can anyone please tell me what does a schematic have to do with finding a component that can drop volts?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-01 00:14
    There are many ways to decrease the voltage at a particular point in a circuit. Which to choose depends on the circuit its embedded in and how that voltage is to be used. Some ways might work terribly or not at all in a particular circuit, yet work perfectly well in some other circuit. Some ways might damage the parts around them in certain contexts.
  • Dr.NoDr.No Posts: 60
    edited 2008-08-01 21:10
    Stamp is able to pick up less than 0.5 volt [noparse][[/noparse]tested] on input pin with 5.0 base volt.
    Stamp won't pick up 1.3 base volt.
    570 x 295 - 12K
    t.jpeg 12.1K
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-01 22:07
    I can't tell from your diagram just what's in the area marked "diodes". I assume it's 4 series connected silicon switching diodes with the anodes towards the battery and the cathodes towards the Stamp.

    If you look at the datasheets for the diodes, you'll probably find that the forward voltage (Vf) drop across the diode depends on the current. At very low currents (like here) it will tend towards 0.6V per diode. 4 x 0.6V = 2.4V. If your supply truly is 5V, that will leave 2.6V at the Stamp pin which the Stamp will see as logic one/high.
  • Dr.NoDr.No Posts: 60
    edited 2008-08-02 00:12
    I do not have the tools to draw an accurate diagram. I use the paint program as best as I could.
    This was only a simple diagram for show. I actually used over 25 diodes because no matter how
    low the volts was, the stamp was STILL able to pick it up. I used a multimeter from radio shack
    because I couldn't believe the stamp was still picking it up. The volt meter reading was 5V at the
    battery and < 0.5 volts after the diodes.

    25 x 0.6 =15

    Moreover, I happen to reverse a single diode to stop the current from flowing at the pin and the stamp
    still lit up the LED.


    Pin O---/\/\/\/\
    |>|
    |<|---|<|---|<|---|<|
    (+) Battery

    The idea was simply to drop the volts low enough so that it can't be detected by the stamp
    according to the advertised low point of < 1.4 volts.

    The basis for this is from experiments in the What's a microcontroller book
    chapter 2 & 3 Lights On Light Off & Digital Input

    What's a microcontroller anyway if you cannot use it?

    Post Edited (Dr.No) : 8/2/2008 12:26:08 AM GMT
  • FranklinFranklin Posts: 4,747
    edited 2008-08-02 00:34
    A microcontroller is a device which, in the hands of a competent person can do everything within it's design parameters relying on said competent person to decide if those parameters fit their needs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-02 00:47
    dividers.jpg
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-02 01:19
    The BS2 has an input impedance of about 10 MegOhms. So you're only going to get:

    (Let's see -- V == I * R, V/R == I, 5 / 10e6 == 0.5 micro-amps)

    Yeah, I don't think you can assume a diode has a 0.6 volt drop at 1/2 micro-amp.

    What you DO need is a 10K resistor to ground. We call this a "pull-down" resistor. This gives the input pin a 'soft' ground, which should prevent the input pin from reading any RF signal when very little current is running.
  • Dr.NoDr.No Posts: 60
    edited 2008-08-02 02:04
    Ok, I'll try the 10K.

    Thanks.
Sign In or Register to comment.