Home

Awesome

esp32-microgamepad-ble

Dual analog joystick on ESP32 over BLE (Nordic UART Service - NUS) using micropython

The purpose of this project is to create a dual-joystick analog gamepad that will be transmitting over BLE the values using an ESP32 device. It is an ideal controller for robot projects. Joystick 1 is used for steering and Joystick 2 is used for controlling camera movement.

Components

img

Wiring

Allthough the analog joysticks label the input as 5V, they perfectly work with 3.3V which will be used in our schematic. Also J1, J2 will be abreviations for Joystick 1 and Joystick 2.

To enable the digital input of the button click when the joystick is pressed, a resistor of 10kΩ is connected to the 3.3V of the ESP32 one the one hand, and to the respective GPIO where the SW pins of the joystics are connected (GPIO25, GPIO26)

Component PINESP PIN
J1 5V3.3V
J2 5V3.3V
Resistor 13.3V
Resistor 23.3V
J2 GNDGND
J1 GNDGND
J1 VRxGPIO34
J1 VRyGPIO35
J1 SWGPIO25
J2 VRxGPIO32
J2 VRyGPIO33
J2 SWGPIO26
Resistor 1GPIO25
Resistor 2GPIO26

complete schematic

On Raspberri Pi

An interesting alternative on how to read the analog values of the Joysticks is the use of a Raspberry Pi with an MCP3008 analog-to-digital converter.

link: https://tutorials-raspberrypi.com/raspberry-pi-joystick-with-mcp3008/

references