I have a Seeedstudio 433MHz tx/rx that I want to use with Arduino. The transmitter can be powered from 2-12V. Higher voltage, better range according to Seeedstudio.
I am not very good at drawing schematics with Eagle, but I threw together the one below.
I want to power the RF Transmitter with 12V, but not all the time. I want to switch power on and off through a transistor, a BV337-16 in this case. Switching is done through Arduino analog pin 2 (+5V) to collector and transistor emitter to analog pin 3 (GND). There is +12V at the base of the transistor. As soon as pin 2 goes high, the RF module should be powered with 5V.
At least, this is how I planned to do it. Is there anyone who can check the schematic and my explanation above to confirm it's correct?
Thanks in advance!
Why are you connecting to analog pins? Analog pins are for input. Digital pins are for input or output (HIGH or LOW being +5V or 0).
I am using analog pins because I took the code from an example (Wiichuck adapter).
It seems like you got your transistor wired wrong. Current flows from collector to emitter, switched through base.
So - connect RF/Vcc to +12V, RF/GND to collector, emitter to GND and Arduino pwr on/off pin (ana 2) to base through 2k2 resistor.
When you power the RF module you need to delay a minimum of 20ms before you send data.
Thank you for your reply BenF,
I have it like this now:
Pin description of RF Module:
Pin 1 - VCC
Pin 2 - Data
Pin 3 - GND
Pin 4 - Antenna
You mention a 2.2K resistor, I have 2.5K. Should I get a 2.2K for this?
Looks good to go!
The transmitter needs about 60mA at 12V and with your transistor's minimum Hfe at 100 you get away with anything less than 7k for a base resistor. That is 2.5k will be just fine.
Don't forget you will need a ground connection between the +12vdc supply and the Arduino ground.
I did exactly as above (incl. Lefty's suggestion), but it doesn't seem to send anything. Will do some more testing tomorrow.
I will post again when I have more information.
I just noticed you have drawn a connection from emitter to ana3. There is no need for this - just wire it directly to Arduino ground (common with 12V DC ground).
Ana2 (digital 16) and digital 12 (data) must be set to pinMode output. Also remember the delay (minimum 20ms) from turning on power (ana2 to high) and starting to transmit. If you still have issues (and know the receiver side is good) try with a full second delay (or leave it powered on) before transmitting to rule out power-on time as a possible cause.
How are you supplying power to the transistor? The analog pins are for reading data. I don't believe you can use them as output pins.
@PaulS, see the Note toward the bottom of http://arduino.cc/en/Reference/PinMode:
The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
There has been no indication that OP was going to refer to the analog pins using the 14+ numbering. I wanted OP to be aware that analog pins are input only.
Here is how I use the Analog pins 2 and 3.
pinMode(16, OUTPUT); // +5V - Arduino analog pin 2
pinMode(17, OUTPUT); // GND - Arduino analog pin 3
I have 2 functions to power on and power off the rf transmitter:
digitalWrite(16,HIGH); // Pin 2
digitalWrite(17,LOW); // Pin 3
delay(1000); // wait for things to stabilize
So, I understand that I should use digital pins? I have been using the same code with analog pin 2 and 3 when I powered the RF transmitter with only 5V. Because at 5V the distance I need is not enough, I switch to 12V by using the transistor.
I hope to do some more testing this afternoon.
The Wiichuck adapter uses analog pins 2 and 3 (actually, digital pins 16 and 17) as a tricky way to provide power. There is really nothing special about these particular pins - they are simply adjacent to the I2C pins it needs for communication. Any digital output can safely source (when set to "1") or sink (when set to "0") up to around 20 mA on a continuous basis.
This trick is no longer applicable for you since you now want to use 12V to power the transmitter. You can use a transistor to turn on/off 12V to the transmitter (high side switch) or to connect/disconnect the transmitter's GND pin to Arduino GND and 12V power supply GND (low side switch). Your second schematic is essentially a low side switch (do as BenF said and connect it to GND instead of analog 3) but an NPN transistor is not really appropriate for the job - use a FET. If you use a logic level FET, you can avoid needing external logic to drive the gate.
Thanks for the explanation. Can you suggest a FET. In the mean time I will use google to see what a FET is/does.