RF24Audio  v1.0.03e8c09
Arduino Audio Streaming Realtime with NRF24L01 radios
RF24Audio - Realtime Audio Streaming Library for Arduino

This class implements a realtime audio streaming solution using nRF24L01(+) radios driven by the newly optimized RF24 library fork.

Features

  • User friendly setup and configuration: For beginners too: Just connect a radio module, microphone, and speaker. The library handles the rest.
  • Recording and broadcasting of audio to multiple devices using only Arduino, RF24 modules and input/output (speaker/microphone) devices
  • Multicast: Enables broadcasting to all nodes, single nodes, or partial groups of nodes
  • External controls: Use external buttons or code to control audio streaming
  • Volume control: Use external buttons or code to control audio volume on receiving devices.
  • Remote control: Start recording remotely via radio commands (Currently cannot stop remote recording)
  • LED Indicator/Visualization: Indicates audio playback and amplitude.
  • Customization: Using the underlying RF24 core library allows custom interaction with audio devices running this library. Receive audio data and stream it to a PC over USB, create and broadcast computer generated audio in realtime, and more! See the USB_Audio example for more info.
  • Create additional node groups: Allows nodes to join private broadcast groups, and multicast only within their group as desired. See advanced section below.

How to learn more

Configuration and Setup

The settings for the library will generally be detected automatically. To change from the default pin assignments etc, edit the userConfig.h file. The mandatory user options in the configuration file are shown below:

#define SAMPLE_RATE 24000 // The sample rate to use for transferring audio samples Note: 44khz+ sample rate requires 8-bits per sample
#define RF_SPEED RF24_1MBPS // RF24_250KBPS will do 13-20khz+ sample rate, RF24_1MBPS up to 24-44khz+, RF24_2MBPS for higher. These are not limits, just a guide.
#define ANALOG_PIN A0 // The pin that analog readings will be taken from (microphone pin)

Pin Assignments

See also
the Setup page for wiring diagrams
  • Speakers: Arduino Uno,Nano,etc: pins 9, 10 Arduino Mega: 11, 12 (Timer pins cannot be changed, but can use 1 pin and ground)
  • pin A0: Microphone/Input pin
  • pin A1: Transmission/Recording Start pin
  • pin A2: Volume Up
  • pin A3: Volume Down
  • pin A4: Trigger remote recording (Only working with dual devices)
  • Cannot be changed: LED Pin: Uno,Nano,etc: pin 6 Mega 2560: pin 13 (main LED pin)

See http://arduino.cc/en/Tutorial/InputPullupSerial for info on how to wire the buttons to the pins See userConfig.h to change default pin assignments and options.

Advanced Usage

The radio pipes are defined as follows. For more complex multicast scenarios, radios can listen on any combination of pipes.
Use the getAddress(); function to access the address array.

const uint64_t pipes[14] = {0xABCDABCD71LL,
0x544d52687CLL,
0x544d526832LL,
0x544d52683CLL,
0x544d526846LL,
0x544d526850LL,
0x544d52685ALL,
0x544d526820LL,
0x544d52686ELL,
0x544d52684BLL,
0x544d526841LL,
0x544d526855LL,
0x544d52685FLL,
0x544d526869LL};
const uint64_t pipes[14]
Radio pipe addresses for the 2 nodes to communicate.
Definition: userConfig.h:113

By default, all radios will open the same reading & writing pipes on the first two addresses.
Any radio that wishes to transmit, will reverse the addresses on the first two pipes, and begin to transmit to all the other nodes.
Every radio will automatically be assigned the first two addresses, then one of the remaining addresses as a private channel, based on its radio number:
(0 = pipes[2], 1 = pipes[3])

Additional addresses can be added by modifying the address array listed in userConfig.h