Arduino Beacon
Total Page:16
File Type:pdf, Size:1020Kb
BEACON? Antony M0IFA Beacon Synth • AD9850 - a sine wave output synthesiser • Programmable in • Hertz + centi-Hertz 7080000.00 + 100 = 7080001.00Hz • Varicode to store symbols • Can do CW, PSK31, RTTY, AD9850 module WSPR… HELL… New ADS9850 library #define ADS_XTAL 125000000.0 class ADS9850 { public: ADS9850(); void begin(int W_CLK, int FQ_UD, int DATA, int RESET); void setFreq(double Hz, double Chz, uint8_t phase); void calibrate(double calHz); void down(); private: int _W_CLK; int _FQ_UD; int _DATA; int _RESET; double _calFreq; void update(uint32_t d, uint8_t p); void pulse(int _pin); }; Example #include "ADS9850.h" // pins #define W_CLK 8 #define FQ_UD 9 #define DATA 10 #define RESET 11 // create ads object ADS9850 ads; void setup() { ads.begin(W_CLK, FQ_UD, DATA, RESET); // set up pins ads.calibrate(124999000.0); // calibrated XTAL freq ads.setFreq(7100000.0, 146); // on & output 7100001.46 Hz delay(30000); // 30sec ads.down(); // off } void loop() { } VARICODE Let’s look at each symbol system ASCII & Morse 0… • Morse is subset of ASCII (0-127) • ASCII code is a 7bits, in decimal numbers morse is 32 = SPACE to 90 = Z • Some do not have Morse symbol e.g. # $ % & …127 Morse varicode Varicode Examples no. Char ASCII index VC bin morse bits 0 48 16 248 11111000 5 - - - - - 1 49 17 120 01111000 5 . - - - - … M 77 45 192 11000000 2 - - ‘M’ Index = 77 - 32 (SPACE) = 45 Array counts 0 to 58 ASCII & PSK31 Part of PSK31 symbols All ASCII codes (0 - 127) PSK31 Uses symbols which all start with ‘1’, & end with ‘1’, Never has ’00’ in symbol, ’00’ is character space 1 is continuous output, 0 is 180deg phase change Baud rate 31.5, or pulse timing 32ms Pulses should be cosine shaped - to reduce ‘clicks’ PSK31 varicode Varicode Examples no. Char ASCII index VC bin bits A 65 65 125 1111101 7 B 66 66 235 11101011 8 … Y 89 89 379 101111011 9 PSK31 has all 0-127 ASCII, Index = ASCII code Baudot code RTTY bits bits RTTY uses the 5bit BAUDOT code = 32 characters, so Letters Shift and Figures Shift add 1 START bit ‘0’ add 2 STOP bits ‘11’ Signals D = 0 1 0 0 1 0 1 1 RTTY varicode 1st 33 (0-32) are FIGS, then (33-58) LTRS FIGS LTRS A in Baudot = 00011 b4-b0 Varicode is stored b0-b4 24 decimal = 11000 binary RTTY coding bits bits Message is in ASCII code 32 to 90 (SP to Z) Index into RTTY varicode = ch - 32 (0 - 58) if Index < 33 then send FIGS, else send LTRS look up Baudot varicode byte b7-b0 Varicode stores Baudot backward = 000b0 - b4 e.g. D 01001 (b4-b0) is 000b0-b4 = 00010010 shift left << 2 to give 01001000 add 3, or b00000011 to give TX byte 01001011 = start bit 0, ‘D’ and two stop bits 11 send b7 to b0 as “D” in signal Coding This bit is for nerds Morse Code 1 2 3 4 PSK31 Code 1 2 3 4 RTTY Code 1 2 3 Switch LTRS or FIGS 4 Varicode table 5 rttyTxByte // send at fHzVcode, fChzVcode, vCode 000nnnnn void rttyTxByte(long fHzVcode, long fChzVcode, char vCode) { int bits, val; // build the byte to send vCode = (vCode << 2) + 3; // shift two left, add B00000011, makes 0nnnnn11 for (bits = 7; bits >= 0; bits--) { // MSB first, b7 -> b0, sends Baudot b0 -> b4 val = bitRead(symb, bits); // Read bit ads.setFreq(fHzvCode + (170 * val), fChzvCode, 0); // Let's transmit (bit 1 is 170Hz shifted up) delay(22); // Gives the baud rate, 22ms per bit } delay(110); // intersumbol pause } Send Send on freq or freq+170Hz b7 - b0 Demo TX -> RX PC & AD9850 SDR & MacBook .