Am I using the 2N2222 correctly? edit-2N2222A - Page 1
Forum section: electronics / beginners

author: ScarceSam
author_rank: Newbie
timestamp: February 10, 2017, 08:09:51 pm
content: *UPDATE- The 2N2222s came in, they are actually 2N2222As, photo attachedThis is my first use of transistors in a project. I need to control aSainSmart 16-Channel Relay Moduleusing an Arduino 101(3v3 GPIOs). This Relay Module uses 5 vdc through Opto couplers to power the relays. The input pins on the relay board are at 4.4 vdc and need to be brought to GND to switch on.When I connected the Arduino 101(3v3 GPIOs) directly to the relay module some of the relays would stay on while others would be controlled by the Arduino. It all worked fine when I tried an Arduino UNO(5v GPIOs) in place of the 101. But, I want to use the BLE capabilities of the 101.So my solution is to use 2N2222 transistors because I’ve read they are good at general purpose low-mid power switching. Below is the configuration I think is correct. Any feed back would be greatly appreciated. I’ve tried reading the Data Sheet but I’m mostly going off of other forum posts.Relay Board inputs; +4.4vdc, input-ground 4mAArduino 101; 3.3vdc GPIOs, max 20mA per GPIOT1: 2N2222AR1: 10K, to reduce current through the Base to 0.33 mAR2: 100K, drop down resistor. (is it needed?)Thanks!

author: Cliff Matthews
author_rank: Unknown
timestamp: February 10, 2017, 08:35:28 pm
content: A typical 817 opto coupler's input has an infrared LED that drops about 1.2v Vf at 5ma (240 ohms).http://www.vishay.com/docs/83522/k817p.pdfThe ATmega 328 can source up to 200ma total, so I think a 470 ohm or 1k ohm resistor is all you need, forget the transistor. What drives the relays is already on the SainSmart module.

author: Unknown
author_rank: Unknown
timestamp: February 10, 2017, 08:58:24 pm
content: Don't forget about Vbe; if the GPIO pin is at 3.3V and Vbe of the transistor is ~0.7V, then a 10k resistor would give it a 0.26mA current through the base (V=IR, 3.3-0.7=0.00026*10000). This would be ignoring (removing) the R2 drop resistor as it wouldn't do much for you -- the base shouldn't "float," it already has a good path to ground through the emitter.The Beta of a 2N2222 is about 100, if I recall; that would let at least 26mA flow through your transistor which is more than the on-current of the relay according to your specs. So, the relay would be on.

author: ScarceSam
author_rank: Newbie
timestamp: February 10, 2017, 09:00:41 pm
content: Cliff,I didn't have any issues using the Arduino UNO (ATmege 328) to controll the SainSmart module.However, I'm tring to use an Arduino 101 (Intel Curie Module) for it's BLE capabilities. When I tried to have the Arduino directly connected to the SainSmart module it wasn't able to keep some of the relays off.I think the issue is because the Arduino runs at 3.3 volts but the SainSmart module controls are 5 volts.If it's just a matter of using resistors with the 101 that would be awesome!Thanks for the info, I'll try 1K resistors with Arduino 101 tonight?

author: ScarceSam
author_rank: Newbie
timestamp: February 10, 2017, 09:18:44 pm
content: Elf,I'll remove R2. If I wanted to reduce power consumption I can increase the R1 but, the SainSmart module Amazon listing states that it takes 15-20 mA to drive the relays. So, the 10k should work for the listed current. I'll give it a try when my transistors come in tomorrow.Thanks for showing how the numbers from the datasheet relate to the needed calcs, I'm trying to learn.

author: james_s
author_rank: Super Contributor
timestamp: February 10, 2017, 09:29:19 pm
content: Ideally you want to saturate the transistor when using it for a switch, so look up the saturation current and try to hit that.The pulldown resistor is unnecessary as AVRs have totem pole outputs.

