Shop OBEX P1 Docs P2 Docs Learn Events
A silly question — Parallax Forums

A silly question

austin_48111austin_48111 Posts: 7
edited 2010-10-15 08:10 in BASIC Stamp
Hi everyone,

I'm incredibly new to BASIC Stamps and, unfortunately, circuit design in general. I work for a low voltage technology firm and like a lot of these firms we install "black boxes" for our clients. We do a fair amount of Crestron, Extron, and other AV related products as well as the standard low voltage products like voice/data infrastructure and the like. However, I've ran into a project where no one makes an item that will fulfill the need we have to provide a decent product. So, I happen to have ample time to experiment as the deadline on this is a ways out. Like many of these firms we don't generally dabble with circuit design other than perhaps a handful of relays and switches from time to time so please forgive the associated ignorance in this message.

With the introductory blurb out of the way let me discuss the dilemma I'm having. I have a BASIC Stamp Discovery kit and have been through about 1/4 of the learning labs which don't seem to be teaching me the items I need assistance with. I'm not deterred by the programming (it is BASIC after all) but am running into an issue with understanding how the circuit is working. I've taken a 10k ohm resistor and ran it from Vdd (+5v) to P7 and ran some code to read the state. Obviously it's high. My assumption is that since there's a resistor there the basic stamp is pulling some milliamps. What I'm trying to understand is why does it recommend a 10k ohm resistor and why when I use my multimeter to test the amperage am I getting zero amps between the resistor and P7 (disconnected resistor and also connected)? I do get .5 ma when I test from P7 to VSS directly on the basic stamp. Is this what it's actually drawing? If so, why the 10k ohm resistor?

Keep in mind all my circuit consists of is a 10k ohm resistor ran directly from VSS to P7.

Also, since I have your attention what is "source/sink"? Google is turning up results that don't apply to a circuit.

Thanks for your help on this admittedly simpleminded question and also thanks in advance for sparing me any RTFMs, "get a electricity 101 book", etc.

Comments

  • CampeckCampeck Posts: 111
    edited 2010-10-14 13:41
    Well when you are TESTING for a HIGH or LOW the BS2s pin is set as an INPUT. This is high impedance and therefore current will not flow into or out of the BS2. The 10k resistor is there for protection in case you initialize a program and accidentally set that pin to LOW. there would then be a direct short from power to ground if the resistor wasn't there.

    So yes...if you are carefull you can connect power or ground straight to a BS2 pin that is set as an INPUT.

    SOURCE is when the BS2 provides the current. Lets say you use HIGH 7 to light an led that is connected to ground.

    SINK is the opposite. Say when you use LOW 7 to light an led that is connected to Vdd.

    help?
  • austin_48111austin_48111 Posts: 7
    edited 2010-10-14 13:48
    I believe so, I will need a bit of time to digest and comprehend. Thank you for the response.
  • hover1hover1 Posts: 1,929
    edited 2010-10-14 14:05
    To measure current, you must put the meter (set to amp measurment), in series with the circuit being measured. This may help:

    http://www.hobbyprojects.com/test_and_measurement/measuring_current.html

    Jim
    Hi everyone,



    My assumption is that since there's a resistor there the basic stamp is pulling some milliamps. What I'm trying to understand is why does it recommend a 10k ohm resistor and why when I use my multimeter to test the amperage am I getting zero amps between the resistor and P7 (disconnected resistor and also connected)? I do get .5 ma when I test from P7 to VSS directly on the basic stamp. Is this what it's actually drawing? If so, why the 10k ohm resistor?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-14 14:35
    The main reason for the 10K resistor is to protect the Stamp I/O pin from voltages or currents that would damage or destroy it.

    There are small protective diodes connected in reverse from the I/O pin to Vdd and Vss such that they normally do not conduct. If the I/O pin voltage rises above Vdd + 0.6V or below Vss - 0.6V, the diodes will conduct and short the current from the I/O pin to the supply line. This only works if there's a limited amount of current available, otherwise the diode and maybe the Vdd or Vss wires on the chip will melt. The 10K resistor serves to limit this current to 0.5mA or less under most circumstances. If you plan to have voltages around much over 10V or below -5V, you need to use a higher resistor value. Normally, the input current to a Stamp I/O pin is on the order of microAmps since there's some, but very little leakage through the diodes and other input structures..
  • Spiral_72Spiral_72 Posts: 791
    edited 2010-10-15 07:54
    Another bit no one has mentioned.... The 10k resistor will "flow" 0.5mA. This is calculated using Ohm's Law.... You'll use this one a lot! :)

    V = I * R

    or

    Voltage (in volts) equals current (in Amps) times Resistance (in ohms)

    You have, V=5V, R=10,000 ohms, then solve for "I"

    V/R = I or 5 / 10,000 = I or I=0.0005 (0.5mA)


    A resistor wired in series functions as a current limiting device. In this case, if you tie the resistor to 5V and the other end to ground, it will only allow 0.5mA of current through. As mentioned, it's there to protect your stamp.

    As for why a 10k resistor??? No good reason really. It was selected on the basis of: 1) They are a plentiful and common resistor 2) It flows a minimal amount of current while still assuring enough current to indicate a HIGH to the stamp.

    You can easily replace the 10k resistor with a 5k (For 1mA) a 20k (for 0.25mA) or any value between. Keep in mind #1 and #2 and you can use whatever value you have laying around and the circuit still works properly. The lower resistance, the higher the current, so 5V through a 10ohm resistor to ground will likely melt something. A 100k resistor may not flow enough current to indicate a HIGH to the stamp. The EXACT values come in to play if you are doing precision circuits, like oscillating a 555 timer for one example, where you might need a cap and a 3.3k resistor.
  • Spiral_72Spiral_72 Posts: 791
    edited 2010-10-15 08:10
    This step in your learning is pretty mundane..... You're almost to the point of lighting an LED, blinking one/several LEDS, making noise with a speaker, pushbuttons, etc. From there you can do cool stuff and start building you project one step at a time.

    Actually where you are right now..... insert a pushbutton in line with the resistor and you can indicate the HIGH / LOW through the stamp on the debug screen.
Sign In or Register to comment.