LSatan / SmartRC-CC1101-Driver-Lib

This driver library can be used for many libraries that use a simple RF ASK module, with the advantages of the cc1101 module. It offers many direct setting options as in SmartRF Studio and calculates settings such as MHz directly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Walkie Talkie, CC1101, E07-M1101D. Its possible?

RePreSaLiaS opened this issue · comments

`
#include <ELECHOUSE_CC1101_SRC_DRV.h>

// Definición de pines
#define BUTTON_PIN 4
#define LED_PIN 7
#define MIC_PIN A0
#define SPEAKER_PIN 3

// Variables globales
byte buffer[61]; // Buffer para almacenar datos recibidos

void setup() {
Serial.begin(9600);

// Inicialización de pines
pinMode(BUTTON_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(SPEAKER_PIN, OUTPUT);

// Inicialización del módulo CC1101
if (ELECHOUSE_cc1101.getCC1101()) {
Serial.println("Conexión OK");
} else {
Serial.println("Error de conexión");
}

ELECHOUSE_cc1101.Init();
ELECHOUSE_cc1101.setCCMode(1); // Configurar en modo recepción inicialmente
ELECHOUSE_cc1101.setModulation(0);
ELECHOUSE_cc1101.setMHZ(433.92);
ELECHOUSE_cc1101.setSyncMode(2);
ELECHOUSE_cc1101.setCrc(1);
ELECHOUSE_cc1101.setPA(10);
}

void loop() {
// Lectura del micrófono y mapeo de valores
int MIC = analogRead(MIC_PIN);
int Audio = map(MIC, 0, 1023, 0, 255);
int Sonido = map(Audio, 0, 255, 0, 255);

// Envío de datos cuando se presiona el botón
if (digitalRead(BUTTON_PIN) == HIGH) {
ELECHOUSE_cc1101.SendData(Audio, 20);
}

// Recepción de datos cuando el botón no está presionado
if (digitalRead(BUTTON_PIN) == LOW) {
ELECHOUSE_cc1101.ReceiveData(buffer);
analogWrite(SPEAKER_PIN, Sonido); // Control de la salida del altavoz según el sonido recibido
}
`
Could someone answer some questions for me?

1ª- Is it necessary to put the cc1101 in reception or transmission mode? Since in the basic examples of transmission and reception I do not see that in any case it is executed in one mode or another.

2ª- The code that I present is very simple, and before going crazy I must say that I am a relatively new user of Arduino, especially in RF, so I imagine that I must compress the audio signal that I have at the input to be able to send it, I understand that the Maximum buffer of the module is 60 kbps, I can't find much information about this, could anyone give some guidelines for doing this?.

3ª- Can the audio input be connected directly, or perhaps through programming, to any pin of the cc1101 module so that it emits bareback? I don't know if it can be done, it's an idea, but maybe it would simplify the transmission and reception, although I suppose this module is made to be controlled with a mcu.

Audio input: direct output from the smartphone.
Audio output: amplified with a small egg speaker.
MCU: Arduino NANO.
Pins: Arduino - CC1101.
Gnd-Gnd
3.3v-3.3v
D6-GDO0
D10-CSN
D13-SCK
D11-MOSI
D12-MISO1
D2-GDO2

This is for testing, to verify that the code works.

The project is only recreational, nothing professional, any suggestion is welcome :).

PS: Sorry if I missed something, I'm new to the forum.