Radio Frequency 433 MHz Issue

Hello,

I need some help with my project. I use 2 arduinos megas, 1 bluetooth device, one 433MHz transmitter and one 433MHz receiver.

The first arduino is used to receive data from bluetooth and send it to the second arduino thanks to 433MHz. It send message of 25 characters long.

Everything works but sometimes, the second arduino don't receive the whole message. That's weird because each time it doesn't receive the whole message, it receives the first 13th characters. It seems to be half of the message...

Thanks to Serial.print, i checked that the whole message is gone and what does the second arduino receive. 1/10, the message is not complete.

I use that kind of 433MHz device :

http://www.amazon.com/Wireless-Transmitter-Receiver-Module-Arduino/dp/B00INTI8R2/ref=sr_1_1/186-7617021-6334227?ie=UTF8&qid=1452635385&sr=8-1&keywords=433Mhz+RF+link+kit

Is anyone able to help me? kikiz

Those are simple ASK modules. The transmitter can be turned on and off, that's all. The Arduino has to use software for a protocol. Since you receive only a part of the message, you didn't use a protocol (or a really bad one).

The best protocol is the RadioHead/VirtualWire : http://www.airspayce.com/mikem/arduino/RadioHead/ Use RadioHead with RH_ASK. The RadioHead also includes a checksum, so only valid messages are received.

Sometimes a message can be missed. You have to create a sketch that allows that sometimes a messages is not received.

Hello,

Thanks for your reply. I actually use VirtualWire to send/receive messages so the protocol seems to be good... For the most of the message sent, the whole message is received. I also send message of 70 characters in the setup function. I never had any problem in the message sent in the setup. So i don't understand... kikiz

That seems like a problem with three different causes. The VirtualWire/RadioHead is limited for size, perhaps a maximum of 26 charaters can be transmitted (I'm not sure). I think the VirtualWire/RadioHead uses pins for all three signals (rx, tx, ptt) regardless if they are used or not, you might have to check if they are set to unused pins. Receiving only a part is not likely, since the VirtualWire has a checksum. It has never happened to me that only a part was received. Therefor the most likely explanation is that your sketch is wrong, and you use a memory location that is not assigned to a variable, or you overwrite the memory, or your buffer is too small, or so big that you don't have enough dynamic ram for extensive memory usage for example for a String object.

I initialized the variables like this :

uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
String commande= “”; //I don’t the maximum size…

vw_set_ptt_inverted(true);
vw_set_rx_pin(15);
vw_setup(1200);
vw_rx_start();

VW_MAX_MESSAGE_LEN is set to 80 in the library.
I don’t use a PTT pin… Is it posible that’s the problem???

In void loop() , i wait the message with :

if( vw_get_message(buf, &buflen)){
commande="";Tcommande=0;

for(i=0;i<buflen;i++){
Serial.print(char(buf));
commande+=char(buf);
Tcommande=i+1;
}
}

Is it posible that TX send the message in two parts and i receive only one part sometimes??

I use 62% of the dynamic memory

I have another clue that could help to understand. Sometimes, when the RX gets some noisy message which has a size smaller than 25 (example : buflen =11), the next messages are then cut to the 11th character even when i send 25…

kikiz

I just find that on the virtualWire documentation :
"
Messages of up to VW_MAX_PAYLOAD (27) bytes can be sent

Each message is transmitted as:
•36 bit training preamble consisting of 0-1 bit pairs
•12 bit start symbol 0xb38
•1 byte of message length byte count (4 to 30), count includes byte count and FCSbytes
• n message bytes, maximum n is VW_MAX_PAYLOAD (27)
• 2 bytes FCS, sent low byte-hi byte

VW_MAX_MESSAGE_LEN is VW_MAX_PAYLOAD + 3 (= 30).
"

So VW_MAX_MESSAGE_LEN is 30 instead of 80.
Do you think the problem is due to the fact i send a message of 70 characters in the setup?

Kikiz