In this part of the series we'll receive raw data from the Neo-6m GPS module and process it to give us readable GPS coordinates.
Create a new directory at the same level as the src directory. Inside this examples directory create a gps.rs file in which we'll write our example program. Copy the final code from the previous part into this file.
Table of Contents
- Requirements
Implementation
- Connections
- Raw GPS data
- GPS Coordinates
- Look Angles
- Results
Requirements
- 1 x Raspberry Pico board
- 1 x USB Cable type 2.0
- 1 x Neo-6M GPS Module
- 9 x M-M jumper wires
- 1 x HC-05 Bluetooth Module
- 2 x Mini Breadboards
- Serial Bluetooth App
Implementation
Connections
Connect the various modules to the Pico as shown below.
NB❗ You have to keep the GPS module where it can have a view of the sky. If indoors, please note that it may take a good while to lock onto satellites.
Continuous blinks every second is an indication of the module acquiring sufficient GPS data.
GPS Coordinates
We should now process the raw GPS data received into location coordinates. This can be achieved by implementing the below algorithm.
Look Angles
We can further calculate for look angles using the below function which implements a satellite look angle calculator.
fn get_look_angles(lat: f32, long: f32, alt: f32) -> (f32, f32) {
// Earth Station in radians
let le: f32 = lat*PI/180.; // Latitude: N +ve, S -ve??
let ie: f32 = long*PI/180.; // Longitude: E +ve, W -ve??
let _h: f32 = alt; // Altitude
// Satellite position in radians
const _LS: f32 = 0.;// Latitude
const IS: f32 = 50.*PI/180.;// Longitude
// Determine Differential Longitude, b
let b = ie - IS;
let mut theta = (((le.cos()*b.cos())-0.151)/(1.-(le.cos()*le.cos()*b.cos()*b.cos())).sqrt()).atan();
let mut ai = (b.tan()/le.sin()).atan();
// Convert into Deg.
theta *= 180.0/PI;
ai *= 180./PI;
// Azimuth Angle
let phi_z = {
if (le < 0.) && (b > 0.) {
360. - ai
} else if (le > 0.) && (b < 0.) {
180. + ai
} else if (le > 0.) && (b > 0.) {
180. - ai
} else {
ai
}
};
(theta, phi_z)
}
Import PI from the core library that'll be used in the get_look_angles function.
use core::f32::consts::PI;
Also import the micromath crate to facilitate the function.
use micromath::F32Ext;
In the toml file under dependencies add:
micromath = "1.1.1"
Update the loop section to calculate the look angles and transmit via uart0.
// Calculate look angles
(theta, phi) = get_look_angles(
position.lat,
position.long,
position.alt);
writeln!(serialbuf, "theta: {} phi: {}", theta, phi).unwrap();
transmit_uart_uart_data(
uart_data.as_mut().unwrap(),
serialbuf);
We will the continue with initializing both theta and phi in the set-up section.
// Variables
let (mut theta, mut phi) = (0., 0.);
Results
The final code will be .
Flashing this into the Pico, we should be able to receive the raw GPS data from the Neo-6m module and calculate look angles.
In the next part we continue with the application of the above in our main program.

SOCIAL SHARE CARD GENERATOR