author: Cliff Matthews
author_rank: Unknown
timestamp: February 10, 2017, 09:42:47 pm
content: Quote from: ScarceSam on February 10, 2017, 09:00:41 pmGo lower. If you're sourcing 3v, 1k will likely not drive opto coupler inputs beyond 2ma. If it still doesn't work, maybe put 1.5 battery across a 1k pot and send the wiper and ground as output to quickly test each of the opto coupler inputs.

author: Ian.M
author_rank: Super Contributor
timestamp: February 10, 2017, 10:16:12 pm
content: That must be one s--tty relay board design. I see it uses ULN2803A drivers for the relays + the indicator LEDs, and their input current with a 5V logic signal will be under 1.5mA. For the optocouplers to need 15mA to 20mA means they must have a current transfer ratio of 10% or worse - that's not even Chinese factory floor sweeping grade. Alternatively the ULN2803A chips could be fakes.Lets leave aside the insanity of using optoisolators then bypassing them by feeding their input side from the same 5V rail as their output!I wouldn't trust those relays to control anything over 24V - if the creepage distances are as screwed up as the rest of the design, it wont be safe for mains even if the relays are supposedly 250VAC rated.Check the current that is required to pull each opto input down to ground with a DMM. If the optos are even crappy 50% CTR ones and they are overdriving them by a factor of two to allow for aging, it shouldn't be more than 6mA.Also check the voltage on the corresponding ULN2803A input pin. With the opto input grounded, it should be at least 4.5V.

author: james_s
author_rank: Super Contributor
timestamp: February 11, 2017, 12:51:51 am
content: They may just be going by the max rating for the LED in the optocoupler, 20mA sounds reasonable for that, although in practice much less ought to work.

author: David Hess
author_rank: Super Contributor
timestamp: February 11, 2017, 02:48:24 am
content: If a CMOS output is used to drive the transistor, then R2 is not needed because the CMOS output can pull the base to ground. I typically go for a forced beta of 1/2 the minimum hfe so assuming a minimum hfe of 100 for a 2N2222:4mA/50=80uA3.3V-Vbe=2.7V2.7V/80uA=34k for R1A 2N3904 would be more typical to use these days than a 2N2222.

author: danadak
author_rank: Super Contributor
timestamp: February 11, 2017, 03:07:56 am
content: Some thoughts -1) Do NOT remove R2. That holds transistor off while UP starting up, portin hi z. Absorbs leakage that could otherwise turn on transistor.2) For max collector current in 2N2222 make Ib = Icmax /10. That is a ruleof thumb to force transistor into saturation.3) If collector connected to relay, inductive load, add diode to absorb turn off transient.https://www.google.com/imgres?imgurl=http%3A%2F%2Fwww.electronics-tutorials.ws%2Ftransistor%2Ftran12.gif%3Fx98918&imgrefurl=http%3A%2F%2Fwww.electronics-tutorials.ws%2Ftransistor%2Ftran_4.html&docid=OD3QwYWl5JGIyM&tbnid=dH7ujvaXRpgr_M%3A&vet=1&w=360&h=248&bih=720&biw=1517&q=transistor%20relay%20driver%20image&ved=0ahUKEwjHvLeOiIfSAhUJ7oMKHbokAu8QMwh0KE4wTg&iact=mrc&uact=8Regards, Dana.

