Skip to content

New-England-Weather-Balloon-Society/Tiny4FSK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

148 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Tiny4FSK_Logo

Tiny4FSK - The Lightweight Horus Binary Tracker Built for HABs

WORK IN PROGRESS - Please do not rely on this as your only tracking system. Tiny4FSK is still in the R&D phase of development and testing.

NEW - Horus Binary v3! + quick lock mode and recovery mode

STATE - Main branch is stable!

What is the Tiny4FSK project?

Tiny4FSK aims to be an ultra-tiny high-altitude tracking system. It runs on 1 AA battery that lasts for 10-17 hours (packet interval and power output can be adjusted to lengthen battery life). It runs on 4FSK (4-frequency shift keying), which means that it separates tones into 4 separate frequencies. Upon this, it uses the Horus Binary v3 system, which is a relatively modern system popularly used with RS41ng.

20240826_110047

What are High-Altitude Balloons?

High altitude balloons (HABs) allow space science enthusiasts to launch their own payloads to near-space (30km) at a cost of hundreds of dollars instead of millions of dollars. This can be done for atmospheric research, breathtaking imagery, and scientific experimentation. While demanding meticulous planning, safety adherence, and technical skill in electronics and mechanics, this hobby rewards makers with a chance to get hands on with projects like electronic data loggers, camera systems, wireless communications, and more.

Parts and Materials

This codebase is meant to work with the Tiny4FSK PCB, also available on this GitHub repository. Key components include:

  • Microcontroller - SAMD21G18A. A modern Cortex-M0+ microcontroller by Microchip.
  • TX Module - Si4063. A transceiver from Silicon Labs, similar to the Si4032 on RS41 radiosondes.
  • GPS RX Module - ATGM336H. A cheap, high-performance GPS module from ZHONGKEWEI.
  • Environmental Sensor - BME280. A proven sensor from Bosch for measuring temperature, pressure, and humidity.
  • Boost Converter - TPS61200. Boosts 1.5V battery level to 3.3V for the rest of the board from Texas Instruments.
  • LDO Step-Down - MCP1700. A step-down converter from Microchip.

This list is not exhaustive. Additional components and passives are detailed in the schematic files.

The Codebase

This code is modular and separated into several different files for easy expansion. These files are listed below:

  • Tiny4FSK.ino - Main Arduino file with control flow.
  • config.h - Configuration file for user parameters.
  • crc_calc.cpp and crc_calc.h - CRC16 generator files for parity bits.
  • horus_l2.cpp and horus_l2.h - Horus layer 2 file, Golay error correction algorithm.
  • horus_binary_v3.cpp and horus_binary_v3.h - Horus Binary v3 packet assembly and encoding functions.
  • voltage.cpp and voltage.h - Voltage detection using ADC values.
  • si4063.cpp and si4063.h - Si4063 driver files for radio transmission.
  • 4fsk_mod.cpp and 4fsk_mod.h - 4FSK modulation functions.
  • utils.cpp and utils.h - A collection of utility functions.

Step by Step Setup Guide

Setting up the PCB

For pre-flight configuration, the USB board does not need to be broken off, and code can be uploaded normally by just plugging in the USB as it arrives. However, the breakout may be removed to save space during flights!

  1. Carefully snap off the USB breakout board from the board.
  2. Solder on the female 1x4 header row onto the underside of the USB breakout. Solder on the 1x4 male header row to the corresponding adjacent pins (labeled VSS, GND, D-, and D+).

Solder diagram 3. To program the board, attach the USB breakout board as shown in the photo. Once the board is programmed, the USB breakout board can be removed for flight.

USB Connection Diagram

Antenna System

This system relies on the 70cm amateur radio band (420-450 MHz in the US), and requires an amateur radio license, issued by the FCC, to operate. A pre-cut braided copper monopole is included, optimized to transmit on this frequency. The included antenna is a quarter-wave monopole, meaning that the antenna is just a quarter of the wavelength of the signal, and yet it maintains a good SWR (quantification of how much signal is reflected back into the transmitter). There is a pad that supports a quarter-wave monopole, but also provides grounding pads for a coax connector if alternate antennas wish to be used.

Why does this work? A 1/4 wave monopole antenna works by using a quarter of the wavelength of the signal, which creates a resonant frequency that efficiently radiates radio waves. The ground plane acts as a reflector, effectively doubling the antenna's length and improving signal strength and quality.

Solder the copper wire onto the center pin of the antenna connector (as depicted below).

