GPS + nrf24l01

Hello Everyone,

I am trying to send GPS data via the NRF24L01 module. I have perfectly working GPS code that accurately gives me the data I want, and I have perfectly working RF code which transmits data to my receiver. However, when I put both modules together, the GPS stops working. If I comment out the line "radio.write(&gps_data, sizeof(gps_data))" my GPS starts printing data to the serial port again. If I uncomment the line, my GPS only prints zeroes to the serial port. I have gone through and debugged every line of the code, and have found that the only thing that stops the GPS working is having this line of code at the end of my loop. Images Capture and Capture 1 display the working GPS without the line, and images Capture2 and Capture 4 display the GPS not working when the line is included in code. All these images are attached to this post.

I have included my code as well. Note I am using .CPP and .H files, so my GPS functions are in the GPS.cpp file. This code works perfectly and returns accurate data. I used the Adafruit ultimate GPS library. I am using an NR24L01 module and an Adafruit Ultimate breakout GPS, all running on a Teensy 4.0.

GPS TX is connected to Teensy RX (Pin0) AND gps rx is connected to Teensy TX (pin 1).

Capture2.JPG

Capture4.JPG

GPS.cpp (5.11 KB)

GPS.h (138 Bytes)

GPS_Testing.ino (1.28 KB)

Capture2.JPG

Capture4.JPG

Please don’t post pictures of text, including code. Just copy and paste the text and use the code button </> for code,

See How to get the best out of the Forum

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to. If the first example does not work be sure to try the connection test for both of your Arduinos. Nothing will work if the connection test fails.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. This seems to be a particular problem with the nano. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

If you are using the high-power nRF24s (with the external antenna) it may help to have a distance of about 3 metres between the two nRF24s so that the signal does not overwhelm the receiver. However someone on the Forum has had them working without that separation - I don’t have any personal experience with them. If you are new to nRF24s it may be better to start with a pair of low power modules with the pcb antenna.

…R

mechanical_whale_2472:
If I uncomment the line, my GPS only prints zeroes to the serial port.

Are you sure, I have never seen a GPS send out all zeroes ?

I suspect the GPS is actually working as normal but that your program is not reading the GPS properly.

I suspect the NRF24 transmission is wiping put the GPS receiver. I had a customer with marine electronics products. One was a GPS receiver. They all worked fine until customers placed the GPS high up on a mast, in front of the ship radar. The customer had to add a metal shield all the way around the GPS receiver to avoid ignorant customer activity.
Try placing the two units as far from each other as possible. Or wrap aluminum foil around the perimeter of the GPS unit, but leave the top open so it can see satellites.

Paul

Paul_KD7HB:
I suspect the NRF24 transmission is wiping put the GPS receiver.

Very interesting.

Have you any idea whether a single nRF24 transmission would result in the GPS having to re-acquire the satellites (which presumably takes some time) or whether it would only cause a brief corruption for a few millisecs?

...R

Robin2:
Very interesting.

Have you any idea whether a single nRF24 transmission would result in the GPS having to re-acquire the satellites (which presumably takes some time) or whether it would only cause a brief corruption for a few millisecs?

...R

Robin, either or both are possible at different times or at the same time. Random is the best answer. But shielding the GPS may work. Testing is required. Maretron took several months to find a solution to their problem, then more months to design and get the shielding fence made and the circuit board redesigned to provide room for the fence and it's mounting tabs.

Paul

PS: I just looked up the GPS frequecies to refresh my memory. The L2 Radio Navagation frequency is around 1227 Mhz, which is close to 1/2 the 2.4 gHz frequency of the NRF24. There is likely lots of stray RF not being filtered by the NRF24.

The obvious debugging step would be to check what the actual output of the GPS is.

Just attach a USB-Serial adapter to the TX ouput of the GPS and see what is actually happening.