author: LukeW
author_rank: Frequent Contributor
timestamp: February 11, 2017, 04:19:18 am
content: The relay module will have a 12V supply that drives the relay coils, this will need to be connected.Some of these cheap Chinese "Arduino-style" relay modules have a 5V reg on board to provide the 5V supply, but maybe some don't. Not sure if yours does.Note that even though optocouplers are used, the design does not provide galvanic isolation.The whole thing is stupid design - ULN2083 drivers, plus optocouplers, and the optocouplers are completely pointless. The could simply provide a transistor and a diode on board (or a ULN2083 style IC), plus the 5V reg.The input pins on the relay module will have a separate ground pin on the same bank of pins.If there is a 5V supply on board, you should be able to connect the 12V coil supply, and then connect a jumper wire from the ground on the header bank to IN1, or whatever, and turn the relay on.Check that that works.Then try adding a transistor in place of the jumper wire.The relay module ground will have to have a common ground with your circuit.Try connecting the base of the transistor circuit to 3.3V (or 5V) to turn it on - you don't need the microcontroller module when you're building this circuit, and if you're not sure about your work it may be better to connect it last to avoid any damage risk.

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2017, 06:07:09 am
content: I went on the Sainsmart site and found the board 'manual' - a craqppy schematic without component values and a PCB layout. According to the PCB layout, the creepage distance between the relay contact common pin and the +12V track feeding the coil is as little as 1.2mm for the upper relay bank and 1.65mm for the lower bank. This board is UNSAFE for switching any voltage above SELV, and I wouldn't recommend using it for inductive loads either.With 12V power connected, the on-board LM2576 regulator should be providing 5V on the marked pins of the input connector, that you can use to power stuff for the tests LukeW suggested.Please report the markings on the resistor modules PR1,PR2,PR$ & PR7 (should all be the same), or measure the resistance across one of the modules between the common pins (lower) and one of the upper pins feeding one of the optocouplers' input sides. Also please report the markings on the optocouplers.That will let us calculate how hard they actually need to be driven to switch the relays reliably.I'm trying to determine if the optocouplers are more trouble than they are worth, and should simply be removed and bypassed, so your 3.3V logic can directly drive the ULN2803A relay drivers. Otherwise, it may be possible to cut and patch the supply tracks to those resistor modules to isolate the input side 5V from the relay driver supply to make them actually useful. Its possible that they could then be driven successfully direct from 3.3V logic.