Antenna Connection

PCB Configuration

The Tiny4FSK PCB has many configurable operating modes, pins and power sources. This section will outline these parts of the PCB.

The PCB contains one jumper, JP1.

  • JP1 - Cut (desolder) to enable SW1 for power. During flight, the mechanical shock from the landing can cause the power switch to flip, so solder this jumper to disable this risk. (Bypasses SW1).

There are also two switches/buttons, SW1 and SW2.

  • SW1 - Battery power switch. Connects battery output to boost converter input. When the battery is connected, this functions as the main power switch.
  • SW2 - Reset button for the microcontroller.

There are two antenna pads, AE1 and AE2.

  • AE1 - L1 GPS band antenna
  • AE2 - 70cm antenna pad. For a guide to cut a proper antenna, refer to the above section.

Setting up the Code

Now that you've got all the hardware set up, time for programming!

Setting up Arduino IDE

This project is based on the Arduino IDE workflow. Below steps outline steps necessary to install Arduino IDE and configure it for the SAMD microcontroller.

  1. Install Arduino IDE from here.
  2. Download the Arduino SAMD core.
  3. Download necessary libraries from library manager:
    • Arduino Low Power (with dependencies)
    • TinyGPSPlus
    • Scheduler

Optional - The SAMD goes to sleep to save power. To achieve proper sleep, some edits to the SAMD core are necessary. To locate the wiring.c file on your computer, follow this guide.

Windows: C:/Users/[YOUR USER]/AppData/Local/Arduino15/packages/arduino/hardware/samd/1.8.14/cores/arduino

Once there, comment out or completely delete the lines shown below:

    // Defining VERY_LOW_POWER breaks Arduino APIs since all pins are considered INPUT at startup
    // However, it really lowers the power consumption by a factor of 20 in low power mode (0.03mA vs 0.6mA)
    #ifndef VERY_LOW_POWER
      // Setup all pins (digital and analog) in INPUT mode (default is nothing)
      for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
      {
        pinMode( ul, INPUT ) ;
      }
    #endif

Arduino gives you an official warning: "This breaks Arduino APIs since all pins are considered INPUT at startup. However, it really lowers the power consumption by a factor of 20 in low power mode (0.03mA vs 0.6mA)". Testing has shown no adverse effects.

Code Configuration

User configuration of this tracker is required. As this system uses amateur radio, you will need at least a Technician's level license (US). Configuration file is located in config.h. Open this file in Arduino IDE. Here are the parameters may need to be changed.

  • CALLSIGN - Amateur radio callsign. This is required to stay legal!
  • CALLSIGN_WPM - Speed to send the callsign, in morse code.
  • CALLSIGN_INTERVAL - Interval to send the morse code callsign. Maximum interval in the US is 10 minutes.
  • FSK_FREQ - This is setting for your preferred TX frequency. The filter is optimized for 70cm radio band.
  • STATUS_LED - Comment out to disable verbose status LEDs on PCB.
  • DEV_MODE - Comment out for flight mode, uncomment during programming. Disables Serial and enables deep sleep modes for lower power consumption.
  • PACKET_INTERVAL - Interval between 4FSK packets. The smaller the interval, the lower the battery life is.
  • OUTPUT_POWER - 0-127. This is the output power of the radio module (suggested to keep at maximum).
  • FLAG_BAD_PACKET - If the latest GPS values are bad, send out all zeroes (for time, position, speed, and altitude)(suggested).
  • QUICK_LOCK - Quick lock mode lowers the output power and increases packet interval while the GPS doesn't have a lock. This helps with desensing the GPS receiver. Values return to previously-defined PACKET_INTERVAL and OUTPUT_POWER upon lock.
  • QUICK_LOCK_POWER - Power level used while the GPS doesn't have a lock. Only applied if QUICK_LOCK mode is enabled.
  • QUICK_LOCK_INTERVAL - Packet interval used while the GPS doesn't have a lock. Only applied if QUICK_LOCK mode is enabled.
  • RECOVERY_MODE - If enabled, the tracker will send updates less frequently when on the ground to save power. Only occurs if the tracker detects it's in a flight.
  • RECOVER_MODE_INTERVAL - Interval to transmit in recovery mode, when on the ground.
  • RECOVERY_MODE_FLIGHT_THRESHOLD - Altitude threshold to consider ourselves in flight, in meters.
  • RECOVERY_MODE_LAND_THRESHOLD - Altitude threshold to consider ourselves on the ground, in meters. Recovery mode will trigger below this altitude.

