Go Down

Topic: Arduino - Seeedstudio 433MHz module (Read 2 times) previous topic - next topic

TBAr

#10
Feb 12, 2010, 01:42 am Last Edit: Feb 12, 2010, 01:43 am by TBAr Reason: 1
@PaulS, see the Note toward the bottom of http://arduino.cc/en/Reference/PinMode:
Quote
The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).

PaulS

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.

CrashingDutchman

Here is how I use the Analog pins 2 and 3.

In setup:
Code: [Select]
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:
Code: [Select]

void powerOff()
{
 digitalWrite(16,LOW);
 digitalWrite(17,LOW);
}


void powerOn()
{
 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.

cjands40

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.

CrashingDutchman

Thanks for the explanation. Can you suggest a FET. In the mean time I will use google to see what a FET is/does.

Go Up