Ok, all appears to be working properly (now my brain is!)
Correct position, elevation and time on node with GPS and correct time on other nodes.
Nice.
for others following along. I did the reading and research then created a variant config to enable GPS on pins GPIO 0/1. This was mainly based on work done by others, just not ported.
Pro, it works, Con, not yet part of the core up-stream.
So if you happy to compile your own firmware, the follow is the two files used in my variant.
I create a variant folder called
rpipico-gps
pioplatformio.ini (based on the original rpipico variant)
[env:pico-gps]
extends = rp2040_base
board = rpipico
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags = ${rp2040_base.build_flags}
-DRPI_PICO
-Ivariants/rpipico-gps
-DDEBUG_RP2040_PORT=Serial
-DHW_SPI1_DEVICE
lib_deps =
${rp2040_base.lib_deps}
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
really its only two changes
[env:pico-gps]
and
-Ivariants/rpipico-gps
Then added some lines to variant.h
/ #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
// default I2C pins:
// SDA = 4
// SCL = 5
// Recommended pins for SerialModule:
// txd = 8
// rxd = 9
#define HAS_GPS 1
#define GPS_RX_PIN 0
#define GPS_TX_PIN 1
// No GPS reset available
#undef PIN_GPS_RESET
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#define LED_PIN PIN_LED
#define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 10
#define LORA_MISO 12
#define LORA_MOSI 11
#define LORA_CS 3
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 15
#define LORA_DIO1 20
#define LORA_DIO2 2
#define LORA_DIO3 RADIOLIB_NC
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
Really it was just adding the following lines
#define HAS_GPS 1
#define GPS_RX_PIN 0
#define GPS_TX_PIN 1
// No GPS reset available
#undef PIN_GPS_RESET
So feel free to take as is if you compile your own code.
In theory you should be able to tweak for the picow pico2 and pico2w; but I dont have those modules to test. If you to have one of those and want to test, let me know and I will give you a u2f file to test with a uart based GPS.
Entirely due to Michael99645 's generosity with his time the Pico/Waveshare LoRa now works with the Ublox GPS. However there is a remaining problem that is so far proving difficult to resolve so I am wondering if anyone else may have useful input.
After very close to 8 hours running with the GPS attached the Pico locks up. The OLED display stops updating and the green LED on the Pico is either off, permanently on or flashing rapidly. Disconnecting the USB power cable and reconnecting it restores everything to normal for another 8 hours. But then then the Pico locks up again.
Obviously a Meshtastic node that locks up every 8 hours is not much use!
I have 2 other identical nodes that do not have GPS attached and they never lock up.
I have tried:-
- A brand new Pico.
- Swapping the Waveshare Lora module.
- Different versions of the Meshtastic firmware (obviously each modified by Michael to talk to the GPS)
- Different USB power supplies.
- Different USB cables
Nothing has made any difference. Within plus or minus a few minutes of 8 hours the Pico always locks up.
We (essentially Michael) are still working on the issue but we thought it was time to see if anyone else can contribute usefully.
Ian
I got it to work! That is, Meshtastic GPS on a PiPico W with Waveshare Lora module. Since I have a PicoW I had to compile the PicoW specific code (platformio run -e picow) plus adding the GPS flags from above to variant.h, not just compile rpipico. Sometimes it just takes a minute to work this out. ![]()
Hey @Mark249733,
Glad to hear you got it up and running! Thanks for coming back to the forum to share what the issue was, I’m sure future travellers will appreciate it also.
Certainly a trap for new players as GPS is NOT supported using out-of-box firmware!
You have to compile your own.
Hi Michael
Ive been playing with ublox gps with a pico (basic pico) / waveshare meshtastic that arrived today
I used GP pins 8&9 Baud 9600 and got some data transmission including the $GLL… string but after a few minutes it dropped to a single line of useless data I tried adjusting the timeout value but no good
Is that u2f flashing file available to download and has there been any improvements over the last year
Hi Robert, I have not done much on this as I tend to use ESP32 for most of my work. The files I got to work are their, but as per the version at the time.
I dont really want to have a link made public, but since we cant really DM here to keep private - private, can you let me know when you have got this link from here, and I will remove it.
There should be a series of pic models and versions we tried.
… link removed …
Im happy for you to test/try and if it works great, I just dont have too much free time to spend on this atm, so as is…
Cheers
Thanks Michael
Ive got the link bookmarked
Will have a play and let you know how I go
I tried the recompiled uf2 but unfortunately it wouldnt transmit a complete nmea string
I have been using firmware ver 2.7.15.567 and by tweaking the timeout to 100 get a reasonably useful nmea $GPGLL string. See attached screenshot of received messages It does choke after a while but this is the receive end (also a pico/waveshare device) and can easily be rebooted
It been a little too long for me to remember everything; but from memory these were some key points that stuck in my mind.
- The GPS via the webpage set did not work with the Pico by default. there was some very specific pin connections to use to make it all work.
- There seems to be a form or memory leak/rubish collection cause things to run out of memory at some point. At the time I did a lot of testing and had a little back n forth on Mestastic forum. I could seem less and less free memory, then a reclaim, then down and down again… with a slight over all decrease in memory to the point the system would fail and need a reboot. This was never really fixed (that I was aware of) for the pico.
The ESP32 units i have using it never had any issue with long term running.
While Im not trying to push you in any directions, if it suits, maybe try the ESP32 for the node ? I understand it may not be ideal for other reasons, so this is just an option, maybe.
edit:
Note the GPS was hardcoded to GPIO 0 and 1
#define GPS_RX_PIN 0
#define GPS_TX_PIN 1
and ignores what the gui/web setup shows.
I dug out my old gear and have the OLED connected and the GPS and the OLED is showing its now getting the GPS data from the ublox-6M
I need to find a spare lora module to connect for a full test, but the GPS side seems to work on my bits.
What is the full part number of your GPS unit ?
