|
Arduino Nano |
x 1 | |
|
1x6 Pin Header Connector |
x 1 | |
|
1x4 Pin Header Connector |
x 1 | |
|
1x2 JST Connector |
x 3 | |
|
10kR Resistor |
x 3 |
Arduino GPS Register
Introduction
In this project you will learn how to build your own GPS and Arduino vehicle position recorder system. Now we will teach you the building process step by step for you to assemble yours.
The Project
First, we will use some modules to create this project. As provided in the bill of materials, we will use GPS to collect position data and the Memory Card Module to store GPS read positions.
Arduino Nano will be used in this project to perform all control of programming logic.
According to this principle of operation, the electronic circuit diagram is presented in Figure 1.
Figure 1 - Electronic Schematic of the GPS Register System.
As is possible see in this project, there are two buttons. Each button is responsible to start and stop the register processing of GPS positions in the SD Card. The Red LED will be used to sinalize when the data positions are being stored in SD Card.
According to this circuit at protoboard, the electronic scheme was built. The electronic scheme is presented in Figure 2.
Figure 2 - Schematic Circuit of the GPS Register Position.
Hereafter, was designed the Printed Circuit Boar as is shown in the Figure 3.
Figure 3 - Printed Circuit Board of the GPS Register Position with Arduino.
According with this project, was created the code presented below.
The code is used to communicate Arduino Nano with SD Card Module and GPS Module.
#include <SD.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
SoftwareSerial SerialGPS(4,3); //Pino 4 - TX do Modulo e Pino 3 - RX do Modulo GPS
TinyGPS GPS;
File myFile;
bool controle = 0;
float lat, lon;
byte pinoCS = 10; //Pin 10 para Nano/UNO
#define INICIA 9
#define TERMINA 5
#define LEDVERMELHO 2
void setup()
{
SerialGPS.begin(9600);
Serial.begin(9600);
pinMode(pinoCS, OUTPUT); //Define o pinoSS como saida
pinMode(LEDVERMELHO, OUTPUT);
if (SD.begin())//Inicializa o SD Card
{
Serial.println("SD Card pronto para uso."); //Imprime na tela
}
else
{
Serial.println("Falha na inicializa??o do SD Card.");
return;
}
}
void loop()
{
bool BotaoInicia = digitalRead(INICIA);
bool BotaoTermina = digitalRead(TERMINA);
if(BotaoInicia == 1 && controle == 0)
{
controle = 1;
myFile = SD.open("GPS.txt", FILE_WRITE); //Cria e abre o arquivo
delay(1000);
myFile.print("Latitude");
myFile.println(" Longitude");
}
if(controle == 1)
{
while (SerialGPS.available())
{
if (GPS.encode(SerialGPS.read()))
{
digitalWrite(LEDVERMELHO, HIGH);
//latitude e longitude
GPS.f_get_position(&lat, &lon);
myFile.print(lat , 6);
myFile.println(lon, 6);
delay(1000);
}
}
}
if(BotaoTermina == 1 && controle == 1)
{
controle = 0;
myFile.close();
digitalWrite(LEDVERMELHO, LOW);
}
}
In the first lines, will be declared the libraries of the modules and the variables used to manipulate the datas in the project, as is shown in the following code.
#include <SD.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
SoftwareSerial SerialGPS(4,3); //Pino 4 - TX do Modulo e Pino 3 - RX do Modulo GPS
TinyGPS GPS;
File myFile;
bool controle = 0;
float lat, lon;
byte pinoCS = 10; //Pin 10 para Nano/UNO
#define INICIA 9
#define TERMINA 5
#define LEDVERMELHO 2
After this, the system will execute the void setup fuction. In this function, the system will configure the pins used to connect the LED, button and others like a digital input or output. Posteriorly, will test the initialization process of the SD Card through the code presented below.
if (SD.begin())//Inicializa o SD Card
{
Serial.println("SD Card ready for use"); //Imprime na tela
}
else
{
Serial.println("SD Card initialization failed");
return;
}
If the system performs the test and the SD Card initializes correctly, it will print the following message: SD Card ready for use. Otherwise, it will print the message SD Card initialization failed.
After this, the system will enter in the void loop function. In this function the main system logic will be executed.
Firstly, the button START and END will be readed. Following, case the START button was pressed, the .txt file will be opened and will be printed the Latitude and Longitude name, to create two columns of datas. The portion of code is presented below.
bool BotaoInicia = digitalRead(INICIA);
bool BotaoTermina = digitalRead(TERMINA);
if(BotaoInicia == 1 && controle == 0)
{
controle = 1;
myFile = SD.open("GPS.txt", FILE_WRITE); //Cria e abre o arquivo
delay(1000);
myFile.print("Latitude");
myFile.println(" Longitude");
}
After this, the system will enter in the next condition presented below, because the variable controle is equal at 1.
if(controle == 1)
{
while (SerialGPS.available())
{
if (GPS.encode(SerialGPS.read()))
{
digitalWrite(LEDVERMELHO, HIGH);
//latitude e longitude
GPS.f_get_position(&lat, &lon);
myFile.print(lat , 6);
myFile.println(lon, 6);
delay(1000);
}
}
}
In the condition the system will set the Red LED and print the latitude and longitude in the text file GPS.txt each one second. The system will stores the data position of the GPS until the user press the End button.
When the end button was pressed, the variable controle will be equal at 0, the file will be closed and the red led will be off, as is shown in the portion of the code presented below.
if(BotaoTermina == 1 && controle == 1)
{
controle = 0;
myFile.close();
digitalWrite(LEDVERMELHO, LOW);
}
After this, the system back to the loop begin and execute the code again.
Conclusion
Thus, as is possible see, the system can be used to storage position travelled by tem vehicle in a SD Card Module. In addition, this system can be used to monitor the path taken by vehicles carrying loads of values from one location to another.
In this way, the system present good results to create projects and you can download the files or obtain your own PCB to construct the project with Arduino.
Arduino GPS Register
*PCBWay community is a shared platform and we are not responsible for any design issues.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by silicioslab
- WS2812B RGB LED Controller with ESP8266 via WiFi IntroductionWS2812b addressable RGB LEDs are devices widely used in lighting projects. They are foun...
- Electronic Board for Cutting Electrical Power to Devices and Machines IntroductionAn energy saving system for cutting electrical energy in machines is a fundamental piece...
- PCB Board Home Automation with ESP8266 IntroductionThe incorporation of the ESP8266 module into home automation represents a significant ad...
- Dedicated Control Board for Mobile Robots with Wheels IntroductionFor a long time we developed several prototypes and teaching kits of mobile robots and w...
- Traffic turn signal for bicycles IntroductionDoes every project with electronic logic need a Microcontroller or Arduino to be develop...
- Mini Arduino with ATTINY85 Do you know the ATTINY85 microcontroller? This article has news and a gift for you. Many people deve...
- Christmas Tree The tree used to signal light of Christmas.
- Activating loads with relay via WiFi with ESP8266 IntroductionDo you want an electronic board for activating loads via WiFi that is safe against surge...
- Hospital Water Tank Monitoring via the Internet IntroductionOne of the elements of great importance for the functioning of hospitals is water. It is...
- ESP32 IoT Development Board with Monitoring Battery System IntroductionToday I want to tell you what one of the biggest problems is in electronic projects invo...
- Control Board for 6 Servomotors based on Arduino for Robotic projects In the last few weeks we started developing this robotic arm. It is made up of 5 servomotors. To fac...
- PCBWay Standalone Arduino IntroductionDo you know how the basic circuit of an Arduino works? Every Arduino has a minimum circu...
- Human Machine Interface based in Arduino with ATMEGA328P Standalone Several commercial and industrial applications require a screen system to present data and receive p...
- Small Low Cost Circuit Deveelopment Board for Prototypes In recent years I have developed numerous prototypes with Arduino. During these creations, something...
- Intruder alert system with SMS In several places, we must monitor the security of spaces and prevent intruders from entering prohib...
- Mini Arduino Laboratory I have worked in teaching laboratories for over 10 years. One of the great difficulties in these spa...
- PCBWay WiFi ESPBoard-01 Can you imagine controlling any device over the internet? Lamps, water pumps for irrigation, gate dr...
- Educational Robot for Children All areas of knowledge such as sciences, human or biological, have their respective importance. With...
-
-
-
Open Source Very Large Stick - Freejoy & MMjoy2 breakout board
645 0 0 -
RF Control training board for students based on ESP32 C3
833 0 2 -
Aquarius+ Computer, Standard PCB
1100 0 7 -
KINETIC COASTERS with a TWIST! Laser or 3D Print some DIY Magic
703 0 2 -
RPI - 8 IO PLC With ATTiny85 Watch Dog
602 0 1