[Digi-Key Follow me Issue 1] Implementing electronic fence function through GPS
[Copy link]
This post was last edited by HonestQiao on 2023-7-1 15:45
1. Project description (about 800 words, pay attention to neat format)
This event provides the Air530 GPS module, through which Pico W can easily and quickly obtain GPS positioning information.
However, the screen used in this event was a small OLED 128*64 screen that could only display relatively basic information.
Based on the actual situation, an electronic fence project was realized through GPS positioning information.
Its specific functions are as follows:
1.1 After the code is started, simple music is played to indicate the start
1.2 Start key monitoring. When the BOOT key is long pressed, the initial position setting is started. If valid GPS positioning information has been read, the current position information is set as the initial position information, and subsequent positioning information will be compared with this position. After the setting is successful, a music reminder will be played.
1.3 In the loop, read the GPS information of Air530 through the serial port, and update the read information to the screen for display
1.4 If the GPS information read is valid and the initial position has been set, the distance is calculated and output to the screen.
1.5 If the distance exceeds the set safety distance, a music alarm will be played
The main technologies involved in this project are as follows:
1. Read the GP information of Air530 through the serial port and decode it
2. Read the status of the BOOT button, identify short press and long press, and set the long press to set the initial position
3. Use nano-gui to process the display of OLED screen
4. Control the passive buzzer to play sound through PWM
5. Calculate the location distance through GPS positioning information
2. Main code snippets and descriptions corresponding to each function
2.1 Initialization settings:
2.2 Playing Music:
2.3 Get GPS information:
2.4 Initial position setting:
2.5 Calculating distance by latitude and longitude
2.6 Main process:
3. Function display and description (with pictures and text)
3.1 Overall structure:
3.2. After the program is started, the corresponding log information will be output:
3.3. The current real-time information is displayed on the screen:
4. Your experience of this activity (including opinions or suggestions)
Because I had used Hezhou's GPS before, the GPS module was easy to drive.
I have used OLED before, but this time I used nano gui to drive the OLED, which is easier to use and more convenient.
In addition, it is suggested that in the future, basic and challenging tasks can be set up to allow everyone to show their skills.
5. Complete code
6. Project Video:
|