Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wireless Audio Communication System with Arduino and NRF24L01

View and Edit Project In Cirkit DesignerImage of Wireless Audio Communication System with Arduino and NRF24L01

Circuit Documentation

Summary

This circuit consists of two main subsystems, each built around an Arduino Nano microcontroller. The subsystems are designed to communicate with each other wirelessly using NRF24L01 transceiver modules. Each subsystem also includes a KY-037 Microphone module for audio input and a Loudspeaker for audio output. The microphones capture audio signals, which are then transmitted wirelessly between the two Arduinos, and the received signals are played out through the loudspeakers. The circuit is powered by two separate 5V batteries.

Component List

Microcontrollers

Communication Modules

Sensors

Output Devices

Power Sources

Wiring Details

Arduino Nano

NRF24L01

KY-037 Microphone

Loudspeaker

5V Battery

Documented Code

Arduino Nano Code (for both microcontrollers)

#include <SPI.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN pins

const int micPin = A0; // Microphone pin
const int speakerPin = 3; // Speaker pin

void setup() {
  pinMode(speakerPin, OUTPUT);
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.openReadingPipe(1, 0xF0F0F0F0E2LL);
  radio.setChannel(1);
  radio.setPALevel(RF24_PA_HIGH);
  radio.startListening();
}

void loop() {
  // Send data if listening
  if (radio.available()) {
    // Receiving data
    byte receivedValue;
    radio.read(&receivedValue, sizeof(receivedValue));
    // Output sound to speaker
    tone(speakerPin, receivedValue); // Using received value as frequency
  } else {
    // Read microphone input
    int micValue = analogRead(micPin);
    // Send microphone value
    radio.write(&micValue, sizeof(micValue));
    delay(100); // Adjust as necessary
  }
}

This code is designed to run on both Arduino Nano microcontrollers in the circuit. It initializes the RF24 library for wireless communication, sets up the microphone and speaker pins, and enters a loop where it either sends microphone data or receives data to play on the speaker. The tone() function is used to generate a sound on the speaker based on the received value.