I would like to use a STM32F microcontroller with 3.3V digital io pins which can deliver a max of 22mA to switch a transistor to then power a 5V relay which pulls 28mA. I'm not entirely sure what aspects I need to consider when selecting a transistor.
I've actually got 8 relays I wanted to power so I've found an a couple of quad npn transistor ICs which I think should do the job and I'm going to use 2 of them. FFB2222A and MMPQ3904
The collector currents are 500mA and 200mA respectively which should be ample (pun not intended). (These are ratings per transistor in the IC if I'm not mistaken).
What are the other things which need to be taken into account when selecting a transistor? Again if I'm not mistaken the transistor will be in the active region rather than saturated so we need to take in to account hfe, which should be sufficiently high for both. Is there anything else that needs considering?
Two other shorter questions with regard to the design.
1) When choosing a current limited resistor at the base does one assume the drop betweeen the emitter and the base is approximately 0.7? So 3.3-0.7=2.6V so assuming we want roughly 15mA going into the base 2.6V/15mA=173ohms (ish).
2) Also what things do you need to consider when choosing a flyback diode?
simulate this circuit – Schematic created using CircuitLab