Bharat Pi Navic Sheild(sensor) Using With Arduino IDE
by bharatpi in Circuits > Arduino
372 Views, 1 Favorites, 0 Comments
Bharat Pi Navic Sheild(sensor) Using With Arduino IDE
Bharat Pi NavIC is a GPS tracker module built specifically to work with Bharat Pi boards. It uses the NavIC (Navigation with Indian Constellation) system, an independent regional navigation system developed by India.
The NavIC GPS module is an add-on board that can be easily mounted on top of any Bharat Pi board. This allows you to develop tracking applications in a variety of fields, including:
- Automotive
- Healthcare
- Asset tracking
Supplies
Connection
- Connect the NavIC shield using the designated pin connections.
- Confirm that the pin configuration matches and verify the proper fitting of the board.
- Connect the antenna to the NavIC GPS module
- Ensure that the NavIC module can successfully acquire satellite signals. It is recommended to be in an open area with clear visibility of the sky.
Arduino Code
- Open the provided .ino file.
- Copy the code from the file or open it directly and upload the code to the Bharat Pi board.
- Please verify that the baud rate is set correctly.
Open the Maps Application.
Please enter the longitude and latitude coordinates into the search bar of the maps application.
Code
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define GPS_RX_PIN 33
#define GPS_TX_PIN 32
TinyGPSPlus gps;
SoftwareSerial gpsSerial(GPS_RX_PIN, GPS_TX_PIN);
void setup() {
Serial.begin(115200);
gpsSerial.begin(115200);
Serial.println("Getting GPS data...");
}
void loop() {
// Read data from GPS module
while (gpsSerial.available() > 0) {
if (gps.encode(gpsSerial.read())) {
if (gps.location.isValid()) {
// Get latitude and longitude
float latitude = gps.location.lat();
float longitude = gps.location.lng();
// Print latitude and longitude
Serial.print("Latitude: ");
Serial.println(latitude, 7);
Serial.print("Longitude: ");
Serial.println(longitude, 7);
}
}
}
}