This PowerShell script suite is designed to retrieve and display GPS data from Location COM devices on Windows systems. It utilizes:
- Windows Location API ππ§ to fetch processed location data if available.
- COM Port Reading ππ to capture raw NMEA sentences from GPS devices connected via serial ports.
AI-Assisted Development π€π‘ This script was created with significant assistance from AI technologies. As the creator is not a professional PowerShell or software developer, the code reflects a collaborative approach between human intent and AI-generated solution.
- Automatic COM Port Detection ππ: Scans for and lists all available COM ports.
- Multiple Data Sources ππ:
- Windows Location Service for high-level location data.
- Direct COM port reading for raw GPS data (NMEA sentences).
- Windows OS with PowerShell 5.1 or higher π»
- Administrative privileges might be necessary for accessing COM ports π
No installation required; just run the script from PowerShell:
- Download or copy the script π₯ to your local machine.
- Open PowerShell π₯οΈ as an Administrator if you encounter permission issues.
-
Open PowerShell and navigate to the directory containing the script:
cd "path\to\your\script\directory" -
Run the script:
.\GPSDataReader.ps1
- Try to fetch location data via the Windows Location API. πΊοΈ
- Scan for all available COM ports and attempt to read NMEA data from each.π
- COM Ports: π The script assumes a baud rate of 9600. Adjust this in the script if your device uses a different rate.
- Data Output: π Raw NMEA data might not be formatted; you'll see whatever comes through the port.
- Error Handling: π¨ Basic error handling is implemented, but you might encounter issues if ports are in use or not configured correctly.
- Baud Rate: Change the $baudRate parameter in the Get-NmeaDataFromComPort function.
- Timeout: Adjust the ReadTimeout in the COM port reading function to optimize for your hardware.
No Data Detected π‘β
- Verify GPS sensor power and connection ππ
- Check Device Manager for port conflicts π»π§
- Ensure no other applications are using the COM port π₯οΈπ
- Run PowerShell as Administrator ππ»
- Verify user has necessary system permissions π‘οΈπ€
- Check Windows Location Service settings βοΈπ
- Increase ReadTimeout for slower devices π°οΈπ’
- Verify device-specific communication parameters ππ§
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Pull requests are welcome! π For major changes, please open an issue first to discuss what you would like to change.
Happy GPS tracking! πππ°οΈ