author: ScarceSam
author_rank: Newbie
timestamp: February 11, 2017, 09:25:14 am
content: James_sI’m not really sure how to read the data sheet re:saturation current or much else really. That's the reason for the post. I thought I had it with the plan above. But, I wanted to run it by others before I burned up a $35 micro-controller.Cliff,I think you’re understanding me incorrectly. The SainSmart module is driving the opto couplers. The Arduino just need to bring it to GND to switch it on. The problem is the 3.3 v GPIO of the Arduino 101 won’t keep the pin high enough to turn the relay off.Ian.MFirst, HAHA, I’m a Newb when it comes to this stuff and I realized the “isolation” is pointless if they are being fed off the same supply. But , the plan is to control 12vdc motors in a kids ride-on electric car. I measured the pull down current at 3.85mA. And the voltage on the ULN2803A input with the opto grounded is 4.8v. I’m guessing the 15-20 mA drive current listed on Amazon is the actual relay drive current?DavidThank you for using the abbreviations (Hfe and Vbe) from the data sheet in the calculations. That helps me know where to get the numbers. That's why I’m here, to learn. I think I will try a higher resistor value. I try to conserve power where I can.Yea, I read there were other transistors that were more common now. Maybe I could have even used MOSFETs to directly drive the 12vdc motors I'm drying to drive. But, 2n2222s seemed very common, I found them cheap, the project is a kids electric ride on vehicle(not real important) and I know relays.Dana1)I think I will keep R2. I’m using one of the relays to turn a pair of motors on but I’m using the others to reverse direction and others to change the speed. So, I want to avoid any chance of the relays accidentally turning on. That would cause a dead short, Bad!2)That’s how I calculated my original design, but I didn’t take Vbe into consideration(didn’t know how to). I Think I’ll try a couple different R1 values because I want full saturation but to conserve power since it will be running off of batteries.3)The SainSmart module has the diodes built in.LukeWI’ll be running the whole setup off of a 12v battery.The SainSmart module does have a 5v regulator on board. It’s what drives the opto couplers.Yea, I realized the “isolation” is crap but the project is to run a kids ride-on vehicle. So, nothing here is vital, I’m using it more as a learning experience. Just don’t want to burn up the arduino.I’ve tried jumping Inputs to GND and it does turn on the Relays. I will be using a common ground among everything.Yess! Testing the circuit with a 3.3 volt source instead of the actual MC is a great idea. I will definitely be doing that. Thanks for the idea.Ian.M -againI didn't really trust it to drive much more than 24 volts. The plan for this project is to drive the two 12vdc motors on a kid’s Peg Perego electric vehicle. If the Fly-Back voltage is going to be an issue I can put a diode across the one relay that's going to be the power switch or “throttle”. One is the “throttle” others are to reverse direction and others are to change the speed.That would be awesome if the Optos could actually be isolated and driven by only the Micro-controller. Especially since this project is only a temporary install. I could then use the relay module with any other micro-controller and just change the resistors and not worry about a bunch of extra circuitry. Looks like it's just a matter of removing PR1, PR2, PR4, and PR7, then connecting to the Optos through appropriate resistorsThanks everyone!! I may not be completely coherent in my replies. Please bear with me, it’s late and I have two small children. I’ll check back Sunday....

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2017, 10:41:54 am
content: Thank you for posting the closeup photos. They are going to be a big help figuring this out. That 3.85mA input pulldown current is very useful to know as well.I'm really glad to hear you aren't going to use the relay board for AC mains. High current low voltage motors + improperly isolated optocouplers aren't dangerous to you, but could be a real risk to your Arduino 101. The relays *should* provide enough isolation, but if the high motor currents cause the 12V supply and ground to the relay board to bounce around, it could crash or even damage the Arduino.Cutting and patching the board so that the input side of the optocouplers run off a separate supply that comes from the Arduino would make it much more resistant to that sort of problem. It may also eliminate the need for an extra protoboard to interface the two, but that isn't certain. The Optocoupler LEDs have 1K series resistors and probably have a Vf of about 1.15V @3.85mA If when running from 5V. If run from 3.3V, they'd only get about 2.2mA If which might not be enough to turn on the ULN2803A inputs reliably. You could try if a 470R resistor from an opto input to ground is enough to turn on each relay reliably. If so then converting it would be worthwhile.Alternatively, if you don't want to hack the relay board, you could use 74HCT series buffers as level translators, powered from the relay board's 5V pin. 74HCT logic is 5V CMOS logic with TTL compatible input thresholds. A TTL logic '1' is anything over 2.0V, which is compatible with 3.3V CMOS logic levels, but then you'd need a really good short ground connection between the Arduino and the relay board to prevent problems with ground bounce.Your transistor idea could also work well with a little rearrangement but will be a lot more complex than an all-in-one buffer chip that can handle eight relays.I'll need a bit of time to study the photos and the PCB layout. Check back tomorrow

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 11, 2017, 05:14:34 pm
content: <sarcasm>No. You are not using the 2N2222 correctly.Instructions:1. Pick up 2N22222. Toss in binYou are now using the 2N2222 correctly.</sarcasm>But seriously, can we please forget about the 2N2222? It's a metal can part. It's expensive. There are very few specs. It's not even the 2N2222A, let alone a much more common PN2222A (plastic).(And yes, the package is the major difference between these, and no, it's not a pedantic difference: JEDEC designations specify package, so when you say "2N2222", you're referring to one particular part -- not the improved -A version, and not the plastic version!)But much more practical, you should be looking at reasonably well specified transistors, like 2N4401 (complementary PNP 2N4403). Preferably by On Semi (they provide useful data on most of their transistors, going above and beyond the minimal JEDEC spec).For other applications, you can go smaller: 2N3904 is good for < 200mA; MMBTH10 is good for 50mA (and is even faster); or you can go larger, say with ZTX651 (up to 2A) or PBSS303NX. Or use MOSFETs, or protected switches (MOSFETs paired with an internal IC that protects against excessive current, voltage and temperature).Cheers!Tim

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2017, 05:30:31 pm
content: OTOH if you've got a bag of bloody metal can 2N2222 transistors, that you've had since Genghis Khan was in nappies, you might as well use them for one-off non-critical applications where their crappy specs don't matter. Just don't buy any more . . . .

author: FlyingHacker
author_rank: Frequent Contributor
timestamp: February 11, 2017, 05:47:47 pm
content: Curious why you disparage the 2N2222 (A presumably), but recommend the 2N3904.I have heard that some manufacturers test their 2N2222 transistors and label them as 2N3904 if they don't meet the 2N2222 specs. Is there any truth to this? I have no idea how reliable the source of this information is... I suspect not very.Both parts are ridiculously cheap for one-off stuff, and if you are only going to stock one, would it not be better to stock the higher current 2N2222A? Or is there something this hobbyist is missing?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 11, 2017, 08:20:28 pm
content: Though 2N3055 is even worse, and more deserving of ire...Of course if you don't buy from reputable sources, who knows what floor sweepings you get.I don't see that you could pass off a 2N2222 die as a 2N3904: the capacitance is wrong (the die is simply bigger, and so is Ic(max)).Probably, a lot of 2N4401 are sold as PN2222, and BCxxx, among others. That's fine, as long as they all meet their specs. Lord knows there's been a massive number of historical types (between American 2Nxxxx's, British BCxxx and such, and Japanese 2SCxxxx and such: tens of thousands!), most of which are utterly generic and interchangeable. Many types are differentiated by binning (a "2N3904" process might yield different breakdown voltages, hence 2N3903 and 2N3904, or TIP31A-C), and by testing specific parameters (a 2N5088 is, eh, broadly similar to 2N3904, but higher hFE, and specified for noise).Again, stocking 2N2222(A) (that you'venothad since ancient warlords roamed the plains) is silly when cheaper, and all around better, plastic parts are available.Really, the even more important point, to me, is the underlying reason:Who even buys 2N2222s? Why?The reason is the dumbest ever, and the oldest ever:Because everyone else always has.It is so easy, so trivial, in this modern age of computing, and of infinite choice, to make a rational, nearly-optimal decision. You can stack so many constraints, and still not have to compromise on cost. SMTs are cheaper than ever, and so is PnP assembly.WHY, in the name of all that is good in the universe, would one resort to such a banal reason as that? You can have the world, and yet you'll "have what he's having"?NO! Get out there and spend ten damn minutes familiarizing yourself with the range of options available to you. You'll save money, and, if you ever move into designing production electronics, you'll have a head start on where to go. That's marketable knowledge!Tim

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2017, 08:44:32 pm
content: Quote from: T3sl4co1l on February 11, 2017, 08:20:28 pmInsert 'modern,' before cheaper and you'll have my 100% agreement.Some N.O.S plastic parts are just as fugly as the 2N2222.e.g. my bag of:PIHER 2N4287, minature NPNs good for 45V Vceo, 50mA Ic, with HFE in the range 150-600, produced in Spain while El Caudillo was still roaming its plains!QuoteBecause the part number is so easy to remember!

author: Unknown
author_rank: Unknown
timestamp: February 11, 2017, 09:19:06 pm
content: Am I the only one who finds the metal TO-18 (and TO-3, etc.) cases neat looking? Also, the 2N2222 is iconic!

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2017, 09:34:17 pm
content: Quote from: Elf on February 11, 2017, 09:19:06 pmThey did have the big advantage of a standardised pinout.

author: FlyingHacker
author_rank: Frequent Contributor
timestamp: February 11, 2017, 10:16:34 pm
content: Quote from: Ian.M on February 11, 2017, 09:34:17 pmThey are also neat looking, dissipate more heat, and are very easy to attach metal heat sinks to.

