> I'm trying to turn a 24V solenoid (electro-magnet) with an NPN > transistor (TIP41) wired to a PIC. Here's the circuit: > > > 24V-----------+ > solenoid (with reverse diode) > C-----------+ > PIC----10K--+----B > | E > 1K | > | | > GND GND > > It's not working. There are two good reasons for this. 1 - The 10K and the 1K resistors form a voltage divider. Even without the transistor drawing any current and the PIC output at 5V, the voltage for the base would be 5V * 1K / (10K + 1K) = 455mV. That is just too little to turn on the transistor more than a trickle at most. 2 - Even without the 10K resistor, the base current with the PIC output at 5V is 4.3V / 10Kohms = 430uA. I don't know what the gain of the TIP41 is or how much current your solenoid needs, but this sounds way too small. You can usually assume a current gain of 100 for small signal transistors, 25 or so for medium power (a few watts), and sometimes as low as 10 or 15 for high power (many watts). So, what to do? Since you didn't give the pertinant values, I'll make up some and you can adjust the result given the real values. Let's assume the solenoid requires 100mA. You can easily find a transistor that can pass 100mA with 500mV C-E drop or less. That means it will only dissipate 50mW when on, which is no big deal. Even a small signal transistor in a TO-92 package can do this, so let's assume you have a transistor that has a current gain of 100. That means it needs at least 1mA base drive to deliver 100mA to the solenoid and still stay saturated. Figure the B-E drop at 700mV, so that leaves 4.3V between the PIC pin when it is high and the base of the transistor. Let's double the minimum base current to provide margin. That means your base resistor is R = V / A = 4.3V / 2mA = 2.15Kohm, in other words around 2K ohms. This assumes you loose that base to ground resistor (1K in your schematic). There is no point for that resistor in this case. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.