wireless

module
v0.0.0-...-f0d8647 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0, BSD-3-Clause

README

wireless

Wireless communication protocol implementations to be used by TinyGo supported radios.

For example, this program sends WSPR packet data:

package main

import (
	"time"

	"tinygo.org/x/wireless/wspr"
)

func main() {
	println("Starting WSPR communication example...")
	time.Sleep(2 * time.Second)

	// init the modem
	println("WSPR modem initialized.")
	radio := initRadio()

	frequency := radio.GetBaseFrequency()
	println("Transmitting on frequency", frequency, "Hz")

	data := make([]byte, 256)

	// Example WSPR packet data
	// K1ABC FN42 37
	// See https://en.wikipedia.org/wiki/WSPR_(amateur_radio_software)
	msg, err := wspr.NewMessage("K1ABC", "FN42", 37)
	if err != nil {
		println("Error creating WSPR message:", err.Error())
		return
	}
	n, err := msg.WriteSymbols(data)
	if err != nil {
		println("error writing WSPR message")
		return
	}

	// transmit some data
	for range 50 {
		println("Transmitting WSPR message with", n, "symbols")
		if err := radio.WriteSymbols(data[:n]); err != nil {
			println("error transmitting WSPR message:", err.Error())
			return
		}

		println("Waiting for next transmission...")
		time.Sleep(15 * time.Second)
	}

	time.Sleep(2 * time.Second)

	// put the radio in standby
	println("Putting radio in standby mode...")
	radio.Standby()
	time.Sleep(1 * time.Second)

	println("WSPR modem example completed.")
	radio.Close()
}

Supported Protocols

AFSK

Audio Frequency-Shift Keying

https://notblackmagic.com/bitsnpieces/afsk/

FSK4

Frequency-shift keying (FSK4)

https://en.wikipedia.org/wiki/Frequency-shift_keying

LoRa

Long Range (LoRa)

https://en.wikipedia.org/wiki/LoRa

LoRaWAN

Long Range Wide Area Networking (LoRaWAN)

https://en.wikipedia.org/wiki/LoRa#LoRaWAN

U4B

Telemetry protocol on Weak Signal Propagation Reporter (WSPR)

https://qrp-labs.com/u4b/u4bdecoding.html

WSPR

Weak Signal Propagation Reporter (WSPR)

https://en.wikipedia.org/wiki/WSPR_(amateur_radio_software)

Supported Radios

  • si5351
  • SX126X

Directories

Path Synopsis
examples
afsk command
AFSK modem example using Si5351 as the frequency generator.
AFSK modem example using Si5351 as the frequency generator.
fsk4 command
FSK4 modem example using Si5351 as the frequency generator.
FSK4 modem example using Si5351 as the frequency generator.
lora/lorawan/basic-demo command
Simple code for connecting to Lorawan network and uploading sample payload
Simple code for connecting to Lorawan network and uploading sample payload
wspr command
WSPR example
WSPR example
package wspr contains code that implements the WSPR protocol
package wspr contains code that implements the WSPR protocol

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL