¿ªÔÆÌåÓý

Re: sBitx with ESP32 #esp32 #sBitx


 

Hi Ramon

This is fascinating. Since the Weaver method doesn't need an SSB filter, does this work without the 40MHz filter in the sBitx?
I note that the ESP32-LyraT board is available very cheaply - in fact?cheaper than a MIKROE codec board I bought to graft onto a Raspberry Pi.
This looks like a great route to play with yet more designs of transceiver.

Tony



On Sun, 18 Feb 2024 at 18:50, <ramonlh@...> wrote:
Hi,
SSB demodulation with an ESP32 is already working. I have changed the method followed in the sBitx to the Weawer method as described by Derek Rowell in


I have used the "Audio-Demod" output of the sBitx that I have applied to the input of an ESP32-LyraT board. The basic demodulation diagram is

It is programmed with the Espressif-IDE environment with the Espressif ESP-DSP libraries and the process is almost as simple as that used in the original sBitx.
This is the part of code that decodes the SSB at 24khz:
static void audio_modem_task3(void *pvParameters)??? ??? // Weawer method
{
?? ?xSemaphore = xSemaphoreCreateMutex();
?? ?size_t bytes_read = 0;
??? // Create cos & sin tables
?? ?float f_carrier = 24000;
?? ?float f_bfo = 1500;
?? ?float freq_carrier = f_carrier / 96000;
?? ?float freq_bfo = f_bfo / 96000;
??? dsps_tone_gen_f32(cos_carrier, N, 1, freq_carrier, 0);??? ??? // generate carrier cos
??? dsps_tone_gen_f32(sin_carrier, N, 1, freq_carrier, 90);??? ??? // generate carrier sin
??? dsps_tone_gen_f32(cos_bfo, N, 1, freq_bfo, 0);??? ??? ??? ??? // generate bfo cos
??? dsps_tone_gen_f32(sin_bfo, N, 1, freq_bfo, 90);??? ??? ??? ??? // generate bfo sin
??? while (1) {
??? // Step 0, read samples
?? ???? // 1024 4-byte samples are read, 1024 from the left channel and 1024 from the right channel
?? ???? i2s_read(I2S_NUM_0, samples, I2S_BUFFLEN, &bytes_read, portMAX_DELAY);??? // le¨ªdos 8192 bytes, 4x1024 left, 4x1024 rigth channel
?? ?// Step 1, copy samples to frf[]
?? ???? for (int i=0; i<N;i++) frf[i] = (float) samples[2*i] / 100000;? // rigth channel
?? ?// Step 2, multiply frf * cos_carrier & frf * sin_carrier
?? ???? dsps_mul_f32_ae32(frf, cos_carrier, f1, N_SAMPLES, 1,1,1);??? // multiply cos
?? ???? dsps_mul_f32_ae32(frf, sin_carrier, f2, N_SAMPLES, 1,1,1);??? // multiply sin
??? // Step 3, low pass filter 300-3000? TO DO
?? ???? float freq_t = 3000;
?? ???? float ft = freq_t/96000;
?? ???? generate_FIR_coefficients(fir_coeffs, FIR_COEFFS_LEN, ft);??? ??? ??? // Calculate 64 coefficients for the FIR filter
?? ???? dsps_fir_init_f32(&fir1, fir_coeffs, delay_line, FIR_COEFFS_LEN);??? // init fir filter
?? ???? dsps_fir_f32_ae32(&fir1, f1, f3, N_buff);? // Filter the input signal with FIR filter, f1 --> f3
?? ???? dsps_fir_f32_ae32(&fir1, f2, f4, N_buff);? // Filter the input signal with FIR filter, f2 --> f4
??? // Step 4,? multiply f3 * cos_bfo & f4 * sin_bfo
??????? dsps_mul_f32_ae32(f3, cos_bfo, f1, N_SAMPLES, 1,1,1);??? // multiply cos?? f5
?? ???? dsps_mul_f32_ae32(f4, sin_bfo, f2, N_SAMPLES, 1,1,1);??? // multiply sin?? f6
??? // Step 5,??? add f5 + f6 = f7
?? ???? dsps_add_f32_ae32(f1, f2, frf, N, 1,1,1);??? // f1=f5,?? f2=f6,?? frf=f7
??? // we copy the output in frf[] to the samples[] variable to send it to I2S
?? ???? for (int i=0;i<N;i++) samples[2*i]=10000000* frf[i];
?? ???? i2s_write(I2S_NUM_0, samples, I2S_BUFFLEN, &bytes_read, portMAX_DELAY);
?? ???? xtimes++;
?? ???? vTaskDelay(1 / portTICK_PERIOD_MS);
??? }
??? vTaskDelete(NULL);
}

I need to integrate it with the part that controls the sBitx, another ESP32 with a 2.8" screen, which is basically an adaptation of the Raduino32 software that I used with the uBitx v6.
/g/BITX20/message/90933
I don't know if it will be useful, I hope so, but it has been a good learning experience.

Saludos,
Ram¨®n EA4GZI

Join [email protected] to automatically receive all group messages.