Go Down

Topic: problem with easytransfer and RFD21733 RF modules (Read 1 time) previous topic - next topic

John_Smith

Apr 14, 2013, 11:22 am Last Edit: Apr 14, 2013, 11:25 am by Boffin1 Reason: 1

I have used easytransfer before with simplex cheapy  modules with no trouble.

I am trying to send data at 9600 from the Txd pin of one Atmega 328,  to the Rxd of another.

The rf modules are tranceivers in simple mode,  the wavefore at the RX end ( green) is delayed a bit from the Tx,( red ) but looks the same as the Tx.

The waveform is actually measured  on the RXd pin of the chip.   The LED just stays on , any ideas where I am going wrong, I have been battling with trying to get a serial link going for a week now. the code is below




( I had to shift the green one to the left as the modules have a fifo  buffer that delaysTx abit )

I have loaded the example from the Github  ie the TX:-
Code: [Select]

#include <EasyTransfer.h>

EasyTransfer ET;

struct SEND_DATA_STRUCTURE{
 //put your variable definitions here for the data you want to send
 //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
 int blinks;
 int pause;
};

//give a name to the group of data
SEND_DATA_STRUCTURE mydata;

void setup(){
 Serial.begin(9600);
 //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
 ET.begin(details(mydata), &Serial);

 pinMode(13, OUTPUT);

 randomSeed(analogRead(0));

}

void loop(){
 //this is how you access the variables. [name of the group].[variable name]
 mydata.blinks = random(5);
 mydata.pause = random(5);
 //send the data
 ET.sendData();

 //Just for fun, we will blink it out too
 for(int i = mydata.blinks; i>0; i--){
   digitalWrite(13, HIGH);
   delay(mydata.pause * 100);
   digitalWrite(13, LOW);
   delay(mydata.pause * 100);
 }

 delay(2000);
}




and the receive ( with different pin for the LED ) :-
Code: [Select]



#include <EasyTransfer.h>

//create object
EasyTransfer ET;

int ledPin = 10;

struct RECEIVE_DATA_STRUCTURE{
 //put your variable definitions here for the data you want to receive
 //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
 int blinks;
 int pause;
};

//give a name to the group of data
RECEIVE_DATA_STRUCTURE mydata;

void setup(){
 Serial.begin(9600);
 //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
 ET.begin(details(mydata), &Serial);

 pinMode(ledPin, OUTPUT);

}

void loop(){
 //check and see if a data packet has come in.
 if(ET.receiveData()){
   //this is how you access the variables. [name of the group].[variable name]
   //since we have data, we will blink it out.
   for(int i = mydata.blinks; i>0; i--){
     digitalWrite(ledPin, HIGH);
     delay(mydata.pause * 100);
     digitalWrite(ledPin, LOW);
     delay(mydata.pause * 100);
   }
 }

 //you should make this delay shorter then your transmit delay or else messages could be lost
 delay(250);
}

45 years of editing projects with a knife and soldering iron, then I found Arduino !

John_Smith

Familiarity breeds contempt !


I am so used to 3v GPS and wireless modules  output being OK for testing on a 5v Arduino input,  I overlooked it.

I have fitted a couple of transistors and a resistor for a level converter and it is now fine.

I can understand that pin 0 might be a different ,  as it has an internal resistor,  but I had the same trouble with pin 14 ( but when it was hooked to the Arduino pin 14 it worked on the Arduino !   )

A very time consuming lesson, in future I will either run the 328 at 3v3 or fit the transistors to the actual Rx module.
45 years of editing projects with a knife and soldering iron, then I found Arduino !

Go Up