Neo 6m 2v GPS with Raspberry Pi


Neo 6m 2v GPS with Raspberry Pi :

The GPS means Global Positioning System which is a radio-navigation system  formed from a grouping of a number of satellites and their ground stations. The GPS  receiver gets a signal from each GPS satellite. The satellites transmit the exact time when the signals are sent.



Hardware Connections: 

Neo 6m 2v and the Raspberry Pi 3b plus are used over here so let's look towards the connection here VCC of Neo 6M to be connected with 5v of Raspberry pi and the GND of Neo 6M with GND of Raspberry pi and TX of Neo 6M with RX of Raspberry Pi so that the GPS module can send data to raspberry pi through the serial connection. 

          Neo 6M 2V                    Raspberry Pi


VCC                 -            5V       
GND                 -           GND
RX                    -           TX 
TX                    -           RX 

Fig 1. Connection of Raspberry pi and Neo 6m 2V
















Small request : Please subscribe my channel and Follow us on blog this will motivate me to make more videos





 Software

sudo nano /boot/config.txt
  • At the end of the file add the following lines:
dtparam=spi=on
dtoverlay=pi3-disable-bt
core_freq=250
enable_uart=1
force_turbo=1

  • You need to backup for the cmd so raspbian uses the UART as a serial console and so we need to turn off that functionality. To do so we need to change the /boot/cmdline.txt file. 
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt

  • Open the file in a text editor and edit it.
sudo nano /boot/cmdline.txt

  • Replace the content with the following line (delete everything in it and write down the following content):
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

  •  Now reboot pi using:
sudo reboot
  • Now it will start working here you need to make sure that the LED with blue light is blinking if it's no blinking I would you recommend going on the terrace or open sky or window because it needs to catch at least 3 satellites to generate NMEA sentence it might take around 20 to 30 mins to catch the  signals so you need to have patience while using Neo 6m 2V.When the blue led is blinking, run the following command
sudo cat /dev/ttyAMA0

  • After this, it Generates NMEA sentence which is basically the location you can convert these sentence into Latitude and longitude using many online convertors or else we can write a code to get the latitude and longitude of locations  













       Python SETUP

  • By default, the Raspberry Pi uses the serial port for this “console” login so if we want to use the serial port to get data from the GPS module we need to disable the console login. Now there are two serial ports in Raspberry pi : serial0 and serial1. But in between them serial0 will point to GPIO pins 14 and 15, so we have to use serial 0. Now to see which port is connected with serial0 use the following command:
ls -l /dev

If your output looks like this:

As you can see serial0 is linked with ttyAMA0. So to disable the console you need to use the follwing commands:
sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.service
But if your output looks like this:


That means serial0 is linked with ttyS0. So to disable the console you need to use the follwing commands:
sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

Python Code:

  • Python Library
pip install pynmea2

  • Code to generate Latitude and longitude









Note :
For latitude and longitude code contact : pigirl.02@gmail.com
In the console run python gps.py gives real-time GPS location












Happy reading.. Please follow us on blogger and leave a comment if you have any queries below.. :)



My Instagram

Made with by Pi-girl | Copyright © 2020 Pi-girl