author: David Hess
author_rank: Super Contributor
timestamp: February 12, 2017, 02:04:11 am
content: For me it would just be a cost issue; the 2N2222 in the metal TO-18 package is more expensive than a plastic TO-92 packaged part and the very inexpensive 2N4401/2N4403 is practically as good. If you find a deal for 10s or 100s of 2N2222s, then by all means use them but I would save them for where the metal TO-18 package matters.The parts I miss are the easily heat sinked TO-39 transistors. TO-225 and TO-220 packaged parts do not have the variety which was available in the TO-39.

author: kosine
author_rank: Regular Contributor
timestamp: February 12, 2017, 02:09:59 pm
content: Another trap for young players: Not all "2222" transistors are the same, even from the same manufacturer.http://www.onsemi.com/pub_link/Collateral/P2N2222A-D.PDFhttp://www.onsemi.com/pub_link/Collateral/MPS2222-D.PDFElectrically they're identical, but the pinouts are different! (Style 17 vs Style 1)You can probably guess how I discovered this...Moral - make sure you've got the correct datasheet!

author: Ian.M
author_rank: Super Contributor
timestamp: February 12, 2017, 02:49:43 pm
content: At least those two are a straight reversal. E-B-C or C-B-E. The Japanese style B-C-E TO-92 pinout is more of a PITA when you confuse it with the others! I haven't seen any B-C-E 2N2222ish transistors, but I wouldn't bet against finding them from a Chinese supplier.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 12, 2017, 04:34:31 pm
content: Offhand, 2SC1008, though it's probably not similar enough.Most Japanese generics are smaller. 2SC1815 is sort of like 2N3904, but not quite as fast.Tim

author: ScarceSam
author_rank: Newbie
timestamp: February 13, 2017, 01:59:24 am
content: First, thanks for all the feedback!So, the 2N2222s I ordered turned out to be 2N2222As. I chose them because they were cheap on Amazon. And because this is a temporary project, for learning, I'm not too concerned with quality or having the perfect part. I do want to learn how to find the best fitting parts. So maybe some of the things people have suggested next time. I'm still trying to figure out which specs to search on supplier web sites.However, I think I found my solution for this project. The Arduino 101 GPIOs alone can't keep the Relay Module input high enough to keep the optos off. But, it works with a 1k pull up resistor on the input from the Arduino to the relay board. This setup should be draining roughly 9 mA through the Arduino. Well below is max of 20mA.(the Relay module uses active low-level inputs so pulling them down switches the relay on, and the pins on the arduino are GPIO and GND respectively)I Think I'll use the setup above with the pull up resistor. Do I need a resistor for each individual input? I tried 4 inputs though one 1K resistor and it didn't work. I'll play with the values a bit for power savings but that's not super important. As stated previously, The plan is to use the Arduino and relay module to control the two 12v motors on a kids electric ride-on vehicle. I plan on having a common ground between everything but the Relay module will run off of the cars 12v battery and the Arduino will run off of a separate 9v battery.For future purposes, I'm considering altering the Relay Module so the optos are actually isolating the inputs from the rest of the circuit. (Ian’s suggestion)Above all else this is a learning experience for me. It's my first dabbling in anything less than 110VAC (former electrician). That's why I'm here, to learn from others. So, any other tips or suggestions would be greatly appreciated.Thanks,Sam

