RF-433 MHz transiver module help

Hi everyone I am considered a noob in this world. I would like to get your expertise in the problem I am facing.

in a simple way I am trying to create a network communication between 1 arduino lets call it (server) and 5 other arduino's ( slave) but the slave has to send specific data to receive instructions for movement.

that mean's each Arduino needs to send and receive Data.

my choice of networking is to use the RF-433MHZ transceiver module which seems to work (poor) after a day of playing with it. and that's communication between only 2!

the problem is that amount of data being sent is not consistent and right now I am only sending one digit data back and forth and a photo sensor reading, which is lagging by 6 to 8 seconds.

I am not sure if the code structure is wrong? or my choice of network is just crap!

and if there is any techniques to use in the code to help make the connection better ?

what do you guys suggest ?

I attached the code for both sending and receiving!
I am sorry I am not a good coder I just started to learn. if you have any suggestion on improvement I would really appreciate it!

Thanks!

 #include <VirtualWire.h>

int lightsend;
int photopin =0;
int photocellval =0;
char photopinCharMsg[21];
char StringReceived[22];  // rec 
boolean tra = true;
boolean sent = false;
void setup() {
  Serial.begin(9600);
  pinMode(photopin, INPUT);
  vw_setup(1000); // Bits per sec
  vw_set_tx_pin(12);// Set the Tx pin. Default is 12
  vw_set_rx_pin(11);  
}


void loop() {

// SENDING 
    photocellval = analogRead(photopin);
    sprintf(photopinCharMsg, "%d,%d,", photocellval);
    vw_send((uint8_t *)photopinCharMsg, strlen(photopinCharMsg));
    vw_wait_tx();
    Serial.println("messageSent");
    delay(1000);
    
  // RECEIVING 
  
      vw_rx_start();
      delay(1000);
      
    uint8_t buf[VW_MAX_MESSAGE_LEN]; // max length of the message 
    uint8_t buflen = VW_MAX_MESSAGE_LEN; // buffer we have to go thtough to get data 
    if (vw_get_message(buf, &buflen))
    {
      for (int i = 0; i < buflen; i++) {
        StringReceived[i] = char(buf[i]);
      }
      sscanf(StringReceived, "%d,%d",&lightsend);
       Serial.println(lightsend);
    } 
  Serial.println("messagereceived");
  memset( StringReceived, 0, sizeof( StringReceived));
vw_rx_stop();
delay(50);
}
#include <ServoTimer2.h>
#include <VirtualWire.h>
#define servopin  8

ServoTimer2 testservo;

boolean tra = true;

int servoval;
int photocellval;
int led =12; 
int val;
char StringReceived[22];  // rec 
char lightsend[21]; // send 


void setup() {

  Serial.begin(9600);
  testservo.attach(servopin);
  vw_setup(1000); // Bits per sec
  vw_set_tx_pin(12);// Set the Tx pin. Default is 12
  vw_set_rx_pin(11);  
 

}

void loop() {

  vw_rx_start();   
   delay(1000);
  uint8_t buf[VW_MAX_MESSAGE_LEN]; // max length of the message 
  uint8_t buflen = VW_MAX_MESSAGE_LEN; // buffer we have to go thtough to get data 

  if (vw_get_message(buf, &buflen))
  {
    for (int i = 0; i < buflen; i++) {
      StringReceived[i] = char(buf[i]);
    }
    sscanf(StringReceived, "%d,%d",&photocellval);
  }
 Serial.println(photocellval); 
 
  vw_rx_stop();
  sprintf(lightsend, "%d", led);
  vw_send((uint8_t *)lightsend, strlen(lightsend));
  vw_wait_tx();
  Serial.println("message sent ");
      delay(1000);
  }
  
  
//  if( photocellval < 500){
//    testservo.write(1500);
//  }
//
//  else if ( photocellval >= 500 && photocellval < 1000  ) {
//
//    testservo.write(1300);
//
//  }
// 
//  else if ( photocellval >= 1000 ){ 
//    testservo.write(1500);
//  }
//
//  // photocellval = 0;
//  memset( StringReceived, 0, sizeof( StringReceived));
//  //vw_rx_stop();
//    Serial.println(photocellval);
//  delay(1000);


void tr() {

}

void rc() {
}

Do you have antennas on both transmitters and receivers? Should be a stiff vertical wire about 17 cm long.

Keep in mind that with these cheap modules, there is only one channel. Any 433 MHz transmitter in the vicinity, like many remote temperature sensors, etc. will interfere with reception.

yea I made my own antenna. I don't need huge distances I am just setting up a small experiment in a 6ftX6ft.

another question is a way to smooth out or average the incoming data ? that might help create some clarity in the data transmission and if there is a way to create separate ID's per robot ?

I have not seen a 433MHz transceiver (only transmitter receiver pairs), where did you get them from?

Hi Chilli I apologize for my bad explanation they are pairs of receiver and transmitter I am using a pair per arduino

I used a separate transmitter and receiver pair. Antennas were just a bunch of wire near the correct lengt. I could get very good reception with about 100-300 meter max range. Baudrate was 2400bauds. So with a correct devices there are no problems. I send the same data three times. That was for error correction.

I bought my modules ready made from UK. There are transceivers now surely. And probably some models with multiple channels.

Do you try to transmit and receive at exactly same time, That could block the receiver expecially if your antennas are very close together. Or if you use common antenna for transmit and receive.

In which case you need to bear in mind that they may interfere with each other. If you transmit from one Arduino, its receiver will also pick up the transmission.

Consider using a 2.4GHz transceiver instead like an NRF24L01.