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.begin(9600);
      Serial.println( F("GPS Start") );  // F macro saves RAM
    
      gps_port.begin(9600);
      vw_set_rx_pin(11); // pin
      vw_setup(2000); // bps
      vw_rx_start();
    }
    
    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: ");
          //Serial.print(message[i]);
          received_number = message[i];
        Serial.println(received_number);
    
          if(received_number == 1){
            Serial.println("Triggered");
            getGpsData();    
          }
        }
    }
    
    void getGpsData() {
      Serial.println("im here");
      while (gps.available( gps_port )) {
        
        gps_fix fix = gps.read();
        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 );
          Serial.println("___________");
        }
        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

  • Very much informative!!!!

    read more
  • If you are using raspberry pi as one of your main computers and have separate monitor, keyboard and mouse, then you might be tired of copy and pasting terminal commands and codes while doing projects with raspberry pi, because running chromium-browser and reading tutorial will pi slower and using a sperate keyboard and mouse use our workbench space too.

    recently I read a blog Share your keyboard and mouse between computers with Barrier by Gordon Hollingworth which is cool.

    In that blog, he mentioned a software called barrier, it's a software that will allow you to use a single keyboard and mouse to control multiple computers by physically turning a dial on the box to switch the machine you're controlling at any given moment. The barrier does this in software, allowing you to tell it which machine to control by moving your mouse to the edge of the screen, or by using a keypress to switch focus to a different system.

    Follow these to share your computer keyboard and mouse with the raspberry pi

    First, we need setup raspberry pi

    Step 1: Download and Install Raspberry Pi OS on SD Card

    Step 2: Connect raspberry pi to the wi-fi network

    Step 3: Install barrier, for that open your terminal (Ctrl + T) and paste or enter the following

    sudo apt install barrier

    Then click enter.

    Step 4: Setup barrier, Open barrier by typing barrier on the terminal, if you successfully installed the barrier you can see like this.

    2020-07-02_19-54.png

    Select option Client (Use another computer's mouse and keyboard) and Select Auto config option too, also note the Screen name, which we need for the server.

    That's all next we need to set up the desktop/laptop computer.

    Step 5: Download and Install barrier on desktop or laptop computer (The Server), download link

    Step 6: Set up the barrier by selecting Server and position your monitor on barrier software. 004.png

    To Position, the screen clicks the configure server.

    005.png

    Here, to drag and drop the monitor icon to the desired position you need on the grid.

    007.png

    double click the screen and set the screen name, you can obtain the screen name from the raspberry pi barrier client. (See Step 4)

    008.png

    after setup, it should be like this. Then click OK

    2020-07-02_13-05.png

    in the following screen, click Apply and Just wait few seconds then try to move the mouse to the corner. Yes, It should work.

    read more
  • @rafitc99 Looks cool, Thanks for sharing. 👍

    read more
  • This is a speaker call for MakerChat by MakerGram. MakerChat is a webinar series where makers from different domain sharing their expertise with other fellow makers. MakerGram is an Open Community Platform for Makers and hardware enthusiasts to empower them by promoting learning, sharing and collaboration.

    Link: https://forms.gle/R5qhEhQeEe7UnJey9

    photo_2020-06-28_09-45-12.jpg

    Link: https://forms.gle/R5qhEhQeEe7UnJey9

    read more
  • The Challenge

    Do you think you can come up with some interesting ideas revolving around Amazon Alexa? What if we could help you build that idea into a reality. Tell us about your idea and the best one wins an Amazon Alexa Echo Dot.

    🧲 Bonus points for those solutions involving Covid-19 or promoting social-distancing.

    Schedule🗓

    Application - The application starts on 26th June 2020. Closing - The registration will end on 17th July 2020. Results - The results declared by last week of July

    For Registration: https://alexa.hackclub.com/

    AlexaChallenge

    read more