author: Ian.M
author_rank: Super Contributor
timestamp: February 13, 2017, 03:48:13 am
content: Great Progress!Your problem is the code that drives the relay module inputs. Your Arduino 101 has 5V tolerant I/Os. That means they can safely be connected to a 5V level logic '1' or a pullup to the 5V rail when they are inputs. However, when they are outputs, they either drive to 0V for logic '0' or to 3.3V for logic '1'. When driving to 3.3V, there is still 1.7V across the LED and its series resistor, enough to turn it on and weakly drive the ULN2803A input.You must be using something like:Code://in setup() ....digitalWrite(RELAY1,HIGH); // Start with relay 1 offpinMode(RELAY1,OUTPUT); // Output pin to control relay 1// ...// in loop() ...digitalWrite(RELAY1,LOW); // turn relay 1 ondelay(1000);digitalWrite(RELAY1,HIGH); // turn relay 1 offInstead, try:Code://in setup() ....pinMode(RELAY1,INPUT); // fake open drain output to control relay 1// As you didn't set it to INPUT_PULLUP, the output buffer is preloaded with '0'// ...// in loop() ...pinMode(RELAY1,OUTPUT); // turn relay 1 on (output preloaded to '0')delay(1000);pinMODE(RELAY1,INPUT); // turn relay 1 offYou shouldn't need external pullups to get the opto LEDs to turn off cleanly. If you do use them, its one per pin and you shouldn't go below 10K, as each resistor has 1.7V across it and dumps current into the Arduino's 3.3V rail if the pin is an output set to logic '1', and if the Arduino 101 cant use all the current dumped into the 3.3V rail, the rail voltage will rise and may destroy the Arduino 101.To convert your relay board to fully isolated optos, you'd need to make five track cuts and solder four patch wires to the cut tracks. Get me a good closeup of the optocoupler end of the board from directly above, lit from multiple sources above so there are no shadows, and I'll mark them for you. I've already worked them out on the board layout, but I need to consider access to make the track cuts and solder the patch wires. You'd need an Xacto knife or similar to make the cuts and scrape away soldermask, a fiberglass abrasive pencil brush to clean the tracks you need to solder to, thin solid core wire with insulaton tat doesn't burn back easily when you solder it - idealy Kynar inulated wirewrap wire, but magnet wire + a piece of very small bore sleeving for the longer run could also work.The other mod you could do, would be to simply desolder and remove all the optos and jumper pins 2 to 3 of each opto footprint to bypass them so the ULN2803A chips are directly driven by the input connector. A ULN2803A only needs 3.0V to turn on reliably, so the result would be compatible with both 3.3V and 5V logic. An alternative slightly uglier way to get the same result would be to remove the optos' LED feed resistor modules PR1,PR2,PR$ & PR7 to disable the optos then patch across each opto fom pin 2 to 3 as previously described.P.S Sorry about helping the thread go off into the long grass - topic drift is a perennial problem on Fora and USENET - almost a tradition.If you don't want it to happen as much you need to update frequently to corral off-topic debate and drag it back towards the issues you are actually interested in OTOH sometimes the O.T. stuff delivers real gems you wouldn't have thought of yourself.

author: raspberrypi
author_rank: Frequent Contributor
timestamp: February 13, 2017, 08:31:10 am
content: Whats wrong with 2n2222? When you say metal are you talking about the ones that look like flying saucers? I thought the 2n2222 was your everyday transistor.Also I'm finding sainsmart sucks balls. The epitome of chinese garbage.

author: Ian.M
author_rank: Super Contributor
timestamp: February 13, 2017, 09:00:49 am
content: PN2222 or P2N2222 is a 2N2222 die in a plastic package. 2N2222 is aJEDECpart number and specifies both the characteristics and the package - specifically a TO-18 metal can. The purpose of JEDEC was to promote second sourcing and interchangeability through standardisation, so they'd be rather pissed off with any of their members who released a standard part number in a non-standard package. It doesn't stop non-standard packages from low end far east manufacturers trying to cash in on the popularity of a JEDEC part, but as the black market component recycling and faking trade will remark *ANYTHING* as something more valuable with a vaguly similar number of pins, reputable manufacturers will modify the JEDEC 2N bipolar transistor prefix to indicate their electrically compatible product is in an updated package.'Flying saucer' transistors are usually old rare RF power devices. I'd describe the classic metal can TO series leaded packages as more like a top hat. When they are hermetically sealed with glass frit seals on the leads and a heavy metal baseplate bonded to the die they are pure class. The cheap and nasty ones with the transistor die on its lead frame gooped with Epoxy fill and jammed into the metal hat, not so much, especially if the fill has visible voids or is way short of the rim.