Electronic – Need help operating a transistor


I have a relay operated by an NPN transistor that needs some voltage applied to the base. I'm working with an arduino and if I give it a digital port, all's well. The circuit looks like this one:

enter image description here

Now I want to replace the arduino port with a DS2406 (the TO92 kind).

This seemed to get really complicated fast. My library for operating the 2406 is fine, but I can't figure out how to wire it.

Now that both pieces independently work, my goal is to get some current fed into the base of the transistor so it throws the relay.

I've run into the following issues:

The DS2406 closes to ground. That's the only option, so I can't map it directly to the base pin of the transistor.

The TO-92 package doesn't have a vcc pin, so I have to have a pull up resistor between vcc and the data pin. This causes stuff to get hot and smelly when I power it up hooked up to the collector of the transistor with the base wired to the relay power. I could be using the wrong kind of resistor, but I don't have a strong sense of what's right here.

I may be able to run the relay strictly off the DS2406, but I'm afraid it will have too much draw, which is why I want it to go through the transistor.

What's the easiest way to go from a switch that opens and closes ground to a transistor base that wants current?

Best Answer

Your basic NPN transistor switch circuit is an inverter, if you put a pull-up resistor (maybe 10k?) between the collector and 5V. (i.e. the resistor replaces the relay in your linked diagram) When you switch on the base of the transistor (put it to 5V), the voltage at the collector goes to ~0V, and when you switch off the base (0V), the voltage at the collector goes to 5V.

So you could stick such a transistor inverter in between the DS2406 and the transistor driving the relay.

I still think you should be able to use the DS2406 with only one transistor though. Perhaps if you had a pull-up resistor (10k) going from the transistor's base to 5V. This keeps the transistor turned on, unless the DS2406 pulls the base down. Also, don't forget to put the current limiting resistor at the front of the base. If you don't have this, the transistor will "get hot and smelly" as you say. ;)