hello, i want to make a relay driver for gh-1c-12l relays using an arduino, 2n222A331 transistor with a resistor for the base and 1n4007 diode. since the relay needs 12v i got a 12v 2A power source that output 12.2v and i hope i can use it to power the arduino nano or i have to use a buck converter for arduino pro mini on 5v. i measured 0.4Kohm on the realy coil with a multimeter that means 12v/400ohm = 0.03A or 30ma that the coils draw. i did not understood how the resistor value is calculated acording to base current that can be 20-40ma from arduino digital pins and the current that the coil needs to be safe.. also if the emitter ground can be conected either to the arduino ground or the psu ground since it is the same, one some pictures i saw that the emitter is in the left side of the transistor and others say it is in the right for the 2n2222
also i have a rf 315mhz yk04 module that has 4 digital outputs for interacting with arduino and i was thinking for using an 100uF cap at input 5v and gnd and one bigger at arduino vin, may that hurt in any way and what antena size , gauge and lenght i need for 315 mhz ?
That circuit is fine. For 30mA load like that relay you need about 3mA into the transistor's base - 10% of the load current(*). So 1k5 would work, but there's no harm using 220.
Yes pinouts can vary depending on package, a quick check with the diode mode of
a multimeter can figure out where the base pin is, if you want confirmation.
(*) For switching the base current should be about 5 to 10% of the collector current, whatever transistor you use, as you want saturation, not just conduction.
The 220 Ohms value is a bit low to use on an arduino output.
5V arduino output
Transistor Vbe in conduction = 1.2V.
5.0 - 1.2 = 3.8
Current with 220 Ohm resistor
3.8 / 220 = ~ 17 mA. (Arduino output maximum limit = 20 mA).
A simplified way to calculate the base current in this case,
is to use the hfe of the transistor.
Ibe = Ice/hfe.
This transistor has a minimum hfe of 35.
To get a collector current of 30 mA, then:
30/35 = ~ 1 mA
5V arduino output
Transistor Vbe in conduction = 1.2V.
3.8 / 1 ma = 3800 ohms.
Can safely use a 2000 (2K) ohm resistor.
Vbe when saturated is about 0.75V realistically but I get your point. No need to waste away power with a small 220 ohm resistor. Use Kohm range resistors. Use a MOSFET if you wish to save power.
so basically i need 30ma output and i get that from ohms law i=v/r , i = 5/1.5kohm = 0.3.
with no antena i get blinking reads at the receaver when i have to get a continuous output high, only if i take it as close as posible it turn high all the time, if i don't point it straight it doesn't work and i would need it to work after a wall corner under 100meters. with nrf i was able to get almost 1km but this 315mhz module is way worse, i liked the remote key so that i won't need another pair of arduinos and transmitters to sent the data . could i use 23A 12v battery with arduino ?
The transmitter should remain with the telescope antenna, we should hope that it is tuned correctly and effective.
Now I am with @anon57585045, assuming he did the maths right, he did I am sure.
You need to soldered a straight wire of that length on the antenna pad of the receiver.
The gauge does matter, but we aren’t going to the Moon or anything, just stiff small gauge solid wire will be adequate for the moment.
I happen to use old telephone wire, 24 AWG, for these antennae.
If you don’t get better performance using the demo program, it may be because the units are inferior.
There are a crap-ton of cheap 433 and 315 rx/tx module pairs, quality varies and price is no guarantee.
You might want to explore other kinds of rx/tx modules, I’ve not used them but LoRa has been spoken of well, easy enough to use. Google is your friend here.
I would use the nrf24l01 instead but for that i need a long life battery for the arduino mini. What is the pinout of the 2n222a301 trasistor,? in datasheets shows in oposite ways