1

In my build i have a gsm module ( SIM800L ) connected to a RPI 0 W in this way:

enter image description here

I would like to get also the current position of my device, for do so i was thinking to buy a Gps module ( NEO-6M STM32 GT-U7 ).

I know that the sim800L is also capable to get it's current location through the gps but actually it's not working anymore becouse as i read this feature was based on a google services that is no longer aviable.

The problem is that the Gps module has to use the UART pins that are already connected to the sim800L. I'm trying to figure out before buying it if I can somehow share the UART pins, or convert other GPIO pins in UART pins, or maybe other things ?

Linch1
  • 111
  • 3

1 Answers1

2

There are a few ways you could go depending on how much space / weight you have spare and what skills you want to learn as part of your project. I have assumed you want to keep the USB port for something else.

First thing is to look at the voltages required by the Pi and compare them to the device - the last thing you want to do is fry the Pi or have communications issues to / from the devices.

The simplest solution is to use one of the numerous HATs that provide multiple serial ports to the Pi (I've seen up to eight ports on one card). Google / DuckDuckGo etc will provide links if your regular supplier does not sell one.

Normally GPS units are slow speed, transmit only so next simplest would be to use the Pi GPIO library (not as my brain calls it - the PIG PIO library) to handle the serial port in software. This is the lowest cost solution BUT does require you to interface this into your code - its written in C but often seen in Python programs and has wrappers for other languages detailed on the site.

Very crude python code to use pin 18 as a serial port (sorry but both the port and code needs to be checked before live use):

# Set up RXD port on pin 18 as 8-bit data at 9600 baud
# import all the library functions for your program
import pigpio
# Set the port up as needed for the GPS
gps_pin=18
gps_port = pigpio.pi()
gps_port.set_mode(gps_pin, pigpio.INPUT)
gps_port.bb_serial_read_open(gps_pin, 9600, 8)

You then use bb_serial_read(gps_pin) to read the data and when done

gps_port.bb_serial_read_close(gps_pin)
gps_port.stop()

Better examples can be found here.

Much more complex (esp from this software guys point of view) is to use a chip to provide dual serial ports switching via I2C - a 'flat pack' one is the NXP SC16IS752 / 762 BUT this needs you to be able to handle surface mount soldering. A search on Digi-Key (though other chip resellers are available) may provide a through hole equivalent.

Apologies to the esteemed author of this great library who may be along soon - I am an old hacker that had to use lots of Programmable I/O chips on the old Z80 / 6502 cpu boards so I instantly see PIO in the name)