cheungbx / esp8266_arduboy2

a fork of the esp8266_arduboy2 library with push buttons
Other
37 stars 14 forks source link

2019 Aug 20 cheungbx

Many people have discussed and shared videos running Arduboy games on ESP8266. However, I have not seen any source codes shared by anyone for games running on a ESP8266 with working Aruboy2 library that support push buttons. Hence I try to make one myself and share it. Here is my youtube video that demonstrate the games that are working so far.

https://youtu.be/CinJb7gifH8

ESP8266%20Arduboy%20Video

ESP8266 has pros and cons as a portable game console compared to the original Arduboy using ATmega32U4 (Pro Micro).

con

Pro

Arduboy2 library for ESP8266 with push button supports I2C OLED and single pin sound

Thanks to hartmann1301 who created the Arduboy2 library based on the Arduboy2 library for the Slim boy version of Arduboy that runs on the Adruino Nano and I2C OLED dipslay. This ARduboy2 library for ESP8266 allow Arduboy games to be run on ESP8266 with a slower I2C SSD1306 OLED and an external button function for PS2 joysticks. refer to https://github.com/hartmann1301/Arduboy2

However, I found that library not supporting push buttons for ESP8266 directly. The game need to be programmed with extra external functions to read the push buttons. This add extra efforts to port Arduboy games over to an ESP8266 Arduboy.

I modified that a bit to define the mapping of GPIO push buttons for ESP8266, and codes to read these buttons. As ESP8266 has limited pins, so I have to use both the GPIO 0 and RX for A and B buttons. Hence make sure you do not accidentally push these two buttons when you are flashing the firmware. Otherwise, the flash may fail and you may need to redo the flash again.

Here is the link to my github

As the ESP8266 already have 4MB memory, it should be able to hold many games on the go and self-flash it using a boot loader like what @Mr.Blinky did for the original Arduboy flash cartridge. I know ESP8266 can be partitioned into two parts and self-flash over the air (OTA) to the second partition that is not actively running a program. Then switch over to boot and run from the second partition. But my programming skill is not at that level yet. So, do not know how to do that.

Appreciate help from anyone who's doing something similar.

Here are the list of the original Arduboy games that have been successfully ported to ESP8266 Arduboy/ The source code files modified for ESP8266_Arduboy can be found in the examples folder of this library with original licensing comments are kept in the modified source codes. Credits to the original creators of these Arduboy games.

TESTED on ESP8266 Arduboy

Here are the pins used and wiring diagram. I am using a Node MCI D1 Mini on a bread board and then created a perf board version. Next, I I will try to build a tiny one using a mini-joystick (as small as button) and the bare ESP12E module. Programming will be done through a ESP_USB programmer.

ESP8266%20Arduboy

PARTS

*NODE MCU Mini D1 (ESP8266)

*I2C SSD1306 OLED 128x64

*six push buttons

*extra push button for rest (for perf board version only)

*power on/off switch (or perf board version only)

*3.7V LIPO Battery

*Perf Board or breadboard

*Wires

*Pins for buttons

*GPIO13 D7—— Rightbutton----- .GND

*GPIO12 D6—— Left button----- .GND

*GPIO14 D5—— UP button----- .GND

*GPIO2 D4—— Down button----- .GND

*GPIO0 D3—— A button----- .GND // WARNING DO NOT press this button when flashing firmware.

*GPIO16 D0—— B button----- .GND // ** Tie the ther end of this button through a 10K resistor to VCC,

*A0 Paddle --- connect to middle pin of 10K VR, connect left pin to VCC, right pin to Ground

*GPIO15 D8——Piezo Speaker/headphone--GND

*ESP8266 i2c SSD1306 Oled

*=============================

*3.3V ------------VCC

*GND -------------GND

*GPIO5 D1 --------SCL

*GPIO4 D2—--------SDA

Simple Steps to convert Arduboy games to run on ESP8266 Arduboy.

Caveats