transistor base resistor value

Hi All,

Can someone tell me the resistor value at the base of the transistor.

Transistor: 2N2222

Transistor Base is connected to Arduino D3. Transistor Emitter is connected to Ground of Arduino Transistor Collector is connected to MOC3021 pin 2 and MOC3021 pin 1 connected to +5v from Arduino

What is the transistor good for? You can directly connect the MOC3021 Pin 1 via a Resistor (330 Ohms..1k) to your Arduino Pin. ( MOC Pin 2 to GND )

With a transistor in between, you need 2 resistors ...

michael_x: What is the transistor good for? You can directly connect the MOC3021 Pin 1 via a Resistor (330 Ohms..1k) to your Arduino Pin. ( MOC Pin 2 to GND )

With a transistor in between, you need 2 resistors ...

I do have another circuit as you mentioned but this time I want to control MOC using 0V

still no need orf a transistor : as michael_x says, you connect MOC pin 2 to an arduino output via a resistor (which will limit the current) , MOC will be “OFF” if output is HIGH, and “ON” if output is LOW .

330 Ohm will limit the current at about 11mA , which is OK

If you use a transistor, you need a base resistor and a collector resistor to limit the current < 50mA

Use 15mA, that is the maximum current needed to guarantee triggering, ie arduino pin -> 270 ohm -> anode, cathode -> ground.

The datasheet is a little confusing on this, as they show typical triggering currents which are no use to anyone who wants reliable operation!

alnath:
still no need orf a transistor : as michael_x says, you connect MOC pin 2 to an arduino output via a resistor (which will limit the current) , MOC will be “OFF” if output is HIGH, and “ON” if output is LOW .

330 Ohm will limit the current at about 11mA , which is OK

If you use a transistor, you need a base resistor and a collector resistor to limit the current < 50mA

Not possible to do this, I also have an LED. In this case, when output is HIGH LED will be ON and MOC will be OFF.

when you ask for help, it is always better to give all information, nobody can guess what you are actually doing, and which component you want to use !

anyway, it is possible : which LED are you planning to use ? if it is a basic red one like this one , you could try this :

arduino pin -> resistor 100 Ohm -> LED anode, LED cathode -> MOC anode , MOC cathode -> GND

when arduino pin is HIGH, both LED and MOC are ON, and the current will be about 15mA

Or, if you want to have a led "shine" when a pin is LOW, just connect the anode (+) to 5V and the cathode (-) to a resistor and the signal pin.

Still not sure which state you call "MOC ON", or why you initially want to invert something with a transistor. Usually, MOC ON and LED ON should be the same: current flow makes both the led shine and the triac side of the opto switch on.

Hi All,

Thanks a lot for all your help. I will go as @alanth says in port #3

I think that MarkT answer #4 if no LED or answer #6 (if LED) are even better