little help please

Thread Starter

zoerror

Joined Jun 8, 2008
3
i have a basic stamp board 2, and i want to know how to hook a transistor up to it. my goal is to hook it up and have a simple script for it somthing like this:
high 15
pause 250
low 15
high 15
pause 250
low 15
high 15
pause 250
low 15

i want the transistor to let current to go through and then stop the current.

to put it more simple, lets say, i wanted to hook a transitor to the basic stamp board and hook a LED to the transistor. and have a simple script like above and make the led flash.

I know i dont need a transistor for a led, and i know i need resistors but my main concer is how to wire it properly. im not sure what VDD or Vss means on the board. If someone could help me out a little i would appreciate it. Thanks
 

SgtWookie

Joined Jul 17, 2007
22,230
Vdd is the more positive supply. Vdd is the correct terminology for CMOS devices. Vcc is the terminology for BJT's, or bipolar junction transistors, like a 2n2222.
Vss is the more negative supply for CMOS devices. For BJT's, it's Vee.

In many circuits, Vss and Vee are equivalent to ground, abbreviated as GND. However, sometimes Vss/Vee have a value that is less than ground, such as when you are using op amps.

Your program as written may work, but there is no delay between setting pin 15 from low to high. To you, it will appear that the LED is constantly lit. You need something more like:

high 15
pause 250
low 15
pause 250
(repeat...)

If you want something a bit more exciting, try:
Rich (BB code):
Looper   VAR BYTE
MainLoop:
   FOR Looper = 255 to 1 STEP -1
      high 15
      pause Looper
      low 15
      pause Looper
   NEXT
   FOR Looper = 1 to 255 STEP 1
      high 15
      pause Looper
      low 15
      pause Looper
   NEXT
GOTO MainLoop
This will cause the LED to flash at varying speeds; starting off slow and getting faster and faster, then slowing back down, and repeating infinitely.
Note that since "Looper" is a byte variable, it's maximum value is 255.

Which exact model of Basic Stamp are you working with?

Do you have any NPN transistors around? Which part number? Do you have an LED around? If so, what is their rating? (Typical Vf @ current)
 
Last edited:

Thread Starter

zoerror

Joined Jun 8, 2008
3
thanks for info :)

but i think i misslead you a little.

Im trying to ask how to wire it up. would i plug a wire into p15, then take that wire and place it on the E of the transistor? then take antoehr wire and place it next to p15 and have that running to the B on the transistor, Then what would i do with the other wire on the transistor "C" ,... Im not sure how the wiring goes. I looked at pics but i dont understand what thier saying. Thanks for the help.
 

SgtWookie

Joined Jul 17, 2007
22,230
OK.
The Basic Stamp is a CMOS device. It has limited ability to source or sink current.

I'm going to assume for now that you have an NPN transistor available, like a 2n2222 or 2n3904.

Connect the emitter of the NPN transistor to ground/Vss/Vee.
Connect pin 15 of the Basic Stamp to the base of the transistor using a resistor between 3.3k and 10k Ohms in value.

You should have the transistor's collector still dangling somewhere.

Now you need to determine the current limiting resistor for the LED.
Rlimit >= (Vsupply - Vf(LED)) / I(LED)
or, the value of the current limiting resistor is equal to or greater than the sum of (supply voltage less the forward voltage rating of the LED) divided by the rated current of the LED.
Let's just say you have a red LED that's rated for Vf(typ) 1.7v @20mA.
Let's also say that your supply voltage is 5v.
If anything's different, just plug in the values you have, and re-calculate.
Re-stating:
Rlimit >= (Vsupply - Vf(LED)) / I(LED)
Rlimit >= (5v - 1.7v) / 20mA
Rlimit >= 3.3 / 0.02
Rlimit >= 165
Looking at a standard value chart:
http://www.logwell.com/tech/components/resistor_values.html
you can see that 160 and 180 are close. Take 180; your LED will live longer.

So, connect one lead of the resistor to Vdd/Vcc/+v, and the other lead to the anode of the LED. Connect the cathode (the shorter lead) of the LED to the collector of the transistor, load up the program, and blink to your heart's content. ;)
 
Top