Cc1101 direct transmision

I have been thinking about the elechouse library for a long time, is there an alternative to this? Because my intention is to send and receive audio directly, I don't care about the quality, but I don't want it to be stored in the arduino, I want the signal that is entered into the arduino, that it is emitted directly by the cc1101 and from another arduino that it is captured, also directly, that it is reproduced in the arduino, the question is in the sending and receiving of that data, is there a way to do it directly?

Does anyone have any idea if there is an alternative that has other types of options, or is simply different from elechouse?

Do what directly? Please state exactly what you are trying to do, with what devices.

The computer does things sequentially. To receive and send data by a single radio transceiver requires first that a data packet be received, stored somewhere, then the data packet can be sent.

To quickly understand what I want to do, it is a walkie talkie, the problem is that I have played a lot with that library and I can't get anything with it, I wanted to know if an audio signal captured by an analog input can be transmitted, I have tried using an arduino as an intermediary capturing and reproducing sounds and it is quite faithful, but I can't send them unless it is in packet mode, and I don't want to put external storage on the Arduino, or even store anything apart from the code.

MCU - Arduino NANO
Dispositive RF - E07-M1101D

That is how all modern digital radios work, and all digital audio transmission, by any means.

To transmit continuous audio data, you have to transmit packets at a data rate faster than the underlying audio data rate, and reassemble the audio at the receiving end.

The audio captured by the analog input is an integer with a value from 0 to 1023. If you capture that analog value fast enough, and long enough, a digital to analog chip can convert those values to a voltage, one integer at a time. The voltage could be amplified and create a sound that may or may not be similar to the original "sound".

The problem is that the Arduino nano memory is ridiculous, it is not possible to store even a second, would the conclusion be that it is not possible to transmit data with that module without external storage? What I do not understand very well is why RF24 is capable of doing it and there is even a library dedicated to that use, if someone can clarify why I would be grateful.

Collect for less than a second, and send the packet.

I have been thinking about the elechouse library for a long time

It would be a good idea broaden your studies.

Collect for less than a second, and send the packet.

I tried increasing and decreasing the send time even doing buffer debugging after that, but I got nothing but switching noise.

Very likely, you made one or more mistakes in the code. This is not a simple project.

For continuous transmission of audio, it is absolutely essential to use double buffering, so that one audio sample buffer can be filled while the other is being transmitted. The time to transmit one buffer has to be less than the time it takes to fill the other buffer with audio.

Sampling frequency might be another issue. Without timing info embedded in the transmitted data, the RX side has no way to exactly synchronize to the sampling rate of TX side. Perhaps for low-quality audio it doesn't matter.

Tomorrow I will look for a version of the program I made and I will try again, today is too late for me, anyway the double buffer thing makes sense, I had not thought about it, if you know any example it would help me, anyway tomorrow I will I'll try my luck again, thanks.

Usually not, except for audio quality. Sender and receiver code assume some common sample rate, typically 8, 16 or 44.1 ksps.

As long as each sample buffer can be transmitted and received more rapidly than the other buffer is filled, there are no discontinuities, and audio output can proceed at the same rate audio input was sampled. The only consequence is the introduced, constant lag between time of sample and time of audio output of that sample.

This article describes the pops, clicks and delays that can result if buffer size is not set correctly (for DAW, digital audio workstations):

Fastest Data Logging? With SD Card? - Projects Discussion and Showcase / Science and Measurement - Arduino Forum

In that thread I found some information, although perhaps I came out more confused than I entered, I'll leave it in case someone looking for information needs it to save time.

I'm a little lost on how to do this project, it's just like a hobby, but I would like to finish it, unfortunately I don't have much idea about RF modules, and specifically in audio applications of this module I can't find anything related at all.

If you want to learn about double buffering, there are plenty of resources. The Sparkfun OpenLog data logger uses it effectively, and Adafruit's PDM microphone library for their NRF52840 boards has pretty good code.

Since the double buffering code is buried in the core files for those chips, it is hard to find, so I've extracted and attached it as a zip file.

This is an example of collecting data from the microphone and writing it to a file on flash disk. The double buffering is behind the scenes.

I found that the flash writing speed is slow and led to dropped audio samples, and the fix required a much larger data buffer.

//working 4/6/2024
// upped gain to 42 (default was 20, too quiet)
/*
  This example reads audio data from the on-board PDM microphone
  and saves to a QSPI flash file audio.dat
  // 2Mb flash = 2097152 bytes, 4096 512 byte blocks
*/

#include <Adafruit_Arcada.h>

Adafruit_Arcada arcada;
#include <PDM.h>

// buffer for audio samples, each sample is 16-bits
// setting a larger buffer avoids dropping audio samples
// writes to flash are slow!

int16_t sampleBuffer[1024];

// number of samples read
volatile int samplesRead;

File file;

void setup() {
  Serial.begin(115200);
  while (!Serial) yield();

  // configure the data receive callback
  PDM.onReceive(onPDMdata);


  if (!arcada.arcadaBegin()) {
    while (1);
  }
  //Arcada_FilesystemType
  arcada.filesysBegin(ARCADA_FILESYS_QSPI);

  file = arcada.open("/audio.dat", O_CREAT | O_WRITE);
  if (!file) {
    Serial.println("\r output file open failure");
    while (1) yield();
  }
  PDM.setBufferSize(2048);  //bytes!
  // initialize PDM with:
  // - one channel (mono mode)
  // - a 16 kHz sample rate
  if (!PDM.begin(1, 16000)) {
    Serial.println("Failed to start PDM!");
    while (1) yield();
  }
  // optionally set the gain, defaults to 20
  PDM.setGain(42);
  Serial.println("recording");
}
int nframes = 250;

void loop() {
  // wait for samples to be read
  if (samplesRead) {
    file.write((char *)sampleBuffer, 2048);
    //    Serial.println(nframes);
    nframes--;
    if (nframes == 0) {
      file.close();
      Serial.println("stopped");
      arcada.filesysListFiles();
      Serial.flush();
      while (1) yield();
    }
    samplesRead = 0;
  }
}

void onPDMdata() { //callback
  // query the number of bytes available
  int bytesAvailable = PDM.available();
   // read into the sample buffer
  PDM.read(sampleBuffer, bytesAvailable);

  // 16-bit, 2 bytes per sample
  samplesRead = bytesAvailable / 2;
}

PDM.zip (5.2 KB)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.