Difference between revisions of "PIC APRS Beacon"

From AD7ZJ Wiki
Jump to navigation Jump to search
Line 1: Line 1:
This project was started as a fun experiment to see if an AFSK signal could be generated using only an 8 bit PIC and a resistor ladder network.  Since this is now realized, the additional features to make it a fully capable beacon will (hopefully:) be implemented.   
+
This project was started as a fun experiment to see if an AFSK signal could be generated using only an 8 bit PIC and a resistor ladder network.  Once that was working, I laid out a board for it and added the additional software logic to get what you see here.   
  
== High Level System Requirements ==
+
== Overview ==
  
 
[[File:Layout.png|thumb|PICTrack board layout]]
 
[[File:Layout.png|thumb|PICTrack board layout]]
 
[[File:Schematic.png|thumb|PICTrack board layout]]
 
[[File:Schematic.png|thumb|PICTrack board layout]]
* Implementation should be simple and inexpensive
+
* Simple and inexpensive APRS beacon
* AX.25 packet capability for data transmission
+
* AFSK is generated using a resistor network so no modem chip is needed
* Interface with a GPS using either ASCII NMEA or a binary protocol
+
* Adjustable audio output allows interfacing with a variety of radios
* On-board landing prediction based on wind data gathered during ascent
+
* Integrated GPS with helical antenna - no cables to break and works in any orientation
* Logging
+
* NMEA strings are stored on a FAT32 formatted micro SD card
** Data to be stored on on-board flash memory. 
+
* Software is modular and easy to understand
** Board temperature
 
** Battery voltage
 
* Ability to configure volatile parameters via RS232 console
 
** Call Sign & SSID
 
** Status string
 
  
 
== Hardware ==
 
== Hardware ==
  
The hardware started out based around a PIC18F14K22 (?) which is one of the higher end 8 bit PICs.  It's capable of running at up to 64 MHz, or 16 MIPs since each instruction takes 4 clock cycles to execute.  This worked well, but only has 512 bytes of RAM which may get a little thin handling NMEA strings.  The PIC18F2525 would be a second choice if more RAM is necessary.
+
The hardware started out based around a PIC18F14K22 which is one of the higher end 8 bit PICs.  It's capable of running at up to 64 MHz, or 16 MIPs since each instruction takes 4 clock cycles to execute.  This worked well, but only had 512 bytes of RAM which wasn't enough for handling NMEA strings and a full FAT filesystemI switched to the PIC18F2525 since it has plenty of both codespace and RAM.  It's running at 32 MHz clocked off the internal oscillator, although the current board layout has provision for an external crystal should that prove to be necessary for temperature stability.
  
Currently it is using a VHF [[Maxon Radio]] for communication.  These can be tuned from 144 to 178 MHz.   
+
For communication it's currently using a VHF [[Maxon Radio]].  These can be tuned from 144 to 178 MHz and are very durable - the downside is their weight (about 9oz).   
  
 
== Software ==
 
== Software ==
Line 27: Line 22:
 
The source code is hosted at github here https://github.com/AD7ZJ/PICAprs
 
The source code is hosted at github here https://github.com/AD7ZJ/PICAprs
  
The software is written in C and built with the Hitec C compiler.  The AFSK modulator works using a 32 entry lookup table, which produces a single cycle of a sin wave.  AFSK switches between 1200 Hz and 2200 Hz to represent mark and space, with a baud rate of 1200 bps.  The data itself is encoded using NRZI (non-return to zero inverted), meaning zeros cause a state (as in, mark or space) change while 1's cause the state to remain the same.  Bitstuffing is performed to keep 5 or more 1's from ever being sent in a row - this helps keep the receiver's clock synced up.
+
The software is written in C and built using MPLab X and the XC8 compiler.  The AFSK modulator uses a resistor network and a 16 entry lookup table to produce a sin wave.  There's a 1k resistor, 2k, 4k, 8k (or as close as standard values allow) which let 4 digital outputs work as a primitive sort of DAC (think powers of 2).  The lookup table is designed to approximate a sin wave using the 16 possible outputs of this DAC.  The sin wave's frequency can be adjusted by how quickly we step through the tableThis timing is set by one of the PIC's internal timer modules, Timer2.  I initially tried to use this on an interrupt routine, but it turned out the context switch time to service each interrupt was taking too long.  So while a packet is being sent, nothing else is happening. 
 +
 
 +
AFSK switches between 1200 Hz and 2200 Hz to represent mark and space, with a baud rate of 1200 bps.  The data itself is encoded using NRZI (non-return to zero inverted), meaning zeros cause a state (as in, mark or space) change while 1's cause the state to remain the same.  Bitstuffing is performed to keep 5 or more 1's from ever being sent in a row - this helps keep the receiver's clock synced up.
 +
 
  
  

Revision as of 02:43, 4 January 2014

This project was started as a fun experiment to see if an AFSK signal could be generated using only an 8 bit PIC and a resistor ladder network. Once that was working, I laid out a board for it and added the additional software logic to get what you see here.

Overview

PICTrack board layout
PICTrack board layout
  • Simple and inexpensive APRS beacon
  • AFSK is generated using a resistor network so no modem chip is needed
  • Adjustable audio output allows interfacing with a variety of radios
  • Integrated GPS with helical antenna - no cables to break and works in any orientation
  • NMEA strings are stored on a FAT32 formatted micro SD card
  • Software is modular and easy to understand

Hardware

The hardware started out based around a PIC18F14K22 which is one of the higher end 8 bit PICs. It's capable of running at up to 64 MHz, or 16 MIPs since each instruction takes 4 clock cycles to execute. This worked well, but only had 512 bytes of RAM which wasn't enough for handling NMEA strings and a full FAT filesystem. I switched to the PIC18F2525 since it has plenty of both codespace and RAM. It's running at 32 MHz clocked off the internal oscillator, although the current board layout has provision for an external crystal should that prove to be necessary for temperature stability.

For communication it's currently using a VHF Maxon Radio. These can be tuned from 144 to 178 MHz and are very durable - the downside is their weight (about 9oz).

Software

The source code is hosted at github here https://github.com/AD7ZJ/PICAprs

The software is written in C and built using MPLab X and the XC8 compiler. The AFSK modulator uses a resistor network and a 16 entry lookup table to produce a sin wave. There's a 1k resistor, 2k, 4k, 8k (or as close as standard values allow) which let 4 digital outputs work as a primitive sort of DAC (think powers of 2). The lookup table is designed to approximate a sin wave using the 16 possible outputs of this DAC. The sin wave's frequency can be adjusted by how quickly we step through the table. This timing is set by one of the PIC's internal timer modules, Timer2. I initially tried to use this on an interrupt routine, but it turned out the context switch time to service each interrupt was taking too long. So while a packet is being sent, nothing else is happening.

AFSK switches between 1200 Hz and 2200 Hz to represent mark and space, with a baud rate of 1200 bps. The data itself is encoded using NRZI (non-return to zero inverted), meaning zeros cause a state (as in, mark or space) change while 1's cause the state to remain the same. Bitstuffing is performed to keep 5 or more 1's from ever being sent in a row - this helps keep the receiver's clock synced up.


Currently the remaining capabilities still need to be implemented:

  1. Flash memory interface (in progress, partially complete)
  2. GPS NMEA interface
  3. RS232 Console interface