GPS With Arduino R4-IoT Cloud

by akramslab in Circuits > Arduino

476 Views, 4 Favorites, 0 Comments

GPS With Arduino R4-IoT Cloud

WhatsApp Image 2024-03-31 at 11.31.05 PM.jpeg
desktop dashboard.JPG
GPS with IoT !
March 31, 2024

This project aims to use the NEO-6M GPS sensor with Arduino R4 to collect location data and transmit it to a map widget on an IoT cloud platform. The goal is to assess the precision of latitude and longitude values obtained from the sensor. By confirming the accuracy of these coordinates, the project seeks to validate the dependability of GPS data gathering with Arduino for various purposes, including real-time monitoring of GPS locations via mobile phones.

Supplies

WhatsApp Image 2024-03-31 at 11.31.05 PM.jpeg
WhatsApp Image 2024-03-31 at 11.31.04 PM.jpeg
WhatsApp Image 2024-03-31 at 11.31.03 PM (1).jpeg

Arduino R4 Board with Cable: The Arduino microcontroller serves as the central processing unit for interfacing with the GPS module and processing the data received from it. The cable facilitates the connection between the Arduino board and the computer for programming and power supply.

GPS NEO-6M Sensor: The NEO-6M GPS module is a compact and cost-effective device capable of providing accurate positioning data through satellite communication. It receives signals from GPS satellites to determine latitude, longitude, altitude, and time information.

4 Wires Female to Male: These wires are essential for establishing connections between the Arduino board and the NEO-6M GPS sensor. They enable the transmission of data and power between the two components, facilitating communication and functionality.

Circuit Setup and Wiring

FDSJCIHLUFJ77MW.jpg
WhatsApp Image 2024-03-31 at 11.31.04 PM.jpeg
WhatsApp Image 2024-03-31 at 11.31.03 PM (1).jpeg
WhatsApp Image 2024-03-31 at 11.31.03 PM.jpeg

Note: In the circuit diagram picture, I used the Arduino R3, but the connections remain the same for the Arduino R4.

TX and RX Connections: Connect TX pin of NEO-6M to Arduino's digital pin 2 (RX), and RX pin of NEO-6M to Arduino's digital pin 3 (TX).

Voltage Connection: Ensure VCC pin of NEO-6M is linked to Arduino's 3.3V output to supply the correct voltage, preventing potential module damage.


Setting Up IoT Cloud for GPS Data Tracking

step1.JPG
step2.JPG
device.JPG
network.JPG
variables.JPG

1- Account Creation:

  • Users open any browser and navigate to Arduino IoT Cloud.
  • An account is created by following the prompts and clicking on "Get Started."

2- Thing Creation:

  • Upon logging in, users proceed to the dashboard and select "Create a Thing."
  • Specifications of the project are defined, and a name is assigned.

3- Device Configuration:

  • Users choose between an ESP or Arduino board.
  • They follow the provided instructions to configure the selected device.

4- Network Connection:

  • Users select their network from the options provided.
  • The network password is input to establish the connection.

5- Variable Addition:

  • In the project dashboard, users navigate to the "Variables" section.
  • They add desired variables, such as latitude, longitude, and cloud location for the map widget.


Full Code

code.JPG
#include "thingProperties.h"
#include<TinyGPSPlus.h>
#include <SoftwareSerial.h>
SoftwareSerial serial_connection(2,3);
TinyGPSPlus gps;


void setup() {
  Serial.begin(9600);
  
  delay(1500); 
serial_connection.begin(9600);
Serial.println("GPS Start");


  // Defined in thingProperties.h
  initProperties();


  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}


void loop() {
  ArduinoCloud.update();
  // Your code here 
  while(serial_connection.available()){
  gps.encode(serial_connection.read());}
  if (gps.location.isUpdated()){
  latitude=gps.location.lat();
  Serial.print(latitude,6);
  Serial.print(", ");
  longitude=gps.location.lng();
  Serial.println(longitude,6);
  coordinate={latitude, longitude};
  }
  
}

Code Explain

#include "thingProperties.h"

This line includes the thingProperties.h file, which contains definitions for properties used in the Arduino IoT Cloud.


#include <TinyGPSPlus.h>

This line includes the TinyGPSPlus library, which is used for parsing GPS data.


#include <SoftwareSerial.h>

This line includes the SoftwareSerial library, which is used for creating a secondary serial port on digital pins.


SoftwareSerial serial_connection(2,3);

This line initializes a SoftwareSerial object named serial_connection on pins 2 (RX) and 3 (TX).


TinyGPSPlus gps;

This line initializes a TinyGPSPlus object named gps for parsing GPS data.


ArduinoCloud.update();

This line updates the connection with Arduino IoT Cloud.


while(serial_connection.available()) { ... }

This loop reads data from the secondary serial port (connected to the GPS module) and parses it using TinyGPSPlus.


if (gps.location.isUpdated()) { ... }

This condition checks if a new GPS location is available. If true, it retrieves the latitude and longitude from the GPS data and prints them.


This code snippet demonstrates how to integrate a GPS module with Arduino IoT Cloud, allowing you to monitor and track location data remotely.

Result

WhatsApp Image 2024-03-31 at 11.31.05 PM.jpeg
dashboard computer.JPG
phone dashboard terrain.JPG
GPS with IoT !
March 31, 2024

The result will be presented through videos and pictures to ensure clarity of the idea.

Promoting Social Media Channels

Thank you for exploring GPS data retrieval with us! Stay connected and dive deeper into exciting projects like this by following us on our social media channels. Don't miss out on valuable content, tutorials, and updates. Join our Telegram channel for exclusive insights and discussions. Let's continue this journey together!

Our pages:https://lnk.bio/akramslab

Our channel on Telegram:https://t.me/akramslab