Sending GPS Data to Web Server / Telegram
The Pico LTE device provides all the necessary components to receive GPS data and send it to a web server or Telegram. This tutorial will guide you step-by-step on how to send GPS data.
Before starting this Pico LTE tutorial, the Pico LTE SDK installation and configuration steps must be completed. Below are the system requirements for this tutorial. If you haven't followed the SDK installation steps, please refer to the page below before proceeding with the tutorial. The details of these steps will not be covered in this tutorial.
System Requirements
Hardware Requirements | Software Requirements |
---|---|
• Sixfab Pico LTE • Micro USB cable • Passive GNSS/GPS Antenna u.FL Plug – 100mm |
• Thonny IDE |
Below is shown how to connect passive GNSS antenna
If you have completed all the requirements, you are ready to send the GPS data. Let's get started!
Preparing Coding Environment
- Download the Pico LTE SDK repository to your local machine. If you have already downloaded it, skip this step.
- Open script "examples → gps → send_location_to_server.py or send_location_to_telegram.py" from the repository via Thonny IDE.
- If you haven't, create a config.json file in the root directory of Pico LTE device.
Test the Code Example
If you want to send GPS data to a web server, copy the following code block into the config.json file and enter the Server URL, Username, and Password sections. If Username and Password are not required, you can delete them.
{
"https":{
"server": "YOUR_SERVER_URL",
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}
If you want to send GPS data to Telegram, copy the following code block into the config.json file and enter the Telegram Token and Chat ID sections. How to obtain the Token and Chat ID is explained in the 'Send Message to Telegram Channel' tutorial. You can refer to that tutorial for more detailed information.
{
"telegram":{
"token": "YOUR_TELEGRAM_TOKEN",
"chat_id": "YOUR_TELEGRAM_CHAT_ID"
}
}
Then save it to your Pico LTE device.
Run the "send_location_to_server.py" or "send_location_to_telegram.py" script that you opened in Thonny IDE.
Troubleshooting
+CME ERROR: 516
This error means that your modem couldn't fixed the location. Be sure that you're trying to connect GPS in outdoor, or attach a better antenna to connect easier.
+CME ERROR: 504
This error provides you an information about an ongoing process on the modem with GPS. You can ignore it and continue to your own process. It is possible to exit the ongoing job, and restart your code.
Updated 3 months ago