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

Arduino Nano and NRF24L01 Wireless Joystick and Potentiometer Controller

View and Edit Project In Cirkit DesignerImage of Arduino Nano and NRF24L01 Wireless Joystick and Potentiometer Controller

Circuit Documentation

Summary

This circuit involves an Arduino Nano microcontroller interfaced with an NRF24L01 wireless transceiver module, a KY-023 Dual Axis Joystick Module, a Rotary Potentiometer, and an Electrolytic Capacitor. The Arduino Nano reads analog values from the joystick and potentiometer, processes these values, and transmits them wirelessly using the NRF24L01 module.

Component List

Arduino Nano

NRF24L01

Electrolytic Capacitor

KY-023 Dual Axis Joystick Module

Rotary Potentiometer

Wiring Details

Arduino Nano

NRF24L01

Electrolytic Capacitor

KY-023 Dual Axis Joystick Module

Rotary Potentiometer

Code Documentation

Arduino Nano Code

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

RF24 radio(9,10);

const byte address[6] = "54321";

int xPin = A2;
int yPin = A3;
int potPin = A0;
int xVal;
int yVal;
int potVal;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
  pinMode(potPin, INPUT);
  radio.begin();
  radio.openWritingPipe(address);
  radio.stopListening();
  radio.setDataRate(RF24_2MBPS); // Set the speed of the transmission to the quickest available
  radio.setChannel(124); // Use a channel unlikely to be used by Wifi, Microwave ovens etc
  radio.setPALevel(RF24_PA_MAX); // Set radio Tx power to MAX   
}

void loop() {
  // put your main code here, to run repeatedly:
  xVal = analogRead(xPin);
  yVal = analogRead(yPin);
  potVal = analogRead(potPin);
  int servoAngle1 = map(xVal, 0, 1023, 0, 180);
  int servoAngle2 = map(yVal, 0, 1023, 0, 180);
  int motorSpeed = map(potVal, 0, 1023, 0, 255);
  radio.write(&servoAngle1, sizeof(servoAngle1));
  radio.write(&servoAngle2, sizeof(servoAngle2));
  radio.write(&motorSpeed, sizeof(motorSpeed));
  Serial.print("Servo1: "); 
  Serial.print(servoAngle1);
  Serial.print(" | Servo2: ");
  Serial.print(servoAngle2);
  Serial.print(" | MotorSpeed: ");
  Serial.println(motorSpeed);
  delay(100);
}

This code initializes the Arduino Nano to read analog values from the joystick and potentiometer, maps these values to appropriate ranges for servo angles and motor speed, and transmits the data wirelessly using the NRF24L01 module. The values are also printed to the serial monitor for debugging purposes.