Raspberry Pi Pico Contest - Share Project to Get a New One for Free Call for pcb design tutorials - Learn the basics of PCBs and the information needed to get started designing your first PCB
VOTE NOW!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Design 1/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Usability 2/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Creativity 3/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Content 4/4

This is a DIY handheld gamepad, made using ESP32 microcontroller. You might have seen such game controllers before. But most of them use Arduino. Or more specifically Arduino pro micro or Leonardo board. Because these boards support HID, or human interface devices over USB. but esp32 doesn't have such feature. So how do we do it? Well, esp32 does have BLE, or Bluetooth low energy, which we can use to communicate wirelessly, over Bluetooth.




DETAILS

So we have ESP32 module, as the central controller, then we have the USB type-C port, and a 3.3v regulator to convert 5v to 3.3v. Then we have the programming circuit, using ch340c usb to serial converter with auto programming mode and auto reset circuitry using duel transistors. We also have a battery charging circuit, along with overcharge, and over discharge protection. Which then boost up to 5v, using the boost converter ic. Next we have the joysticks, D-Pad buttons, trigger buttons, Neopixel LEDs, i2c port. And finally a 3way switch, to toggle between USB power and battery power.

The gamepad has

  • 2 analog joysticks
  • 2 trigger buttons
  • 2 D-Pads
  • 6 addressable RGB LEDs
  • and a i2c port

It can run using 2 18650 Li ion cells, which can be changed using the USB type-C port. And it can also be used to program the microcontroller. The design is inspired by the new ps5 controller, to give it a better look. The GPIO4 is connected to the battery using a voltage divider. So that we can measure the battery voltage. the NeoPixel LEDs will indicates if the controller is connected to a device or battery voltage is low.

The code is based on BLE Gamepad library by lemmingDev. In the code I have defined all the GPIO pins for different inputs. Then in the setup there are some initial led animations. And as soon as the board is connected to the device, all LEDs will turn Green. And it will check battery voltage, in a time interval, which is defined earlier. Then we get the button states, and set the gamepad buttons accordingly. Then we take the analog inputs, and map it to suitable values. And finally set the axis according to the values we received. After uploading the code open Bluetooth menu on your Smartphone or PC and you will see a new device pops up. click on that to connect it and you are ready to play.

Jan 04,2021
750 viewsReport item
  • Comments(2)
  • Likes(4)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More
    VOTING 3 votes
    • Konstantin Klez from GERMANY
      • 10
        design
      • 10
        usability
      • 10
        creativity
      • 10
        content
      10.00
    • Jan Hartman from SLOVENIA
      • 10
        design
      • 10
        usability
      • 10
        creativity
      • 10
        content
      10.00
    • Bhushan Rane from INDIA
      • 10
        design
      • 10
        usability
      • 10
        creativity
      • 10
        content
      10.00