Output power mapping

Approximate mapping from the OUTPUT_POWER numeric value to typical output in dBm:

Value Approx. dBm
127 19 dBm
100 18 dBm
80 16.5 dBm
60 14.5 dBm
40 11.4 dBm
20 5.6 dBm
0 -45 dBm
How do I change these values? If there is a pre-existing number or value next to the name of the setting name, you can replace that value with the desired value (e.g. replace the "N0CALL" with your callsign in double quotes, "W0MXX"). If there is no value next to the name, you need to comment out the setting to disable that functionality, or uncomment to enable that functionality (comments are defined by adding // at the start of the line).
A note on reprogramming without DEV_MODE, or: Why does the board continuously disconnect from the computer? On the condition that DEV_MODE is uncommented, the microcontroller goes into deep sleep to conserve power. Part of this sleep cycle includes disabling the USB peripheral, causing the board to appear to continuously disconnect and reconnect. This can easily be fixed by double-clicking the reset button. Doing so will enter the board into bootloader mode, which will attach the board onto a new USB port and disable any code. Once new code is uploaded, the board will appear on a different port on the computer.

Battery Life Expectations

Through a series of battery life tests on ground-level, we've created a graph approximating the battery life with reference to packet interval and transmit power.

These graphs only provide an approximation. Variation will still occur from battery to battery, and we always recommend testing yourself prior to flight and aiming for double the battery life necessary.

At maximum power (127):

Graph showing level at max power

All power levels from 0 (no amplifier) to 127 (max power):

Graph showing levels at several powers

All tests ran with quick lock off and 1x Energizer Ultimate Lithium AA.

Upload the Code!

Once code configuration is complete, you may plug in a standard data USB-C cable into the breakout board, select the port in Arduino IDE, and select the upload button (marked by an arrow at the top). You should select the Arduino Zero (Native USB Port) as the board name.

Testing

Once the code is uploaded, you'll see the green LED pulse briefly to indicate initialization. The behavior of that LED is outlined here. Now you'll need to set up a receive station on either a laptop and an RTL-SDR, Raspberry Pi and RTL-SDR, or any browser-enabled device with an RTL-SDR.

You should start decoding packets transmitted from the board with your configuration parameters. It may take up to 5 minutes to gain a GPS fix, depending on your location.

LED Default Behavior

Green LED Behavior Meaning
Single 1s pulse GPS detected / Airborne mode set (single pulse during initialization)
Single 0.5s pulse Packet transmission (packet build / transmit — single short pulse)
Off Idle or deep sleep (no continuous blinking)

External Sensors

Tiny4FSK now offers compatibility with external sensors by automatically scanning I2C on startup. Some sensors come with the Tiny4FSK General Shield, which can be found on the GitHub Repository. If you have any custom sensors which you would like me to add support for, please raise an issue.

PCBWay PCBs

The Revision 4 PCBs have been fabricated and assembled through PCBWay. Their high-quality fabrication and assembly services are truly commendable. I appreciated the ability to choose from many different component suppliers to select the exact components I needed. Additionally, their customer service is incredibly responsive and helpful, and quickly notified me of design issues. I highly recommend PCBWay for any of your PCB prototyping & assembly needs. Thank you, PCBWay, for graciously sponsoring this project!

alt text

Contact Me!

To ask questions, kindly donate, or even say hi, feel free to contact me at this email: tiny4fsk@gmail.com. Thanks!

Cited Works and Sources

Special Thanks

This project would not be possible without the following individuals:

  • Charlie Nicholson KC1SFR for collaboration.
  • Mark Jessop VK5QI for extensive support.
  • Mike Hojnowski KD2EAT for helping out with software and hardware issues.
  • Bob Phinney K5TEC for providing funding for this project.
  • Brett Miwa for schematic and PCB design help.
  • Joe KM1P for RF help.
  • My parents for motivation.

And these entities:

  • PCBWay for PCB prototyping and sponsorship!
  • Bagel Fund for sponsorship!
  • Hack Club for support and sponsorship!
  • New England Sci-Tech for providing a makerspace.
  • Sci-Tech Amateur Radio Society for expertise.
  • New England Weather Balloon Society for insights.
  • Digikey for part sourcing.

License

Software and Documentation:

Hardware License:

Pictures

Releases

No releases published

Packages

 
 
 

Contributors