Go Down

Topic: Aurdino uno trouble with RF module..random numbers (Read 694 times) previous topic - next topic

yuva9999

Hi fellow members ,I am having a bit of trouble with arudino uno when using RFModule 433Mhz .

I am able to communicate with both Rx and Tx but the problem is when checking the serial monitor I am receiving lot of random numbers... I have used "virtual library",what could be the problem I have used an oscilloscope and verified that both are sending information as i can see the pulses on the screen..

Receiver code

Code: [Select]
#include <VirtualWire.h>

void setup()
{  
   Serial.begin(9600);      
   Serial.println("setup");

   vw_setup(1200);       // Bits per sec

   vw_set_rx_pin(11);   // RX pin is 2
   vw_set_tx_pin(12);   // RX pin is 3, no used
   vw_set_ptt_inverted(false); // Required for DR3100, not used
   vw_set_ptt_pin(4);  // Move the ptt pins to 4, not used
   vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
   uint8_t buf[VW_MAX_MESSAGE_LEN];
   uint8_t buflen = VW_MAX_MESSAGE_LEN;

   if (vw_get_message(buf, &buflen)) // Non-blocking
   {
     int i;

       digitalWrite(13, true); // Flash a light to show received good message
     // Message with a good checksum received, dump it.
     Serial.print("Got: ");
     
     for (i = 0; i < buflen; i++)
     {
         Serial.print(buf[i]);
         Serial.print(" ");
     }
     Serial.println("");
       digitalWrite(13, false);
   }
}



Transmitter

Code: [Select]
#include <VirtualWire.h>

void setup()
{
   vw_setup(1200);               // Bits per sec

   vw_set_ptt_inverted(false); // Required for DR3100
   vw_set_tx_pin(12);           // Uses the same pin as SoftSerial
}

void loop()
{
   const char *msg = "hello";

   digitalWrite(13, true); // Flash a light to show transmitting
   
   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx(); // Wait until the whole message is gone

   delay(100);
   digitalWrite(13, false);
}


I have gone through most forum posts on Aurdino & RF communication and tried most of them but still no success even tried putting 30 cm antenna  :~

Please kindly advice.


Please kindly advice what steps to take next

CrossRoads

Receiver:
   vw_set_rx_pin(11);   // RX pin is 2  << which pin are you actually using?
   vw_set_tx_pin(12);   // RX pin is 3, no used  << which pin are you actually using?
   vw_set_ptt_inverted(false); // Required for DR3100, not used    << take this line out, very few receivers have this pin
   vw_set_ptt_pin(4);  // Move the ptt pins to 4, not used    << take this line out, very few receivers have this pin

Transmitter:

   vw_set_ptt_inverted(false); // Required for DR3100   << take this line out, very few transmitters have this pin

vw_setup(1200);               // Bits per sec   << put this after any other vw commands


If all else fails, go back & try the default pins and the example transmit/receive code here
http://www.open.com.au/mikem/arduino/VirtualWire/examples.html
with this line commented  out
   vw_set_ptt_inverted(true); // Required for DR3100


"even tried putting 30 cm antenna  "  17cm antenna needed for 433 MHz




Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

yuva9999

Thank you sir Cross Roads for your reply..but unfortunately I am not getting sufficent results, have been trying this for more than 3 days all I am getting is an garbage value which looks like some random numbers for every word does it need any encoder...


I

Erdin

The VirtualWire is the (software) encoder/decoder.

You send 6 bytes, 10 times a second. That is 60 bytes per second. That is 480 bits for the data. But a lot of overhead is added. Your bitrate is 1200.
The 480 is too close to the 1200, could you make the delay 500ms ?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy