Voice Transmission using Teensy+ Audio Shield+ NRF24L01

Status
Not open for further replies.

Ashymon

New member
Hi,
I wish to send audio through wireless. For this purpose I used one teensy+audio module (SGTL5000)+NRF+microphone in Transmitter side and same setup with an extra loud speaker on Receiver side. I am using RF24 library to communicate NRF24l01. When i switch on the circuit, audio transmission occurred. But noise level is very high & very hard to hear the voice from mic. I am attaching my code. Please verify and help me to over come this issue.

ASHYMON
 

Attachments

  • TRANSMITTER.c
    1.1 KB · Views: 108
  • RECEIVER.c
    1.3 KB · Views: 111
Code:
// Transmitter

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(32, 31); // CE, CSN
const byte address[6] = "00001";

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=206,128
AudioRecordQueue         queue1;         //xy=437,134
AudioConnection          patchCord1(i2s1, 0, queue1, 0);
AudioControlSGTL5000     sgtl5000_1;     //xy=394,305
// GUItool: end automatically generated code

uint8_t bufr[256];

void setup() {
  Serial.begin(9600);
  AudioMemory(64);
  // Enable the audio shield, select input, and enable output
  sgtl5000_1.enable();
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.volume(0.8);
  SPI.setMOSI(28);
  SPI.setMISO(39);
  SPI.setSCK(27);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_2MBPS);
  radio.stopListening();
  queue1.begin();
}

void loop() {
  if (queue1.available() >= 2) {
    memcpy(bufr, queue1.readBuffer(), 32);
    queue1.freeBuffer();
    radio.write(&bufr[0], 32);
  }
}
 
Code:
//Receiver

#include <Audio.h>
#include <Wire.h>
#include <SerialFlash.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(32, 31); // CE, CSN
const byte address[6] = "00001";
// GUItool: begin automatically generated code
AudioPlayQueue           queue1;         //xy=299,187
AudioOutputI2S           i2s1;           //xy=587,179
AudioConnection          patchCord1(queue1, 0, i2s1, 0);
AudioConnection          patchCord2(queue1, 0, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=393,311
// GUItool: end automatically generated code

void setup() {
  AudioMemory(64);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  SPI.setMOSI(28);
  SPI.setMISO(39);
  SPI.setSCK(27);
  radio.begin();
  Serial.begin(9600);
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.setDataRate(RF24_2MBPS);
  radio.startListening();
  
  
}

void loop() {
if (radio.available()) {
    uint8_t text[32];
    radio.read(&text, sizeof(text));
    Serial.println(text[0]);
    Serial.println(text[15]);
    Serial.println(text[31]);
    int16_t *p=queue1.getBuffer();
    memcpy(p, text, 32);
    for (int i=32; i < 256; i++) {
            *((char *)p + i) =0;  // fill rest of buffer with zero
            }
    queue1.playBuffer();
    }
}
 
Hi, there

I was trying to do something similar to what you were doing. Did you manage to fix the noise problem?

I tried using you code, changing the mic with the Line In. I'm using a Teensy 3.6, which one were you using? Also, I see you were setting pins 31 and 32. But it seems those pins represent SPI1. I read a comment saying that some libraries use SPI0 only, and that there must be made some serious changes to use SPI1 and SPI2, but I'm not so sure.
 
Hello!

Did anyone have any success with this????
I'm trying the exact same thing and getting the same result.
 
Status
Not open for further replies.
Back
Top