Author Topic: Am I using the 2N2222 correctly? edit-2N2222A  (Read 10573 times)

0 Members and 1 Guest are viewing this topic.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #25 on: February 12, 2017, 02:49:43 pm »
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.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21609
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #26 on: February 12, 2017, 04:34:31 pm »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline ScarceSamTopic starter

  • Newbie
  • Posts: 5
  • Country: us
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #27 on: February 13, 2017, 01:59:24 am »
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
« Last Edit: February 13, 2017, 02:31:31 am by ScarceSam »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #28 on: February 13, 2017, 03:48:13 am »
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: [Select]
//in setup() ....

digitalWrite(RELAY1,HIGH); // Start with relay 1 off
pinMode(RELAY1,OUTPUT); // Output pin to control relay 1

// ...
// in loop() ...

digitalWrite(RELAY1,LOW); // turn relay 1 on
delay(1000);
digitalWrite(RELAY1,HIGH); // turn relay 1 off
Instead, try:
Code: [Select]
//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 off

You 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.  :popcorn:  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.
« Last Edit: February 13, 2017, 03:58:18 am by Ian.M »
 

Offline raspberrypi

  • Frequent Contributor
  • **
  • !
  • Posts: 358
  • Country: us
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #29 on: February 13, 2017, 08:31:10 am »
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. 
I'm legally blind so sometimes I ask obvious questions, but its because I can't see well.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Am I using the 2N2222 correctly? edit-2N2222A
« Reply #30 on: February 13, 2017, 09:00:49 am »
PN2222 or P2N2222 is a 2N2222 die in a plastic package.  2N2222 is a JEDEC part 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf