Wired PS2 Controller to Wireless mod using ESP32

My notes for converting a Wired PS2 Controller to Wireless using ESP32 + PS2X lib

https://www.raphnet.net/electronique/psx_adaptor/Playstation.txt
https://docs.espressif.com/projects/esp-idf/en/v4.2.3/esp32/api-reference/peripherals/spi_master.html#overview-of-esp32-s-spi-peripherals
https://www.whizzbizz.com/en/ps2.controller
https://github.com/MyArduinoLib/Arduino-PS2X-ESP32/blob/master/examples/PS2X_Example_ESP32/PS2X_Example_ESP32.ino

        SPI2        SPI3

Pin name GPIO #
CS0* 15 5
SCLK 14 18
MISO 12 19
MOSI 13 23
QUADWP 2 22
QUADHD 4 21

PS2 Controller Pinout (Facing)

1 2 3 4 5 6 7 8 9
Data CMD Vibr Gnd VCC Attn CLK NC Ack

VCC: 3.3V – 5V
Vibr: 7.6V – 9V

PS2X pinout

  • define PS2_DAT 19
  • define PS2_CMD 23
  • define PS2_SEL 5
  • define PS2_CLK 18

PS2 Controller <–> Adapter header <–> Black project box

Black project box –> ESP32
–> Battery (4 x 18650 @ 14.8)
–> 5V LDO 3.3V regulator LD1117V33
–> 1 x 0.1 uF ceramic cap
–> 9V regulator L7809A / L7809CV
–> 1 x 0.1 uF ceramic cap
–> Antenna?
–> Switch
–> LED (Green?)
–> LED (Red when V is less than 7.2V)

18650 & Lipo

3.7V * 1 = 3.7V
3.7V * 2 = 7.4V
3.7V * 3 = 11.1V
3.7V * 4 = 14.8V

Setting up Ubuntu 20.04 (cli only)

  1. Remove command suggestions
  2. Remove bash completion
  3. Save screen layout
  4. Change directory listing colour to cyan
  5. Set console to 1152×682
  1. Remove command suggestions
    sudo apt remove command-not-found
  1. Remove bash completion
    sudo apt remove bash-completion
  1. GNU Screen
    a. Save screen layout
    While in screen Ctrl+A : layout dump .screenrc

b. Remove startup message
Add “startup_message off” to top of the .screenrc file

  1. Change directory listing colour to cyan
    Create a file called .dircolors and insert “DIR 01;36” without the quotes
  1. Set console to 1152×864
    a. Determine available resolutions
    sudo hwinfo –framebuffer
    Returns a list of console resolutions

b. Insert the selected resolution into bottom of /etc/default/grub
Add “GRUB_GFXMODE=1152×864” to bottom of the file

c. Run update-grub2
sudo update-grub2