PS2 Arduboy based on ESP8266


(hartmann1301) #1

Hi everyone.

I wanna show you my ESP8266 based Arduboy in a ps2 controller. Actually it is more a controller for my other projects where I can also play a few games.

Here is a link with more pictures and informations: thiniverse link

As already said the main chip is an ESP8266. I found a ESP8266 branch of arduboy but It was a bit different with an additional arduino Nano. So I forked the old arduboy(ONE) library and changed a few lines to make it run.

I am using a few librarys to get all this working:

  • PS2X_lib to read the controller buttons (there is a branch with ESP8266 support available)
  • SSD1306_OLED_ESP8266 to write to the 128x64 I2C oled
  • Brzo_i2c is used by the OLEDDisplay lib for 800MHz I2C speed

I also had to made some little changes in the SSD1306_OLED_ESP8266 lib, so sharing my arduboy fork alone wouldn´t really help anybody else. I know nothing about licences so I am not sure if I could share ported games with anybody else.

After playing Squario, which was the first and only arduboy game I ported, i realised that allmost every other game now uses Arduboy2. And by porting I mean adding about 10 lines of code, the rest happens inside the Arduboy lib. I tried to get the Arduboy2 lib running but had some problems with it and the games, there is a lot avr specific code in them.

Right now I am programming my own game based on the old Arduboy lib. I kind of like it more, because I want to use all those adafruit like draw funktions and stuff.

CPU Speed is not an issue if you have 32bit and 80MHz. I hope it will also run fast enough on those avr chips. Flash is more than enough available, so I compile it now and than for a lenoardo board to keep in mind how much there is left if I had a real arduboy.

I also ported the gamebuino library to this platform. The games are easier to port but I do not like the even smaller display resolution, so I got back to arduboy.


(hartmann1301) #2

I made some progresss with my project.

Changed my mind about the Arduboy2 lib, now I am using it. Had to replace the assembler parts but now it works very well.

Here is my fork: github

I changed the HelloWorld.ino and the Buttons.ino example to show how it can be used.

For audio support I also forked the ArduboyTones lib: github

I also changed the ArduboyTonesTest.ino example.

Games I ported with those librarys:

  • microtd: easy to port, no problems at all
  • bangi: had some problems but did work after some minor changes


(Kevin) #3

How is your experience with porting from the AVR to the ESP?

I think the ESP32 could be a really incredible dev target and I think the environments are close from the 8266 to the 32? Or?


(hartmann1301) #4

My experience was really good. After getting rid of all the avr pins, ports, assembler and timer stuff I just had to link the display library in. I learnd a lot and it was fun.

I do not own a ESP32 and I have not read a lot about it. It is way faster, I think with a chip like this you could easily control a color display with a lot more pixels.

I think my fork of arduboy2 should also work on a ESP32. The only little thing is I used everywhere these #ifdef ESP8266 lines. To compile it on a ESP32 you have to change those or #define ESP8266 in your code.

Here are some information about my Wemos d1 Mini ESP8266 build. The available pins are very limited, i used:
4 to SPI communicate with the ps2 controller and get the 6 buttons states.
2 to update the I2C display. (and get gyroscope chip data)
1 for a little speaker
1 ADC to measure the batttery voltage
2 Rx and Tx for debug (and bluetooth)
2 pins are free, I could have used them for ws2812 rgb leds

Some information about timings:
Updating the full display takes about 14ms. The display library is smart and remembers if you changed the whole area, if not it will only update the area where pixels changed and will be faster. But still this is the limiting faktor, everything else is done really fast.