Hey guys-I'm racking my brains trying to figure out 1) which transistor to use and 2) how to wire it into my current project to use it for switching a 5V relay coil. The code for the project, my "A.R.S.C." (Air Ride Smart Controller), isn't written yet-I want to make sure I've got the hardware aspect of the project covered to ensure correct operation with the proper code, but I've pretty much got most of the code layed out; I just need to play with a few variables and determine which pins will operate relays, which will read the sensors, etc. I'm hoping I can at least get all the hardware right the first time; I don't really have the option to "breadboard" this project, but I did get a PICkit 2 (another great thing this forum has introduced me to) so the code can be changed via ICSP "on the fly", a lot easier than I can change out a transistor or other hardware component.
I have found at least two other threads on this forum and a few other schematics to go by, but I'm not 100% sure what I have found is compatable with my project. I have done my research, but I wanted to get the opinion(s) and help of somebody that's basically done the same or similar thing with PIC MCUs, somebody who actually knows what they're doing with not only the MCUs, but with transistors (or a similar circuit) also...
The MCU I'm using with this project is a 16F690, mostly for the A/D channels (I'll only need a total of six including the Vref-one per corner of the car/air spring and another for the tank pressure sending unit), the extra code space (4K, more than most smaller devices) for future upgrades/expansion, and the fact that I have about ten or so on-hand. I'm using PCB-mount Omron G5LA-14 5VDC coil relays (SPDT) with a 1N4001 diode placed across the coil for protection (the MCU outputs to the relay aren't wired up yet, but will be wired to the correct side of the relay's coil in regard to the diode once I know exactly how the circuit will be layed out). The relays are only switching automotive 12VDC current (depending on the state of the battery and alternator, somewhere in the neighborhood of 9V-14.7/15V max) at less than one amp (I believe) to operate the SMC brand "air valves", or pneumatic solenoids to control the flow of air into the air springs (or 'bags) based on the pressure reading obtained from oil pressure sending units installed in each corner and in a tank port on this particular vehicle. The sensors were part of a digital gauge kit designed for air ride applications; even though the sensors were made to work with oil, they still work within a 4psi accuracy (from 100psi or less) when used with compressed air.
My current dilemma is choosing the right transistor to install between the MCU and the relay. I plan to drive the selected output pin that controls a single relay "high" for a fraction of a second when the analog input that controls it's function gets a "low psi" reading (a small analog voltage signal-under 1.525VDC-from the sending unit that will be preset for this prototype, a non-adjustable constant in this version), then re-checks the psi level and either continues to open the valve (back to same loop if pressure still isn't at it's correct level) or goes on to check the other pressure levels in their respective corners of the vehicle (moves to next corners' pressure reading subroutine)...
I believe it was on this forum that I read it was highly recommended to use a transistor to "drive" a relay instead of powering the unit directly from CMOS levels. I have a vast array of transistors on hand, mostly plain ol' bi-polar NPN's and PNP's; not many FET's, BJT's, etc. Transistors are one thing that I don't really know much about; I can solder or install one from a schematic to a circuit or breadboard, but as far as using one in a circuit of mostly my own design I have no clue how to properly choose them. If anybody mentions getting my hands on a copy of "The Art of Electronics", I've had my local library order it (I can't believe they didn't have it in stock!) so I could browse through it before buying a copy of my own (it's still not in yet)...
One frustrating fact is that I don't know how to check and determine which lead is the collector, base, or emitter. I don't have an oscilliscope but I do have a nice Fluke multi-meter. I keep meaning to order a "transistor tester" or a kit/tool that determines whether the transistor inserted in it is an NPN or PNP and lets you know which leads are what. I've seen a couple of them in online stores but have never ordered one because I haven't really needed it until now. I need to get one soon...
I have a few MPSA2222A's that I thought were the same as (or very similar to) 2N2222(A)'s or PN2222(A)'s, but they apparently aren't. I could only find datasheets for T0-18 case 2N2222's, and the ON Semiconductor datasheet I found for the PN2222(A) did NOT have the same leads/pin-out as the MPSA2222A's I have on hand (when I hooked what the datasheet said was the collector to +9VDC and what was supposed to be the emitter to the 9V battery's ground terminal, that little thing quickly heated up to "burning hot"-I played around with a couple others, testing each with my Fluke meter to verify that 9V stayed on the display; I noticed that each one only got hot when the Fluke display's DC voltage was dropping-one reached 1.6V before I removed it and felt like it was about to explode; yes, I disposed of each one that warmed up), so I really need a method for determining which lead is which, especially on some of the lesser-used/known transistors I have. I do have quite a few 2N3904's, 2N3905's, 2N3906's, and a great deal more of what some would consider "common" transistors. Some of the more common ones should have the same pin-outs regardless of the brand, shouldn't they? I do have at least one manufacturer's datasheet saved for almost each transistor I have, but most of them don't have the manufacturer's logo or name printed on their T0-92 cases...
To sum the above novel up into a single-dual question, what transistor would be best to use in my case and how do I wire up the collector, base, and emitter of said transistor for use as "driving" a relay-installed between the PCB mounted 5VDC coil of the relay and the PIC16F690 20DIP MCU. I'm planning on driving the selected output pin "high" on the MCU to activate the relay, but I could change it's state to low-with the other side of the coil attached to +5V, if that's what is recommended and works correctly and reliably. Whatever would be the most reliable and dependable choice for this application is what I need-I don't care to buy a few more expensive T0-220 transistors if that's going to create a better and more dependable finished product compared to any T0-92 case transistor I have...
Also, if anybody knows any good tips or tricks on how to determine whether a transistor is an NPN or PNP stlye (or even determining/deciphering whether the transistor in quesion is bi-polar, an FET, BJT, Darlington, etc.) and how to figure out which leads are the collector, base, and emitter (that's a definate need for the cheap off-brand assortment of transistors I have on-hand), I would greatly appreciate any of them. Thanks in advance for any and all information and help you guys can give me; believe me, it's greatly appreciated!
Sincerely,
-Adam Collins
Bookmarks