Skip to content

nihaltp/espnow-joystick-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Joystick Controller Using ESP-NOW

Table of Contents

  1. Description
  2. Features
  3. Hardware Requirements
  4. Software Requirements
  5. Configuration
  6. Setup
  7. Usage
  8. Circuit Diagram
  9. Troubleshooting

Description

This project implements a joystick controller using ESP-NOW, a protocol developed by Espressif for low-power, peer-to-peer communication between ESP32 devices. The joystick can be used to control various devices wirelessly, making it ideal for remote control applications.

Features

  • Wireless Communication: Utilizes ESP-NOW for low-latency communication between ESP32 devices.
  • Easy Setup: Simple installation and configuration process for quick deployment.
  • Low Power Consumption: Designed for low-power operations, suitable for battery-powered applications.
  • Versatile Applications: Can be used for various remote control applications such as drones and robots.

Hardware Requirements

  • 2 x ESP32 boards
  • 1 or 2 Joystick modules (You may use one joystick for both axes or split X and Y axes across two separate joystick modules)
  • 2 x DC motors (for the receiver/car)
  • Motor Driver (L298N or BTS)
  • Jumper wires
  • Power supply for the motors

Software Requirements

Configuration

  1. In transmitter.ino, replace the receiverMAC array with the MAC address of your receiver ESP32.
  2. Adjust the SERIAL_PORT boolean in both files if you want to enable/disable serial debugging.
  3. In receiver.ino, adjust the following parameters to suit your application:
    • const int DEAD_ZONE = 10; // Set the dead zone to avoid unnecessary movements when the joystick is close to the center.
    • const int numSamples = 100; // Set the number of samples to average for finding the center position of the joystick.

Setup

  1. Install the required libraries in your Arduino IDE.
  2. Upload the transmitter.ino code to one ESP32 board (the controller).
  3. Upload the receiver.ino code to another ESP32 board (the robot).
  4. Connect the joystick module to the transmitter board according to the pin definitions in the code.
  5. Connect the motors and motor driver to the receiver board as per the pin definitions.

Usage

  1. Power on both ESP32 boards.
  2. Observe the wireless communication in action as you move the joystick.

Circuit Diagram

Example Transmitter Circuit

Troubleshooting

  • Issue: Devices do not communicate.

    • Solution: Ensure both ESP32 boards are powered and within range. Check the code for correct MAC address and ESP-NOW peer setup.
  • Issue: Joystick is not responding.

    • Solution: Verify the connections between the joystick module and the ESP32. Check for any loose wires.
  • Issue: Compilation errors in Arduino IDE.

    • Solution: Ensure you have installed the ESP32 board support and the required libraries.
  • Issue: Joystick movements are erratic or unresponsive near the center position.

    • Solution: Adjust the DEAD_ZONE value in receiver.ino. A larger dead zone can help eliminate noise and prevent unintended movements. Experiment with different values until you find one that works well for your joystick.

TODO

  • Implement fail-safe stop on disconnect

Credits

Created by NIHAL T P
GitHub: nihaltp

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages