SIM7600X 4G/GPS Hat
Hardware
A Raspberry Pi 3+
A SIM7600X 4G Hat
A computer for controlling the Pi and testing the GPS with a GUI tool
The setup is fairly simple. The LTE antenna should be connected to the the “MAIN” LTE U.FL connector. The GPS should be connected to the “GNSS” connector. It is important to note that the designed mating cycles of a U.FL connector is typically around 30. Try to not to disconnected to the antenna if it is possible.
The USB cable is necessary for using the LTE. However, it is not necessary for the GPS functionality.
Software
Raspbian
Python
QMI tools (for LTE)
GPS
You will need to enable the serial port via raspi-config
first.
sudo raspi-config
Then go to Advanced Options → Serial. Say no to make a login shell accessible over serial. Say yes to enable the serial port hardware.
You will need the pyserial library to communicate with the GPS module. You will also need the RPi.GPIO (pre-installed on Raspbian) library to turn the GPS module on via the GPIO pins.
sudo apt update && sudo apt install -y python python-pip
python -m pip install pyserial
Upload this tar file to the Pi via scp or a USB stick.
Run the following commands to untar the file and run the the script.
tar -xvf SIM7600-4G-GPS-HAT.tar.gz
cd SIM7600-4G-GPS-HAT/python/GPS
python GPS.py
The output should look like the following. The GPS might takes a while to get the signal from the satellite and fix to a location.
The latitude format is ddmm.mmmmmm <N/S>
. The longitude format is dddmm.mmmmmm <E/W>
. More information can be found in the AT command manual under the Resources section on this page.
The result in the example can be decoded as shown below.
LTE
I learned most of the setup from this post on the Raspberry Pi forums.
First, you need to install some tools for the qmi LTE module in the hat.
Second, wake up the LTE module from the low power mode.
You can check the signal strength and the cellular network via these commands (optional).
You need to change the protocol to raw-ip
Now, you can connect to the LTE network
Before you can use the internet, you also need an IP address
Test Results
GPS
Accuracy
The first GPS coordinate was 14 m from the actual location. The accuracy increases as the GPS module receives signal from more satellites.
Expected | Measured |
---|---|
2.5 meters | 3.2 meters |
Time to Fix
The time to get a GPS coordinate is depending on whether the GPS remember the last position, current UTC time, and the satellite information or not. It also takes some time to turn on the GPS module from a power-off state.
Power-On Time | Time to Fix (Warm Start) | Time to Fix (Cold Start) |
---|---|---|
23 seconds | 5 seconds | 30 seconds |
LTE
This is the speedtest result with a Pi+4G hat connected to the T-Mobile LTE network and measured by speedtest.net test tool. I used a Google Fi sim card in this case. It is able to connect to most of the major LTE networks in the US (T-Mobile or AT&T), which is great for the sparse LTE coverage in the rural area.
Trial | Latency | Download | Upload | Packet Loss |
---|---|---|---|---|
1 | 26.25 ms | 12.83 Mbps | 17.63 Mbps | 0.0% |
2 | 36.96 ms | 0.68 Mbps | 6.27 Mbps | 0.0% |
3 | 25.86 ms | 22.25 Mbps | 19.18 Mbps | 0.0% |
4 | 43.58 ms | 3.59 Mbps | 6.27 Mbps | 0.0% |
5 | 63.89 ms | 1.18 Mbps | 5.12 Mbps | 1.7% |
Conclusions
GPS
The GPS module meets the requirements of the telemetry system. It takes some time to initialize, but it should not impact the functionality. The setup time and fix time are negligible considering the car needs to pre-charge before it starts to move.
The GPS module is fairly accurate for telemetry purpose.
LTE
The connection and speed are less stable than what I expected. However, the slowest uplink speed (5.12 Mbps) is still faster than the maximum speed of the CAN bus (500 kps).