Go Down

Topic: Two Rx Modules prints different values? [solved] (Read 171 times) previous topic - next topic

Noobian

May 03, 2018, 05:28 am Last Edit: May 04, 2018, 09:34 am by Noobian
I have a project where one arduino transmits simple data to another arduino using cheap 433MHz RF modules. This works fine but now I bought another type of 433MHZ Rx module so that another arduino can also get the data and this is where the problem starts.

Both receiving arduinos print different values. The first one that used the cheap receiver is printing the correct value and the new one is printing a value much lower than the first one.

The new receiver I'm using is of superheterodyne type, could that be the problem?
both modules uses the same library and code but the first arduino is a nano whereas the new one is an uno. Both modules are powered from the arduino 5v pin.

Here is the code that both arduino runs.
Code: [Select]

#include <VirtualWire.h>
     
const int led_pin = 13;     
const int receive_pin = 2;

void setup()
{
  delay(1000);               
  Serial.begin(9600);         
  Serial.println("setup");   
  vw_set_rx_pin(receive_pin);
  vw_setup(2000);             
  vw_rx_start();             
  pinMode(led_pin, OUTPUT);   

}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN];     
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen))   
   {
  digitalWrite(led_pin, HIGH);
  Serial.print("Got: ");       
  Serial.print(buf[0]);       
  Serial.println();           
  digitalWrite(led_pin, LOW); 
   }

}



currently my first arduino prints a value "51" and my new one prints "36".


Update:

adding Tx sketch
Code: [Select]

#include <NewPing.h>         // Ultrasonic module library
#include <VirtualWire.h>     // RF module library

const byte TRIGGER_PIN = 11; // Trigger pin on D11
const byte ECHO_PIN    = 12; // Echo pin on D12
const int MAX_DISTANCE = 200;// Max distance set at 200cm

const int led_pin = 13;      // LED Indicator pin
const int transmit_pin = 10; // TX data pin

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);  // Set Ultrasonic


void setup()
{
  Serial.begin(9600);          // Serial communication at 9600 bauds
  vw_set_tx_pin(transmit_pin); // Set TX pin
  vw_set_ptt_inverted(true);   // Required for DR3100
  vw_setup(2000);              // Transmitter Bits per sec
  pinMode(led_pin, OUTPUT);    // LED Indicator
}

void loop()
{
  delay(1000);                   // Wait (milliseconds) between each ping
  int a = sonar.ping_median(5);  // Digital filter by taking median of (x) number of pings
  a = sonar.convert_cm(a);       // Convert median to average in cm


  byte g = (int) a;            // Convert the integer 'z' into byte 'g'
  digitalWrite(led_pin, HIGH); // Flash LED to show transmitting
  vw_send(&g, 1 );             // Transmit the Byte 'g'
  vw_wait_tx();                // Wait until the whole message is gone
  Serial.print(g);             // Print the Byte 'g' on Serial Monitor
  Serial.println();            // Set Print on next line
  digitalWrite(led_pin, LOW);  // Turn off LED
}

cattledog


noweare

Print out the rest of the buffer not just the first element that will give you a clue.

Noobian


cattledog

I don't see anything in your code which would be producing the problem. If you switch receivers between the nano and the uno, does the problem follow the receiver?

Quote
The new receiver I'm using is of superheterodyne type, could that be the problem?
Those receivers are typically "better" and have more range. Are there any other transmitters in the area?
How are the three arduino's and their antennas arranged? Do things change if they are moved to a different arrangement?

Are both receiver arduinos printing at the same time, once per second? If this is too fast to see any difference, try increasing the delay between transmissions, to see if the reception on the two receivers is at the same time.





Noobian

#5
May 04, 2018, 08:08 am Last Edit: May 04, 2018, 08:29 am by Noobian
Thanks for the checking my sketch cattledog, I did some more tests like you suggested and here are my observations. Also I found out the model of my receiver module, it's called "LR45B".

If you switch receivers between the nano and the uno, does the problem follow the receiver?
I tried switching the Arduino boards and Yes the problem follows the receiver module. Maybe the library is not meant for this type of module?
I also tried another superheterodyne module called RXB12 and the results were the same as LR45B. When my Generic 433MHz Rx module reads 51, LR45B and RXB12 reads 40. So both superheterodyne modules are reading the same value.

Update: Oops my bad, The reading was correct for the superheterodyne module when connected to the first arduino nano. what could possibly be the problem??

Are there any other transmitters in the area?
Nope, I have only a single 433MHz transmitter, nothing else. No other sources of 433MHz transmission in my knowledge.

How are the three arduino's and their antennas arranged?
The Generic 433MHz modules have a simple 15cm single core telephone wire as their antenna in vertical position. LR45B modules has a spring coil copper antenna that came with it and has about 21 turns and is 2-3cm tall. RXB12 has no antenna attached. They all receive the signal at a distance of about 8M through one reinforced concrete floor.


Do things change if they are moved to a different arrangement?

The generic module has difficulty receiving signal if its antenna position is tweaked and stops receiving signal and also has somewhat poor range. LR45B module receive signal whether it's coil antenna is placed horizontally or vertically and has better reception range than the generic module. RXB12 receives the signal without any antenna when placed horizontally.


Are both receiver arduinos printing at the same time, once per second?

Yes they are. The arduino built in led indicator blinks at the same time when they receive their signal and also prints at the same time.

Noobian

Update: Tried it a new nano and it works fine printing the correct value. Looks like something was wrong with the uno. I couldn't figure out what exactly was wrong with the uno so it's going to the trash can.

Problem solved. Thanks for the suppport @ cattledog.

Go Up