|
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 sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- 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 Silícios Lab silicioslab
- Electronic Enclosure applied for electronic projects IntroductionWhen designing electronics, the enclosure plays a crucial role that is often overlooked....
- IoT Indoor system with ESP32 to monitor Temperature, Humidity, Pressure, and Air Quality IntroductionAir quality, temperature, humidity and pressure are essential elements to ensure healthy...
- 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.
- Electronic Enclosure applied for electronic devices IntroductionWhen designing electronics, the enclosure plays a crucial role that is often overlooked....
- Electronic Enclosure for Programmable Logic Controller The housing developed for programmable logic controllers is a practical and efficient solution for t...
- Payment PCB for machines and services IntroductionIn many commercial establishments, hospitals and other places, there are video game equi...
- Relay High Power Printed Circuit Board IntroductionEfficient management of electrical loads is essential for optimizing performance and saf...
- Weather gadget with clock through ESP8266 IntroductionImagine a device that combines technology with an elegant design, bringing functionality...
- ESP32 MPU6050 Monitor IntroductionVarious industrial equipment is essential for the adequate production of products, parts...
- Digital Speedometer for Bicycles IntroductionCycling, increasingly popular both as a recreational activity and as a means of transpor...
- Arduino-based development board with extra features IntroductionArduino is an excellent tool for anyone who wants to develop prototypes. The board has a...
- How to develop low-energy devices powered by batteries? IntroductionIn recent years, there has been a major advance in the area of embedded systems through ...
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
56 0 0 -
-
-
-
Sega Master System RGB Encoder Switcher Z80 QSB v1.2
57 0 0 -
18650 2S2P Battery Charger, Protection and 5V Output Board
78 0 0 -
High Precision Thermal Imager + Infrared Thermometer | OpenTemp
423 0 6 -
Sony PlayStation Multi Output Frequency Oscillator (MOFO) v1
129 0 2