instructables
ESP32 Handheld Game Console
by
This instructables show how to use a ESP32 and ATtiny861 to build a NES emulator game console.
https://youtu.be/VabwqIvGB6I
Step 1: Hardware Preparation
ESP32 Handheld Game Console: Page 1
ES P 3 2 D e v B o a r d
This time I am using a TTGO T8 ESP32 dev board. This
board have built-in Lipo charging and regulating P i n He a d e r
circuit, it can help reduce the extra components. A 4 pins male round pin header and a 4 pins female
round pin header for connecting I2C gamepad.
Dis play
This time I am using a 2.4" IPS LCD. The driver P ET G P l a t e
controller is ST7789V and the resolution is 320 x 240. A small PET/PETG plate for supporting the dev board
This resolution is best t for NES emulator 252 x 224 and Lipo battery, you can easily nd it in product
resolution. packing.
Bat t ery Mul t i p l e P ur p o s e P C B
This time I am using a 454261 Lipo battery. 4.5 mm is 2 PCB required, 1 0.4 mm thick for supporting the
the thickness of ESP32 dev board, and 61 mm is the Display, 1 1.2 mm thick for a I2C gamepad.
width of the board.
B ut t o n s I2 C G a me p a d C o n t r o l l e r
A 5 directions button, 2 small buttons for Select and This time I use a ATtiny861 microcontroller as an I2C
Start and 2 for A and B button. gamepad controller.
ESP32 Handheld Game Console: Page 2
Step 2: Software Preparation
ESP32 Handheld Game Console: Page 3
A r d ui n o I D E rel="nofollow">https://github.com/SpenceKonde/ATTi
Download and install Arduino IDE if not yet: nyCore/blob/mas...
https://www.arduino.cc/en/Main/Software
ES P - I D F
AT T i n y C o r e S up p o r t Follow the ESP-IDF get started guide to setup the
Follow the installation steps to add ATTinyCore development environment if not yet:
support if not yet: https://docs.espressif.com/projects/esp-idf/en/sta...
Step 3: 3D Printing
Download and print the case: https://www.thingiverse.com/thing:3591170
ESP32 Handheld Game Console: Page 4
Step 4: LCD Support
Cut a 24 x 27 holes 0.4 mm PCB for LCD support. Remember reserve some space for folding LCD FPC. Then use some
double side adhesive tape x the LCD on the PCB.
Step 5: Prepare PETG Plate
Cut out a 62 mm x 69 mm PETG plate for dev board and Lipo battery support.
Step 6: Fix ESP32 Dev Board
Use double side adhesive tape to x dev board on the PETG plate.
ESP32 Handheld Game Console: Page 5
Step 7: Fix Lipo Battery
Use double side adhesive tape to x Lipo battery besides the dev board.
Step 8: Connect Battery & Dev Board
ESP32 Handheld Game Console: Page 6
Step 9: Prepare Display Pins
LCD display have many variation form di erent vendors. Please obtain the correct datasheet and read it before any
patch and connection.
Some pins are reserved for touch panel. Since this LCD do not have touch panel, simply cut out those pins can
reduce the disturbance.
Step 10: Connect GND Pins
In most case, there are few pins require connect to GND. To reduce soldering e ort, I cut a copper tape shape to
reach all the GND pins and then soldering altogether.
ESP32 Handheld Game Console: Page 7
Step 11: Connect Vcc Pins
There are 2 pins required connect to Vcc, LCD power and LED power. According to data sheet, LCD power can direct
connect to dev board 3.3 V pin but LED power operate a little bit lower than 3.3 V. So it is better add a SMD resistor
in the middle, e.g. 12 Ohm resistor.
Step 12: Connect LCD & Dev Board Support
use tape connect LCD support and dev board support together. Both support should reserve around 5 mm gap for
folding.
ESP32 Handheld Game Console: Page 8
Step 13: Connect SPI Pins
Here are the connection summary:
LCD ESP32
GND -> GND
RST -> GPIO 33
SCL -> GPIO 18
DC -> GPIO 27
CS -> GPIO 5
SDI -> GPIO 23
SDO -> not connected
Vcc -> 3.3 V
LED+ -> 12 Ohm resistor -> 3.3 V
LED- -> GND
Step 14: Flash Program
ESP32 Handheld Game Console: Page 9
1. Download the source code at GitHub: https://github.com/moononournation/esp32-nesemu
2. Under source code folder, run "make menucon g"
3. Select "Nofrendo ESP32-speci c con guration"
4. Select "Hardware to run on" -> "Custom Hardware"
5. Select "LCD Type" -> "ST7789V LCD"
6. Fill pin settings: MISO -> -1, MOSI -> 23, CLK -> 18, CS -> 5, DC -> 27, RST -> 33, Backlight -> -1, IPS -> Y
7. Exit and Save
8. Run "make -j5 ash"
9. Run "sh ashrom.sh PATH_TO_YOUR_ROM_FILE"
ESP32 Handheld Game Console: Page 10
Step 15: I2C Connector
Breakout the I2C pins, ESP32 default I2C pins are:
Pin 1 (SCL) -> GPIO 22
Pin 2 (SDA) -> GPIO 21
Pin 3 (Vcc) -> 3.3 V (no 5 V power while powered by Lipo battery)
Pin 4 (GND) -> GND
ESP32 Handheld Game Console: Page 11
Step 16: Assembly Part 1
Follow the video steps to fold and squeeze all the parts into the case.
https://youtu.be/8VfJcM7wYEQ
Step 17: Prototype I2C Gamepad
The program for the I2C Gamepad is very simple, only 15 lines of code. But it is a little bit hard to reprogram the
ATtiny861 after soldering, so it is better test it on the breadboard rst.
Download, compile and ash the program from GitHub: https://github.com/moononournation/attiny861_i2c_...
ESP32 Handheld Game Console: Page 12
Step 18: Build I2C Gamepad
Here are the connection Summary:
ESP32 Handheld Game Console: Page 13
ATtiny861 Button
GND -> All buttons one pin
Pin 20 (PA0) -> Up button
Pin 19 (PA1) -> Down button
Pin 18 (PA2) -> Left button
Pin 17 (PA3) -> Right button
Pin 14 (PA4) -> Select button
Pin 13 (PA5) -> Start button
Pin 12 (PA6) -> A button
Pin 11 (PA7) -> B button
Pin 6 (GND) -> I2C male pin header pin 4
Pin 5 (Vcc) -> I2C male pin header pin 3
Pin 3 (SCL) -> I2C male pin header pin 1
Pin 1 (SDA) -> I2C male pin header pin 2
ESP32 Handheld Game Console: Page 14
Step 19: Assembly Part 2
Follow the video steps to install the cover and the I2C gamepad to the main body.
https://youtu.be/mznu135IDrs
Step 20: Optional: Audio Breakout Pins
ESP32 dev board Pin 25 and 26 is outputting the analog audio signal, it is very easy to breakout the these 2 pins and
also power pins (3.3 V and GND) on the top. Then you can patch a earphone to plug on it. Or even you can add an
audio ampli er module with speaker to play it loud.
ESP32 Handheld Game Console: Page 15
https://youtu.be/7ONQE77eoBk
Step 21: What's Next?
NES emulator is not the only interesting thing you can make with ESP32. E.g. you can build a micro python console
with it. The only component you need to change is from I2C gamepad to I2C keyboard. I think it is not so di cult to
make it with a ATtiny88 controller. You may follow my twitter to see the status.
Is this LCD Display good to use for the project?: https://www.displaymodule.com/products/dm-
tft24-333
It looks there is an additional integrated circuit.
A super project!!!!!!
it should be posted in the instructables contest
you will conform win the prize
Crazy that the ESP32 can run nofriendo, I feel like doing another NES project with it
Brilliant
ESP32 Handheld Game Console: Page 16
Hi, how much did this cost to build approx? Thanks.
Neat
Very impressive! Well done
ESP32 Handheld Game Console: Page 17