Let's Make Robots!

How do you use a transistor in place of a switch/button?

http://www.kpsec.freeuk.com/index.htm

Here ya go!

Now how do you use a transistor in place of a switch/button?

So I can use this with my Basic Stamp 2?

http://www.makershed.com/ProductDetails.asp?ProductCode=MKAD4

 

Admin Edit: Changed post title and removed useless posts.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
CaptainTuna's picture

The circuit i made was simply a "fast mouse clicker". It basically goes high output, pause 100, low output. The mouse's switch is simply its left mouse button.

 And...it's a BJT. And it works normally.

I too did not expect it to work since it wasn't a FET, in fact the first thing i did was to connect tie grounds together. But once i untied them it worked. If you want i can take a photo of it.

CaptainTuna's picture

Immagine_0.jpg

Here's the circuit. As you can see the two power supplies are isolated from each other. What i don't get is: shouldn't current A (marked in red), given out by the picaxe's batteries get back to them(picaxe's batteries), somehow? 

 

PS: i wrote anode and cathode between commas (") because they aren't actaully anode and cathode. I was just trying to refer to the different contacts on the mouse's switch. 

robologist's picture
Yes, the small current A you have marked should have a path back to the PICAxe batteries somewhere, or else not cause the transistor to turn on. 
CaptainTuna's picture
Exactly...but the point is that it works if i connect it like the picture shows.
robologist's picture
How exactly is it supposed to work?  What does the transistor do to the mouse that the switch shown normally did?
TeleFox's picture
Also, what type of transistor are you using? If it's a FET type then the circuit posted will work (although not reliably), while if it's a BJT then the circuit should not work for more than an instant at best.
CaptainTuna's picture
I know this is quite old, but today i thought about it and i don't understand why the work like that. What i mean is: if you connect a BS2's output pin to the base of the transistor which has the collector and emttier connected to another independent circuit, where does the BS2's current end up? Shouldn't it get back to its original source? (say through a connection between the BS2's ground and the other circuit's ground)
robologist's picture

Many circuits will not work unless the grounds are connected between them. Exceptions are those that have been opto-isolated or isolated in some other form.   Voltages generally need a reference point, and that is typically ground. Essentially, it means that the above circuit assumes that the transistor ground is also the BS2 ground, in order to work. The relay switch can be isolated completely from the BS2 and transistor.  

CaptainTuna's picture

but i managed to to this with an USB mouse (don't think it is opto-isolated in any way). I just connected collector to the switch's "anode" and the emitter to the "cathode" and the base to my picaxe without connecting GNDs....how come?

I can understand why this happens with a relay, but in every tutorial i've read they say current enters the base and ends up through the emitter.

robologist's picture
Want to post the full circuit? It's not clear what you have from your description. First you mention a USB mouse, then you say something about a switch that somehow has an anode and a cathode, which sounds more like a diode to me. How is th USB mouse involved? How are you powering the PICAxe?