Got the AIr530 connected to the expansion board with Xiao Sense on board.
GPS library TinyGPS, basic example works well, Co-ordinates are Very accurate AFAIK less than a meter for sure. You get a Green Yellow flip of the LED’s when Connected to Sats, Green when powered on.
Here’s the basic code and pictures.
The last one is the connected to U-center from Ublox with a free Google maps API key inserted.
HTH
GL PJ
Scary how accurate this is even indoors , one of those Ukrainian drones dropping a grenade would be close enough…WOW
#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h>
#include <TinyGPSPlus.h>
static const int RXPin = 6, TXPin = 7; // 6, 7
static const uint32_t GPSBaud = 9600;
//TinyGPSPlus object
TinyGPSPlus gps;
//Display object
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/ PIN_WIRE_SCL, /* data=*/ PIN_WIRE_SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
const int pinLed = LED_BUILTIN;
float __longitude = 0;
float __latitude = 0;
const int ledPin = LED_BUILTIN;
int BuzzerPin = A3; //A3 , P0.29 PIN 4
int buzzer = BuzzerPin;
void setup(void) {
u8x8.begin();
u8x8.setFlipMode(1); // set number from 1 to 3, the screen word will rotary 180
Serial1.begin(GPSBaud);
Serial.begin(9600);
delay(2000); //relax...Get Ready for serial port
Serial.println("Test program" __FILE__ " compiled on " __DATE__ " at " __TIME__);
Serial.println();
Serial.println("Processor came out of reset.");
initdisplay();
setupblink();
}
void loop(void) {
dispGPS();
while (Serial1.available() > 0)
if (gps.encode(Serial1.read()))
{
__latitude = gps.location.lat();
__longitude = gps.location.lng();
}
}
void dispGPS()
{
//Serial.println("getting gps");
u8x8.setCursor(0, 0);
u8x8.print("GPS LOCATION ");
u8x8.setCursor(0, 3);
u8x8.print(__latitude, 6);
u8x8.setCursor(0, 5);
u8x8.print(__longitude, 6);
}
void setupblink(){
setLedRGB(false, false, true); // set Blue LED
delay(1000);
setLedRGB(false, true, false); // Red
delay(1000);
setLedRGB(true, false, false); // Green
delay(1000);
setLedRGB(false, false, false); // OFF
}
void initdisplay() {
pinMode(LEDR, OUTPUT); // initialize the LED pin as an output:
pinMode(LEDG, OUTPUT); // initialize the LED pin as an output:
pinMode(LEDB, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT); // initialize the LED pin as an output:
u8x8.begin();
u8x8.setFlipMode(1); // set number from 1 to 3, the screen word will rotary 180
u8x8.setFont(u8x8_font_8x13B_1x2_r);
u8x8.clearDisplay();
u8x8.setCursor(0, 0);
u8x8.print("Power ON ");
}
void startsound() {
tone (buzzer, 890);
delay (220);
noTone(buzzer);
delay (20);
tone (buzzer, 800);
delay (220);
noTone(buzzer);
delay (20);
tone (buzzer, 800);
delay (220);
noTone(buzzer);
delay (20);
tone (buzzer, 990);
delay (420);
noTone(buzzer);
delay (20);
}
void setLedRGB(bool red, bool green, bool blue) {
if (!red) { digitalWrite(LEDR, HIGH); } else { digitalWrite(LEDR, LOW); }
if (!green) { digitalWrite(LEDG, HIGH); } else { digitalWrite(LEDG, LOW); }
if (!blue) { digitalWrite(LEDB, HIGH); } else { digitalWrite(LEDB, LOW); }
}
// END