Logo

dev-resources.site

for different kinds of informations.

RaspberryPi, SIM7600, GPSd

Published at
10/17/2021
Categories
raspberrypi
gps
sim7600
iot
Author
nakullukan
Categories
4 categories in total
raspberrypi
open
gps
open
sim7600
open
iot
open
Author
10 person written this
nakullukan
open
RaspberryPi, SIM7600, GPSd

Today we are going to see how we can serve gps location from SIM7600 module to a port in raspberrypi through daemon.

Requirements

  1. RaspberryPi
  2. SIM7600 (Connected to /dev/ttyS0, i.e., pi's serial port)
  3. Putty in your laptop/desktop for communication with raspberrypi.

This post does not cover on how to integrate SIM7600 module with raspberrypi.

Step 1: Install minicom.

Minicom is a serial communication program that connects to devices through a GNU/Linux PC's serial ports.
Before installing minicom, serial port has to be enabled from raspberry-configuration.

sudo raspi-config
Go to Interface Options-> P6 Serial Port -> No -> Yes.
This will enable the serial port communication.

sudo apt install minicom
This will install minicom. Confirm it by executing minicom -v
image

I have connected SIM7600 module with raspberrypi through UART (ttyS0). If you have a GPS module of connector type usb, you might need to find its address.
One easy way to find the address is by connecting only the gps module with pi and execute following command
ls -l /dev/ttyS0
image
If the port is correct then you will get an message as above.

Next step is to use minicom to communicate with pi's serial port through AT commands.
sudo minicom -b 115200 -D /dev/ttyS0
This will open minicom terminal.
image

You can test whether connection are correct by typing AT and press enter.
This should return OK.
image

Step 2: Enable GPS in SIM7600

By default GPS will be off. We need to perform following operations

1) Turn on GPS



AT+CGPS=1,1
Returns OK
AT+CGPS?
_Returns_ +CGPS:1, 1
        OK


Enter fullscreen mode Exit fullscreen mode

image

Enter below AT command to turn on GPS automatically whenever the module is turned on.



AT+CGPSAUTO=1
_Returns_ OK


Enter fullscreen mode Exit fullscreen mode

Enter below AT command to feed the gps nmea sentence every 1 second in the serial port out.



AT+CGPSINFOCFG=1,31
_Returns_ OK


Enter fullscreen mode Exit fullscreen mode

image

Exit from minicom terminal and restart pi and SIM7600. To confirm everything went well.
cat /dev/ttyS0
Don't worry, if nothing gets print on the screen. This is because minicom stops writing data once you exit from its terminal.
You try again the above command in a different terminal session without closing minicom.

Step 3: Automate minicom

Before creating script to automate we have to enable the scripting in minicom.
minicom -s
will open minicom configuration.
image

Select Serial port setup option from menu and configure as shown below.
image

Next, create a minicom script to execute AT+CGPSINFOCFG=1,31
Content of the script is as shown below.
send AT+CGPSINFOCFG=1,31
Save the file in /home/pi/start-gps.sh

You can see nmea sentence printing in minicom terminal once you execute minicom -S start-gps.sh

Still this is not enough, we have to create a bash script to execute above command during system startup automatically.

Create minishell.sh with below content in /home/pi/.



#!/bin/bash
minicom -S start-gps.sh


Enter fullscreen mode Exit fullscreen mode

Make it executeable
chmod u+x minishell.sh

bashrc is a program which can execute other scripts on startup.
Edit ./bashrc file and add



#start minicom gps
echo "turning gps on"
sudo ./minishell.sh


Enter fullscreen mode Exit fullscreen mode

at the end of the file.

Step 4: Install gpsd, gpsd-clients

Install gpsd and gpsd-clients from apt.
sudo apt-get install gpsd gpsd-clients python-gps

Edit gpsd.sock file as shown below
image

Again edit ./.bashrc file to add below script at the end of the file.
sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock

Restart your pi.
Now you will receive gps information from port 2947.
To verify the same just enter gpsmon in terminal.
You will see
image

Thank you.

gps Article's
30 articles in total
Favicon
GPS Monitoring function on SVMS Pro video management software has been released .
Favicon
GPS Dog Collars: A Game-Changer for Lost Pet Prevention
Favicon
Unveiling the Secrets of Your Photos: Discovering GPS Locations
Favicon
How a Time Clock App With GPS Can Boost Workforce Productivity?
Favicon
Listen for realtime location updates from pulsetracker on your backend
Favicon
Touch Tag: The Smart Pet Tracker by Letstrack
Favicon
Best Small GPS Tracker: Portable Tracking with Trakbond
Favicon
Does GPS need internet toย work?
Favicon
Building a command line photo GPS tagger using Docker, .Net and ExifTool
Favicon
The Anatomy and Technology Behind GPS Devices: A Comprehensive Guide
Favicon
GPS Visualizer
Favicon
What Happens When Site Wants to Know Your Location - How I Voided My Firefox Warranty
Favicon
5 Essential Features To Look For In A GPS Vehicle Tracking System
Favicon
DIY Onocoy Ntrip Server and Reference Station Setup
Favicon
What are Advantages of a Fleet Management System?
Favicon
Empowering Agriculture with GIS and GPS: The New Age of Precision Farming.
Favicon
GPS Speed Measurement: Accurately Tracking Movement in Various Fields
Favicon
GPS Geolocation vs IP Geolocation: How To Test Them On Real Devices?
Favicon
Vamosys gps
Favicon
How GPS works?
Favicon
Location without Google Services
Favicon
Wi-Fi communication using two u-blox C099-F9P application board
Favicon
Obika GPS Pt 1: My First Project using Traccar.
Favicon
Use Cell Tower and Wi-Fi Triangulation to Achieve Pin-Point Locations, without GPS
Favicon
Retreiving GPS data in decimal format from EXIF data in photos
Favicon
Jual Gps Geodetic South Galaxy G1
Favicon
Anti-Theft GPS Tracker and Recovery System
Favicon
Low Fi LoJackยฎ with Blues Wireless and React
Favicon
RaspberryPi, SIM7600, GPSd
Favicon
What is Fishfinder GPS?

Featured ones: