Interfacing both RF transmitter and receiver(433MHz) to a single arduino

Hi,

This may is a very dumb question and I am very new to the arduino world with little electronics as only a hobby. The most complicated thing i have tried in arduino may is the simple LCD thing(getting to display HELLO) (16X1 HD4420 driver) and that too with little success as surprisingly only 8 letters were showing up :-). But any way back to my original question,

Is it possible to have a single arduino to do the job of both transmitting and receiving see the below for the products that i have bought
transmitter - http://www.rhydolabz.com/index.php?main_page=product_info&products_id=387
receiver - http://www.rhydolabz.com/index.php?main_page=product_info&products_id=386

So to try it out what i did was to power up and connected the TX pin from arduino to the transmitter data pin and RX pin in SAME arduino to the receiver data pin, and as far as the code is concerned (which was a little easy for me as i am a software engg) was to combine both the receiver and transmitter code in the KLP walkthrough tutorial. But in the arduino board only TX led used to glow all the time since i was transmitting continuously some numbers and RX never used to glow. IS this very stupid! or am i the first one to try this?

You can't transmit and receive at the same time, the transmitter blocks out any reception. So you have to arrange some way of powering off the traansmitter while you lisen with the receiver.

Grumpy_Mike: You can't transmit and receive at the same time, the transmitter blocks out any reception. So you have to arrange some way of powering off the traansmitter while you lisen with the receiver.

Thanks for your reply but what is the best way to switch off the supply like a relay or something? (again i feel very dumb :-))

Yes a relay is the simplest. You can also use a top switch, that is one that powers by switching the positive line.

You can make one using a PNP transistor for 5V simply by connecting the emitter to +5v, base through a resistor (1K) to an arduino output and the collector to the supply of your transmitter.

what should be the ideal time gap or delay after i say Serial.print(something) and then i switch off the transmitter through the relay? Ideally i think i should receive something immediately right or again there is a time delay?

Are you using pins 0 and 1 to interact with your RF modules?

It may pay you to learn about NewSoftSerial, because then you will be able to talk to the RF modules over pins dedicated to that, not having to share with the Arduino's comms with the big PC used for sending programs (sketches) to the arduino, and receiving information for display on the serial monitor.

Also... why are you sending and receiving from one Arduino? I there another device somewhere else with another pair of RF modules? Get a simplex channel working first... i.e. sending from device A to device B. Once that's working, you can look at duplex... sending from A to B AND sending from B to A.

If expense is the reason only one Arduino is involved, consider an RBBB....

See...

http://www.arunet.co.uk/tkboyd/ele1psa.htm

For help with NewSoftSerial, see...

http://sheepdogguides.com/arduino/art4SeIntro.htm

tkbyd: Are you using pins 0 and 1 to interact with your RF modules?

Yes i have given pin 0 (RX) to the receiver data pin and 1 to transmitter data pin.

tkbyd: It may pay you to learn about NewSoftSerial, because then you will be able to talk to the RF modules over pins dedicated to that, not having to share with the Arduino's comms with the big PC used for sending programs (sketches) to the arduino, and receiving information for display on the serial monitor.

Do you mean to say that i cannot use RX and TX for sending data through RF channels because it is busy communicating with the big PC (serial monitor)? NewSoftSerial sounds good i will check that over the weekend thanks... Also please check my code below

int array_n[] = {1,3,5,7};//text numbers
int i;//just for counting the about number so if it 4 i make it zero again
int incomingByte = 0;

void setup()
{
  //2400 baud for the 434 model
  Serial.begin(2400);
  i=0;
}

void loop()
{
  //send out to transmitter
  Serial.print(array_n[i]);//TX glows and i get 1,3,5,7 in my Serial Moniter
  delay(10);//i think i need to give a delay
  i++;//increment the i
  if (i==4)
    i=0;//revert back the i value to zero to basically repeat the transmitting

  //check if the input is available, Since RX never glows, it never
  //executes the below code
  if (Serial.available() > 0) 
  {
    incomingByte = Serial.read();//reading from RX
    incomingByte++;//Just to verify, i increment the value
    Serial.println(incomingByte, DEC);//i expect once the number is tramsmitted, 
    //it should be read with the increment and print it on my moniter,
    //for a check, so expected would be 2,4,6 and 8
  }
  incomingByte = 0;
  delay(10);
}

tkbyd: Also... why are you sending and receiving from one Arduino? I there another device somewhere else with another pair of RF modules? Get a simplex channel working first... i.e. sending from device A to device B. Once that's working, you can look at duplex... sending from A to B AND sending from B to A.

:D I do kind of feel stupid to do that, but once i had these RF modules in my hand i wanted to test these so i thought the simple think to do at that moment was to hook both to the same arduino.

Right now i dont have any other thing to communicate with, and yes cost is one factor for me to buy an another arduino. But i am open for suggestions.

Also thanks for those links... i will definitely go through your (i hope its your site right?) serial tutorial and also something about converting my TV remote as an input... thats sounds very interesting as well... Thanks again

what should be the ideal time gap or delay after i say Serial.print(something) and then i switch off the transmitter through the relay? Ideally i think i should receive something immediately right or again there is a time delay?

As I said you can't do this without something else to receive your transmissions. If it is just a test then you could separate the TX and RX with very long wires but it is of no practical use. You can use pin 0 & 1 if you have nothing else going on with the PC.

Mike is (of course!) absolutely right when he says…

You can use pin 0 & 1 if you have nothing else going on with the PC.

… but time and time again things appear here in the forum where someone doesn’t have “nothing else going on”, but doesn’t realize it.