Hey guys in my project I need my atmega168 to drive a 24V relay(30mA,1100ohms).I am using npn transistor which will satisfy the current requirement of the relay to turn it on.The problem is that one end of the relay is already grounded so I cant really use CE configuration and i am quite confused actually I have always used transistor as CE configuration as switch and I want the atmega168 to sink/source less amount of current
Thank you,
connect collector of PNP to one end of relay and GND the other end of relay. Connect emitter of PNP to +24V. Connect base of PNP say BC557 to ATMega through a 1k resistor. When NPN turns ON 0.4V drop accross CE junction and remaining 23.6V drop accross Relay coil.
If you can not change the configuraton, it means you need high-side switching, you will need PNP or PMOS devices. Search with the keyword "high side switching".
you can use one zener diode 1 k resistance and one pnp tr. for any source current driving
if your port pin high 5V and driving relay voltage 24V you can use 24-5-.7v=18.3v zener ~18v
resistance for current limit