SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By Siddartha
#190649
I am interested in using my Adafruit Feather Adalogger (ATmega 32u4: https://learn.adafruit.com/adafruit-fea ... -adalogger) to send a simple activation command to my Arduino Uno through a wireless RF link using:

RF Link Transmitter (https://www.sparkfun.com/products/10534) which is connected to the Adafruit Feather Adalogger.

RF Link Receiver (https://www.sparkfun.com/products/10532) which is connected to the Arduino Uno.

I am not interested in 2-way communications. I am not interested in detailed messages. The Feather will simply tell the Uno to begin running a sketch that is already loaded in the Uno's program memory. When the Uno receives this wireless command from the Feather, the Uno will run its sketch for about 1 minute, and that will be all that the Uno will need to do.

The Spark Fun literature for the RF Link Transmitter/Receiver (https://www.sparkfun.com/datasheets/RF/ ... hrough.pdf) shows some sample code for the Transmitter and the Receiver:

/*
* Simple Transmitter Code
* This code simply counts up to 255
* over and over
* (TX out of Arduino is Digital Pin 1)
*/
byte counter;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
}
void loop(){
//send out to transmitter
Serial.print(counter);
counter++;
delay(10);
}


/*
* Simple Receiver Code
* (TX out of Arduino is Digital Pin 1)
* (RX into Arduino is Digital Pin 0)
*/
int incomingByte = 0;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
}
void loop(){
// read in values, debug to computer
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
}
incomingByte = 0;
}

I am new to Arduinos and programming, and so I am somewhat confused. Both sets of code use the Serial.begin(2400) command. I have only used this command previously when using the Serial Monitor in the Arduino IDE. I thought that this command only applied to the Serial Monitor. Does it somehow open a UART that allows communication between the Transmitter and Receiver?

Also, am I supposed to connect the TX pin on the Feather to the Data In (pin 2) of the Transmitter, and the RX pin of the Uno to the Digital Data Output (pin 2) of the Uno?

If I use the Serial.begin(2400) command for the one-way communication between the Feather's Transmitter and the Uno's Receiver, can I still use the Serial.begin(9600) command elsewhere in my Feather's sketch to use the Serial Monitor?

My Feather's sketch uses a timer interrupt service routine in one part. Can that interfere with using the Serial.begin(2400) command in the part of the Feather's sketch that uses the Transmitter?

Any advice would be greatly appreciated.
By jremington
#190661
The code you posted simply sends characters through the serial port, just as it does when sending them to the serial monitor. This won't work well, or at all under many circumstances, with those radio modules. It will not work at all in conjunction with the serial monitor, because you have only one serial port.

Those radio modules require a lot of signal processing for reliable data transmission. Use the VirtualWire or RadioHead libraries to send data, and make sure to have proper antennas (17 cm straight wire) on both transmitter and receiver.

ALWAYS use code tags when posting code.