Skip to content

Instantly share code, notes, and snippets.

@jones2126
jones2126 / README.md
Last active May 1, 2025 13:26
GPS RTK Correction Data Using RTK2GO Mount Point

Overview

This script connects to a mount point on RTK2GO NTRIP caster to fetch RTCM correction data and forwards it to a GPS receiver connected via a serial port (COM6). It supports NTRIP v1 protocol, parses NMEA GPGGA sentences. For debugging it logs RTCM data.

Python Library Dependencies

  • socket, base64, serial, serial.tools.list_ports, time, threading, traceback, sys, binascii

How to Use

The script uses the following constants, defined at the top:

@jones2126
jones2126 / COMRead.py
Created February 17, 2025 13:39
Script to read incoming GPS data from SkyTraQ PX1172RDP gnss device and report message types and Hz
'''
This program opens a serial connection to a PX1172RDP rover device (on ROVER_PORT at BAUD_RATE), continuously reads incoming
data for a specified duration (RUN_DURATION), identifies message types (e.g., RTCM or various NMEA sentences), counts how many
of each type are received, and then prints a summary report of the message frequencies at the end. It can optionally print the
raw messages and their hexadecimal representations during data collection if PRINT_MESSAGES is enabled.
'''
import serial
import time
from collections import defaultdict
@jones2126
jones2126 / com6tocom10.py
Last active February 9, 2025 23:32
A script used for testing passing correction data over USB with two SkytraQ GPS units connected via USB to one laptop.
'''
com6tocom10.py
This is a script used for testing passing correction data over USB with two GPS units connected
to one laptop. The script performs these functions:
1. Forward RTCM correction data from my Base GNSS receiver, a SkytraQ PX1125R, connected on (COM6) to a
Rover GNSS receiver (COM10).
2. Monitor NMEA messages from my Rover, a Skytraq PX1172RDP, on COM10 and extract RTK Fix status
from $GPGGA messages.
3. Print the RTK Fix status every 5 seconds along with the last $GPGGA message.
'''
@jones2126
jones2126 / teensyNRF24_LEDs_Toggle.ino
Created December 18, 2024 13:57
Test code that provides a shell to integrate a NRF24 transceiver, through hole, PL9823 RGB LEDs for status reporting and SDPT toggle switch to track 3 states. The code runs on a Teensy 3.2 and uses Teensy specific elapsedMillis for loop timing control. The NRF24 uses an SPI interface. It also implements a two-way communication approach with ackn…
#include <SPI.h>
#include <RF24.h>
#include <Adafruit_NeoPixel.h>
// LED Definitions
#define NUM_LEDS 3
#define DATA_PIN 2
#define SWITCH_PIN1 3
#define SWITCH_PIN2 4
@jones2126
jones2126 / gist:90dda87dacecac81c32946fc23300b12
Created March 17, 2024 19:31
Two examples of using the 1.28" TFT LCD and an ESP32. The first example is extremely simple; However it flickers. The second one avoids the flicker by using the sprite function.
// First example - extremely simple
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
unsigned long displayWeightLastTime = 0;
unsigned long displayWeightDelay = 1000;
unsigned long currentMillis = 0;
@jones2126
jones2126 / gist:e0f5552eafbd3c9419a99385192b3c08
Created March 11, 2024 21:02
Example of rotating sprites using the TFT_eSPI
/*
Example code for 1.28 inch, 240*240 TFT LCD Display which uses the GC9A01 driver. The code rotates a needle
around a pivot point (think compass needle). Thanks to "Volos Projects" on YouTube.
Original code ref: https://github.com/VolosR/RotateSpritesTutorial/blob/main/RotateSpritesTutorial.ino
YouTube ref: https://www.youtube.com/watch?v=oqBa_ptBmLU
I adapted the example code for my LCD that is 240x240 and used some variables in the process
*/
#include <TFT_eSPI.h>
@jones2126
jones2126 / tfttestwithESP32.ino
Created March 9, 2024 19:33
Using Adafruit Example code for TFT 1.28 inch LCD Display Module Round RGB 240*240 and my 30 pin ESP32
// Credit Adafruit example that comes with the Adafruit_GC9A01A.h library. I only wired my board
// consistent with the pin definitions in lines 31-35 using a ESP32 with 30 pins (i.e. ESP-WROOM-DA Module)
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_GC9A01A.h"
// Define pins for display interface. You'll probably need to edit this for
// your own needs:
@jones2126
jones2126 / gpsurvey.ino
Created February 8, 2024 17:03
Sending lat, lon and altitude data from #BESTPOS and $GPGGA messages to Google Sheet in order to survey a site (i.e. average the position over time) so I have use the 'fix position' statement when configuring my Base RTK GPS that sends correction data.
#include <HardwareSerial.h>
#include <WiFi.h>
#include <HTTPClient.h>
// WiFi credentials
const char* ssid = "Pixel_1";
const char* password = "Taco1234";
// Google_Deployment_ID = "AKfycbwZv_vHVI9Hw67vYj609zprKJmdVEuHyH37Mg3VCzo-2lPU9Zaz-dHLp1P7RRAgSDMb"
const char* googleURLPrefix = "https://script.google.com/macros/s/AKfycbwZv_vHVI9Hw67vYj609zprKJmdVEuHyH37Mg3VCzo-2lPU9Zaz-dHLp1P7RRAgSDMb/exec";
@jones2126
jones2126 / gist:a2045cc7bccf19a880a54732f25a375c
Created January 26, 2024 16:48
Using Google Sheets and ESP32 as a data logger
// below is the code that runs on the ESP32
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include "DHT.h"
#include <Arduino.h>
@jones2126
jones2126 / ttgo_cytron_pid_v3
Last active October 7, 2022 15:57
Used to control a DC steering motor powered by a Cytron MD30C. Currently this is a testing program to determine the PID values. To make that process faster this program reads 3 potentiometers to allow changing the Kp, Ki and Kd values. The current MCU is a TTGO LoRa ESP32 OLED board. The motor is producing a high pitched whining sound. Further r…
/*
* Calculate the error between current direction and the desired direction
* convert the error to a value 0-255 to drive the Cytron motor controller connected to a steering motor.
* Ref: https://www.youtube.com/channel/UCjiVhIvGmRZixSzupD0sS9Q
*
* Thank you Jeff Sampson for guidance and corrections
*/
#include <Arduino.h>