[FSK4] Example formatting update
This commit is contained in:
parent
b46d9f8e59
commit
20b0f11ee6
1 changed files with 29 additions and 26 deletions
|
@ -1,14 +1,13 @@
|
||||||
/*
|
/*
|
||||||
RadioLib FSK4 Transmit Example
|
RadioLib FSK4 Transmit Example
|
||||||
|
|
||||||
This example sends an example FSK-4 'Horus Binary' message using SX1278's
|
This example sends an example FSK-4 'Horus Binary' message
|
||||||
FSK modem.
|
using SX1278's FSK modem.
|
||||||
|
|
||||||
This signal can be demodulated using a SSB demodulator (SDR or otherwise), and
|
This signal can be demodulated using a SSB demodulator (SDR or otherwise),
|
||||||
horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
|
and horusdemodlib: https://github.com/projecthorus/horusdemodlib/wiki
|
||||||
|
|
||||||
Other modules that can be used for FSK4:
|
Other modules that can be used for FSK4:
|
||||||
(Untested, but work with RTTY to are likely to work here too)
|
|
||||||
- SX127x/RFM9x
|
- SX127x/RFM9x
|
||||||
- RF69
|
- RF69
|
||||||
- SX1231
|
- SX1231
|
||||||
|
@ -39,22 +38,24 @@ SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
//SX1278 radio = RadioShield.ModuleA;
|
||||||
|
|
||||||
// create FAK4 client instance using the FSK module
|
// create FSK4 client instance using the FSK module
|
||||||
FSK4Client fsk4(&radio);
|
FSK4Client fsk4(&radio);
|
||||||
|
|
||||||
// A 'canned' encoded Horus Binary telemetry packet.
|
// An encoded Horus Binary telemetry packet.
|
||||||
// Refer here for packet format information:
|
// Refer here for packet format information:
|
||||||
// https://github.com/projecthorus/horusdemodlib/wiki/2---Modem-Details#horus-binary-v1-mode-4-fsk
|
// https://github.com/projecthorus/horusdemodlib/wiki/2---Modem-Details#horus-binary-v1-mode-4-fsk
|
||||||
// After demodulation, deinterleaving, and descrambling, this results in a packet: 00000001172D0000000000000000D20463010AFF2780
|
// After demodulation, deinterleaving, and descrambling, this results in a packet:
|
||||||
// This decodes to the Habitat-compatible telemetry string: $$4FSKTEST,0,01:23:45,0.00000,0.00000,1234,99,1,10,5.00*ABCD
|
// 00000001172D0000000000000000D20463010AFF2780
|
||||||
uint8_t sample_packet[] = {
|
// This decodes to the Habitat-compatible telemetry string:
|
||||||
|
// $$4FSKTEST,0,01:23:45,0.00000,0.00000,1234,99,1,10,5.00*ABCD
|
||||||
|
int horusPacketLen = 45;
|
||||||
|
byte horusPacket[] = {
|
||||||
0x45, 0x24, 0x24, 0x48, 0x2F, 0x12, 0x16, 0x08, 0x15, 0xC1,
|
0x45, 0x24, 0x24, 0x48, 0x2F, 0x12, 0x16, 0x08, 0x15, 0xC1,
|
||||||
0x49, 0xB2, 0x06, 0xFC, 0x92, 0xEB, 0x93, 0xD7, 0xEE, 0x5D,
|
0x49, 0xB2, 0x06, 0xFC, 0x92, 0xEB, 0x93, 0xD7, 0xEE, 0x5D,
|
||||||
0x35, 0xA0, 0x91, 0xDA, 0x8D, 0x5F, 0x85, 0x6B, 0x63, 0x03,
|
0x35, 0xA0, 0x91, 0xDA, 0x8D, 0x5F, 0x85, 0x6B, 0x63, 0x03,
|
||||||
0x6B, 0x60, 0xEA, 0xFE, 0x55, 0x9D, 0xF1, 0xAB, 0xE5, 0x5E,
|
0x6B, 0x60, 0xEA, 0xFE, 0x55, 0x9D, 0xF1, 0xAB, 0xE5, 0x5E,
|
||||||
0xDB, 0x7C, 0xDB, 0x21, 0x5A, 0x19
|
0xDB, 0x7C, 0xDB, 0x21, 0x5A, 0x19
|
||||||
};
|
};
|
||||||
uint8_t sample_packet_len = 45;
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
@ -88,7 +89,7 @@ void setup() {
|
||||||
// SX128x - 198 Hz
|
// SX128x - 198 Hz
|
||||||
Serial.print(F("[FSK4] Initializing ... "));
|
Serial.print(F("[FSK4] Initializing ... "));
|
||||||
// low ("space") frequency: 434.0 MHz
|
// low ("space") frequency: 434.0 MHz
|
||||||
// frequency shift: 270 Hz (actually results in a shift of 244 Hz)
|
// frequency shift: 270 Hz
|
||||||
// baud rate: 100 baud
|
// baud rate: 100 baud
|
||||||
state = fsk4.begin(434.0, 270, 100);
|
state = fsk4.begin(434.0, 270, 100);
|
||||||
if(state == ERR_NONE) {
|
if(state == ERR_NONE) {
|
||||||
|
@ -98,7 +99,6 @@ void setup() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
@ -108,15 +108,18 @@ void loop() {
|
||||||
fsk4.idle();
|
fsk4.idle();
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
// FSK4Client supports the write(uint8_t b) and write(uint8_t* buff, size_t len) method.
|
// FSK4Client supports binary write methods
|
||||||
// We use the write(uint8_t b) method to send a few bytes of preamble to allow the demodulator
|
|
||||||
// to lock on to the signal.
|
|
||||||
fsk4.write(0x1B); fsk4.write(0x1B); fsk4.write(0x1B); fsk4.write(0x1B);
|
|
||||||
fsk4.write(0x1B); fsk4.write(0x1B); fsk4.write(0x1B); fsk4.write(0x1B);
|
|
||||||
|
|
||||||
// We then send the encoded packet.
|
// send some bytes as a preamble
|
||||||
fsk4.write(sample_packet, sample_packet_len);
|
for(int i = 0; i < 8; i++) {
|
||||||
|
fsk4.write(0x1B);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now send the encoded packet
|
||||||
|
fsk4.write(horusPacket, horusPacketLen);
|
||||||
|
|
||||||
Serial.println(F("done!"));
|
Serial.println(F("done!"));
|
||||||
|
|
||||||
|
// wait for a second before transmitting again
|
||||||
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue