GPS = Global Positioning System is satellite-based navigation system.
사용할 모듈 : EM406 GPS Receiver.
To use this receiver,
you’ll need the GPS shield kit from SparkFun (part
number RTL-10709) shown in Figure 13-2. This part includes the receiver, a
matching Arduino shield, and the connection cable.
it’s a good idea to make sure that it’s working and
that you can receive GPS signals.
GPS receivers require a line of sight to the
sky,
but their signals can pass through windows.
시선은 하늘로 but 신호는 창문을 관통해 지나간다.
It’s usually best to perform
this test outdoors,
but it might work just fine through an unobstructed window
or skylight.
야외에서 수행하는게 최선이다.
but an unobstructed(=방해없는)창 or skylight에서 작업하는것도 좋다.
To test reception,
you’ll set up the shield and run a basic
sketch that displays the raw received data.
수신 테스트를 위해
넌 set up해라. the shield를 and 돌려라. a basic sketch를 that 디스플레이하는 the raw한 받은 데이터를.
To perform the test, first connect your GPS receiver via the cable to
the shield,
and then attach this assembly to your Arduino.
수행하기위해 the 테스트를, 우선 연결해라. 네 GPS 수신기를 via the 케이블을 통해 to the shield로,
and then 부착해라. 이 조합을 to 네 Arduino로.
Notice the small
switch on the GPS shield, which is shown in Figure 13-4.
기억해라. the 작은 스위치를
When it’s time to upload and run sketches on your GPS shield,
move
the switch to the DLINE position,
and then change it to UART and be sure
to turn on the power switch for the receiver.
Enter and upload the sketch in Listing 13-1
When 이게 to 업로드할타임에 and 돌릴타임에 sketches를 on 너의 GPS shield에,
이동시켜라. the switch를 to the DLINE 위치에,
and then 바꿔라. 이걸 to UART로 and be 확인해라. to 켜기위해 the 파워 스위치를 for the 리시버를위해.
Enter and 업로드해라. the sketch를
▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
// Listing 13-1
void setup()
{
Serial.begin(4800); //To match the data speed of the
GPS receiver (4800)
}
void loop()
{
byte a; //GPS데이터를 담기위해서 byte형 변수를 지정
if ( Serial.available() > 0 ) //This sketch listens to the serial port at Here
{
a = Serial.read(); // get the byte of data from the GPS
Serial.write(a); //when a byte of data is
received from the GPS module,
//it is sent to the Serial Monitor at Here.
}
}
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
Once you’ve uploaded the sketch, move the data switch back to
UART.
(sketch 업로드할때:DLINE // 통신할때:UART)
Now check the LED on the GPS receiver that tells us its status.
If the LED is lit, the GPS is trying to lock onto the satellite signals.
After
about 30 seconds the LED should start blinking, which indicates that it is
receiving data from the satellite.
After the LED starts blinking, open the
Serial Monitor window in the IDE and set the data speed to 4,800 baud.
You should see a constant stream of data similar to the output shown in
Figure 13-5.
Le't create a simple GPS receiver.
But first, because you'll usually use your GPS outdoors-and to
▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
#include <TinyGPS.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
// Create an instance of the TinyGPS object
TinyGPS gps;
void getgps(TinyGPS &gps);
void setup()
{
Serial.begin(4800);
lcd.begin(16, 2);
}
void getgps(TinyGPS &gps)
// The getgps function will display the required data on the LCD
{
float latitude, longitude;
//decode and display position data
gps.f_get_position(&latitude, &longitude);
lcd.setCursor(0,0);
lcd.print("Lat:");
lcd.print(latitude,5);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Long:");
lcd.print(longitude,5);
lcd.print(" ");
delay(3000); // wait for 3 seconds
lcd.clear();
}
void loop()
{
byte a;
if ( Serial.available() > 0 ) // if there is data coming into the serial line
{
a = Serial.read(); // get the byte of data
if(gps.encode(a)) // if there is valid GPS data...
{
getgps(gps); // grab the data and display it on the LCD
Here we are building more advanced version of Vehicle Tracking System in which you can Track your Vehicle on Google Maps.
여기서 우린 구축중이다. more 앞선 버젼을 of 차량추적시스템의
in which 네가 can Track할수있는 차량을 on 구글맴상에서.
In this project, we will send the location coordinates to the Local Server and you just need to open a ‘webpage’ on your computer or mobile, where you will find a Link to Google Maps with your Vehicles Location Coordinates.
우린 will 전송할것이다. the 위치좌표를 to the Local Server에
and you just need to 열어야한다. webpage를
where 네가 찾을수있는 a Link를 to Google Mpas로가는
with 네 차량 위치좌표와 함께하는.
When you click on that link, it takes you on Google Maps, showing your vehicles location. In this Vehicle Tracking System using Google Maps, GPS Module is used for getting the Location Coordinates, Wi-Fi module to keep sending data to computer or mobile over Wi-Fi and Arduino is used to make GPS and Wi-Fi talk to each other.
when네가 클릭할때 on that 링크를, it takes you on 구글맴상으로 데려갈것이다.
보여주는 네 차량위치를.
In this 차량추적시스템 사용하는 구글맵s 에서,
GPS모듈은 사용된다 for 얻는데 the 위치좌표를,
Wi-Fi모듈은 to keep sending하는데 데이타를 to 디바이스들에 over Wifi를 건너서
and Arduino는 사용된다. to 시키는데 GPS & Wifi가 소통하도록 to each other 서로간에.
>>
How it works = 사용법
To track the vehicle, we need to find the Coordinates of Vehicle by using GPS module. GPS module communicates continuously with the satellite for getting coordinates. Then we need to send these coordinates from GPS to our Arduino by using UART. And then Arduino extract the required data from received data by GPS.
Before this, Arduino sends command to Wi-Fi Module ESP8266 for configuring & connecting to the router and getting the IP address.
Before this, 아두이노는 보낸다. 명령어를 to ESP8266에 for 구성하기위해 & 연결하기위해
to the 라우터에 and 얻기위해 the IP address를.
After it Arduino initialize GPS for getting coordinates and the LCD shows a ‘Page Refresh message’.
That means, user needs to refresh webpage.
After it, 아두이노는 초기화시킨다. GPS를 for 얻기위해 좌표들을 and the LCD는 보여준다. a Page Refresh message를.
When user refreshes the webpage Arduino gets the GPS coordinates and sends the same to webpage (local server) over Wi-Fi, with some additional information and a Google maps link in it.
When 유저가 ReFresh할때 the webpage를, Arduino는 얻는다. the GPS좌표들을.
&보낸다. the 같은걸 to webpage에
with추가적인 정보들과 구글맵과함께.
Now by clicking this link user redirects to Google Maps with the coordinate and then he/she will get the Vehicle Current Location at the Red spot on the Google Maps. The whole process is properly shown in the Video at the end.
>>
회로설명
GPS TX >> Arduino 10번핀(RX) 단방향
ESP8266 Vcc & GND are directly connected to 3V3 & GND of Arduino.
(2420원 --- 동신전자 기준)
USB adapter에 연결후 SerialMonitor를 통해서 아래그림처럼 AT Command를 입력할 수 있다.
(단, default인 115200 BaudRate로 설정해줘야한다.)
AT+CWMODE?
::Wifi모드가 현재 뭘로 설정되있는지 확인할 수 있습니다.
AT+CWMODE=3
::Wifi모드를 1,2,3 중 선택할 수 있습니다.
::1(=Station), 2(=AP), 3(=Station+AP)
Wifi 이용가능한 List를 보고싶다면 AT+CWLAP를 치면 됩니다.
AT+CWJAP="U+Net???","PassWord"
요런식으로 적어줘야합니다.
초록색 부분이 SSID에 해당합니다.
PassWord가 없다면
AT+CWJAP="U+Net???",""
▲이렇게 PW부분을 입력하지않고 따옴표2개로만 쓰면 됩니다.
when you got stuck in Failure to connect to SSID with spaces in them,
▶
with an SSID of "Volleyball Girls". I connects perfectly when I change the SSID to "Volleyball_Girls". (Changing the space to an underscore)
Underscore를 쓰는게 추천방식인데 Test해보니 그닥효과는 없다.
SSID with No Space is better to hijacking the Wifi.
CWLAP : ( 뒤에 바로 따로오는 숫자들
0,3,4,4,4 등등은 protection level 을 의미한다.
현재 연결된 Wifi 확인하고 싶을때
AT+CWJAP?
현재 연결된 Wifi를 DisConnected 시키고 싶을때
AT+CWQAP
할당받은 IP Address 확인
AT+CIFSR
AT Commands Overview in PDF file (▶LINK) Web (▶LINK)
For changing the baudrate permanently you can use this command:
First of all we need to connect our Wi-Fi module to Wi-Fi router for network connectivity.
Then we will Configure the local server, Send the data to Web and finally Close the connection.
This process and commands have been explained in below steps:
1. First we need to test the Wi-Fi module by sending AT command, it will revert back a response containing OK.
2. After this, we need to select mode using command AT+CWMODE=mode_id , we have used Mode id =3. Mode ids:
1 = Station mode (client)
2 = AP mode (host)
3 = AP + Station mode (Yes, ESP8266 has a dual mode!)
3. Now we need to disconnect our Wi-Fi module from the previously connected Wi-Fi network, by using the command AT+CWQAP, as ESP8266 is default auto connected with any previously available Wi-Fi network
4. After that, user can Reset the module with AT+RST command. This step is optional.
5. Now we need to connect ESP8266 to Wi-Fi router using given command
AT+CWJAP=”wifi_username”,”wifi_password”
6. Now get IP Address by using given command:
AT+CIFSR
It will return an IP Address.
7. Now enable the multiplex mode by using AT+CIPMUX=1 (1 for multiple connection and 0 for single connection)
8. Now configure ESP8266 as server by using AT+CIPSERVER=1,port_no (port may be 80). Now your Wi-Fi is ready. Here ‘1’ is used to create the server and ‘0’ to delete the server.
9. Now by using given command user can send data to local created server:
AT+CIPSEND =id, length of data
Id = ID no. of transmit connection
Length = Max length of data is 2 kb
10. After sending ID and Length to the server, we need to send data like : Serial.println(“circuitdigest@gmail.com”);
11. After sending data we need close the connection by given command:
AT+CIPCLOSE=0
Now data has been transmitted to local server.
12. Now type IP Address in Address Bar in web browser and hit enter. Now user can see transmitted data on webpage.