hi. i want the arduino uno, to energize a relay, that needs around 45ma to work (so close....) but i suppose that since the digital pins give only 40ma , they cant do that alone???
so i suppose i should use a transistor, to energize the relay from the 5v out of the arduino.
what type of transistor would i need to do that?? i have now idea how transistors work...
but i suppose that since the digital pins give only 40ma
No the digital pins can give more if you connect them to a low enough impedance load.
The point is that you should not permit them to give more otherwise they will suffer damage. Even so 40mA is too high and is just a stress rating, try and not connect them to a load that demands more than 30mA.
Any type of general purpose NPN transistor, all will be able to handle that small amount of current. I use a 2N2222 but anything, get the lowest cost one you can find.
how do i wire the transistor
According to the diagram, it has three wires, emitter - should go to ground, collector - should go to one end of the relay and base should go to a resistor value 1K to 10K. Other end of resistor to arduino pin. Other end of the relay to +5V.
Finally put a diode 1N4001 with the cathode (stripe end) to +5 and the anode to the transistor's collector.
See the first diagram of:- http://www.thebox.myzen.co.uk/Workshop/Motors_1.html