GPS + RF433 Not working together.

  • I need to get GPS location while a Trigger occurs. I'm sending trigger via 433Mhz RF transmitter. In the receiver, part contains a GPS module (NEO-7M) to get GPS location and RF 433Mhz to receiver RF message. (Refer code) My problem is by combining GPS + RF. GPS module not giving location details. While checking i found that while (gps.available( gps_port )) not running while #include <VirtualWire.h> is occur. I got a similar error while using SoftwareSerial.h with Radiohead.h

    What is the problem with these two libraries? Why Serial.available() not working in this code

    #include <NMEAGPS.h>
    #include <NeoSWSerial.h>
    #include <VirtualWire.h> 
    byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
    byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
    int received_number = 0;
    int LED = 5;
    int i =0;
    NeoSWSerial gps_port(6,7);
    NMEAGPS gps;
    void setup(){
      Serial.println( F("GPS Start") );  // F macro saves RAM
      vw_set_rx_pin(11); // pin
      vw_setup(2000); // bps
    void loop(){
        // Set buffer to size of expected message
        uint8_t buf[1];
        uint8_t buflen = sizeof(buf);
        // Check if received packet is correct size
      if (vw_get_message(message, &messageLength)) // non-blocking
        Serial.print("Potentiometer: ");
          received_number = message[i];
          if(received_number == 1){
    void getGpsData() {
      Serial.println("im here");
      while (gps.available( gps_port )) {
        gps_fix fix =;
        if (fix.valid.location) {
          float outArray[2];
          outArray[0] = fix.latitude();  // Arrays start at 0, not 1.  Did you really mean [1] here?
          outArray[1] = fix.longitude();
          Serial.println( F("Latitude:") );
          Serial.println( outArray[0], 6 );
          Serial.println( F("Longitude:") );
          Serial.println( outArray[1], 6 );
        else {
          Serial.println("GPS Not availble");

  • @rafitc99 said in GPS + RF433 Not working together.:

    I got a similar error while using

    Can you share the error here, also share the library link that you are using.

  • @salmanfaris Not syntax error. its not reading GPS data. That's the problem.

  • What output you are getting? Just some zeros?

  • @salmanfaris No any output. Arduino not wating for GPS data.Not runing this loop while (gps.available( gps_port ))

  • does it return one/true when you are testing only with gps and gps.available( gps_port )?

  • @salmanfaris gps.available( gps_port ) Is not return a True case.

  • @salmanfaris for running while(gps.avaible()); MCU need to wait some time. but after adding VirtualWire library it's not waiting for Serial.available()

  • @rafitc99 said in GPS + RF433 Not working together.:

    ps.available( gps_port ) Is not return a True case.

    Then how is the while loop will work? It should return!

  • @rafitc99 said in GPS + RF433 Not working together.:

    library it's not waiting for Serial.available()

    did you try manual waiting? Instead of delay, you can use mills, so the background works will keep run.

Log in to reply

Recent Posts