Required Libraries for This Project
To make the wireless remote launcher work, you’ll need the following libraries in Arduino IDE:
SPI (built-in)
RF24 by TMRh20
– includes bothnRF24L01.h
andRF24.h
You can install RF24 using the Library Manager in Arduino IDE.
Code:
- Transmitter
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = „00001“;
// Buttons
const int button1 = 2; // Launch
const int button2 = 3; // Buzzer
const int button3 = 4; // LED
void setup() {
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT_PULLUP);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_HIGH);
radio.stopListening(); // Set as transmitter
}
void loop() {
// Note: Logic is inverted due to INPUT_PULLUP
int startSignal = digitalRead(button1) == LOW ? 1 : 0;
int buzzerSignal = digitalRead(button2) == LOW ? 1 : 0;
int ledSignal = digitalRead(button3) == LOW ? 1 : 0;
int data[] = {startSignal, buzzerSignal, ledSignal};
radio.write(&data, sizeof(data));
delay(100);
}
- Receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = „00001“;
// Output pins
int led1 = 2; // LED indicator 1
int led2 = 3; // LED indicator 2
int buzzer = 4; // Buzzer
int relay1 = 5; // Relay for launch
int relay2 = 6; // Spare relay (not used)
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_HIGH);
radio.startListening(); // Set as receiver
}
void loop() {
if (radio.available()) {
int data[3];
radio.read(&data, sizeof(data));
// Data from controller
int startSignal = data[0];
int buzzerSignal = data[1];
int ledSignal = data[2];
// Control LEDs
if (ledSignal) {
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
} else {
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
}
// Control buzzer
if (buzzerSignal) {
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(buzzer, LOW);
}
// Control launch relay
if (startSignal) {
digitalWrite(relay1, HIGH);
delay(5000); // Keep relay on for 5 seconds
digitalWrite(relay1, LOW);
}
}
}
Conections:
📡 Transmitter – Arduino Nano
🔌 nRF24L01+ Module:
nRF24L01+ Pin | Arduino Nano Pin |
---|---|
VCC | 3.3V |
GND | GND |
CE | D9 |
CSN (CS) | D10 |
SCK | D13 |
MOSI | D11 |
MISO | D12 |
⚠️ Only supply 3.3V (never 5V), otherwise the module will burn out!
🔘 Buttons:
Tlačítko | Arduino Pin |
---|---|
LED (Button 1) | D2 |
LED (Button 3) | D4 |
Connect each button between a pin (e.g. D2) and GND. Use INPUT_PULLUP in the code and invert the logic, or add a pull-down resistor.
🚀 Receiver – Arduino Nano
🔌 nRF24L01+ Module:
nRF24L01+ Pin | Arduino Nano Pin |
---|---|
VCC | 3.3V |
GND | GND |
CE | D9 |
CSN (CS) | D10 |
SCK | D13 |
MOSI | D11 |
MISO | D12 |
💡 LED:
LED | Arduino Pin |
---|---|
LED | D2 |
🔊 Buzzer:
Buzzer | Arduino Pin |
---|---|
+ | D4 |
– | GND |