Skip to content

Commit

Permalink
DRAFT LORA
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Jan 8, 2025
1 parent f3aeb43 commit 50b7a1e
Show file tree
Hide file tree
Showing 9 changed files with 868 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file example-serial-receive.ino
* @file example-espnow-receive.ino
* @author Phil Schatzmann
* @brief Receiving audio via ESPNow
* @version 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file example-serial-receive_csv.ino
* @file example-espnow-receive_csv.ino
* @author Phil Schatzmann
* @brief Receiving audio via ESPNow
* @version 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file example-serial-receive_measure.ino
* @file example-espnow-receive_measure.ino
* @author Phil Schatzmann
* @brief Receiving audio via ESPNow with max speed to measure thruput
* @version 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file example-serial-send.ino
* @file example-espnow-send.ino
* @author Phil Schatzmann
* @brief Sending audio over ESPNow
* @version 0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file example-lora-receive_measure.ino
* @author Phil Schatzmann
* @brief Receiving audio via LoRa with max speed to measure thruput.
* @version 0.1
* @date 2023-11-09
*
* @copyright Copyright (c) 2022
*
*/

#include "AudioTools.h"
#include "AudioTools/Communication/LoRaStream.h"

LoRaStream lora;
MeasuringStream out; // or CSVStream<uint8_t>
StreamCopy copier(out, lora);

void setup() {
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
while(!Serial);

auto cfg = lora.defaultConfig();
lora.begin(cfg);

// start output
Serial.println("starting Out...");
out.begin();

Serial.println("Receiver started...");
}

void loop() {
copier.copy();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @file example-lora-send.ino
* @author Phil Schatzmann
* @brief Sending data over LoRa. We use a Heltec WiFi LoRa V3 board for testing.
* V3 boards use the SX1262.
* @version 0.1
* @date 2023-11-09
*
* @copyright Copyright (c) 2022
*/

#include "AudioTools.h"
#include "AudioTools/Communication/LoRaStream.h"

AudioInfo info(8000, 1, 16);
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
LoRaStream lora;
StreamCopy copier(lora, sound); // copies sound into i2s

void setup() {
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
while(!Serial);
Serial.println("starting...");

// Setup LoRa
Serial.printf("SCK: %d, MISO: %d, MOSI: %d, SS=%d", SCK,MISO,MOSI,SS);
SPI.begin(SCK, MISO, MOSI, SS);
auto cfg = lora.defaultConfig();
cfg.copyFrom(info);
if (!lora.begin(cfg)){
Serial.println("LoRa failed");
stop();
}

// Setup sine wave
sineWave.begin(info, N_B4);

Serial.println("Sender started...");
}

void loop() {
copier.copy();
}
1 change: 0 additions & 1 deletion src/AudioTools/Communication/RadioHeadStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace audio_tools {


/**
* @brief Arduino Stream which is using the RadioHead library to send and
* receive data. We use the river API directly.
Expand Down
Loading

0 comments on commit 50b7a1e

Please sign in to comment.