MocoMakers is creating Fipsy FPGA Breakout Board, a tiny circuit board offering a piece of Field-programmable gate array (FPGA).
I worked with FPGA years ago in class projects, but didn't have access to a device after that.
I backed the project, and received two Fipsy boards on Jul 20.
Fipsy is a very simple board: there is no power regulator or USB port.
The official method to program the Fipsy is through the SPI port on a Raspberry Pi.
It is easy to setup, and is a good use case for my Raspberry Pi Zero W, but there is one problem:
It is good practice to power off the circuit when modifying hardware wiring.
However, powering off a Raspberry Pi cleanly requires sending a
shutdown command and waiting for a few seconds.
If I just pull the power cord, I would risk corrupting the filesystem.
ESP32 microcontroller has SPI ports, and can be powered off and restarted very quickly.
Can I program Fipsy from an ESP32?
Hardware side is easy.
ESP32 has two available SPI ports, HSPI and VSPI, and I connected Fipsy to the Heltec WiFi_Kit_32's HSPI port.
All that remains is deciphering the spaghetti code of the official programmer.
After a day of hard work, I got it working:
@EmojiTetra is an online game resembling Tetris, hosted on Twitter platform.
Every 20 minutes, the @EmojiTetra account posts a tweet that displays the current game board, along with a four-option poll that allows visitors to vote for the game's next move: left, right, down, rotate, or plummet.
I find this game interesting.
To watch or participate in @EmojiTetra, I need to unlock my tablet, open Twitter app, search for "EmojiTetra", and scroll past the pinned tweet in order to see the current game move.
In total, this process needs 17 taps.
Looking at the 0.96 inch OLED display on my Heltec WiFi_Kit_32 board, I'm thinking: can I play @EmojiTetra on an ESP32?
Twitter offers an API that allows applications to retrieve and post tweets.
GET statuses/user_timeline resource, for example, retrieves a collection of the most recent tweets posted by a specific user.
To watch the game, "user timeline" is exactly what I need to retrieve the current game state.
It is considered bad practice to hard-code WiFi credentials into Arduino sketches.
Typical recommendations include the WiFiManager library for ESP8266, and SmartConfig for ESP32.
Both require the user to have a smartphone to send command to the ESP chip, which otherwise does not have any User Interface (UI).
My ESP32 board is the Heltec WiFi_Kit_32 that comes with a 0.96 inch OLED display and a little PRG button connected to pin #0.
Can I use these minimal UI to enter WiFi credentials without involving a smartphone?
Design with Minimal UI
I took inspiration from Prof Stephen Hawking's computer:
I've been playing with ESP8266 for one and a half years now.
Recently, I'm upgrading to its bigger brother, the ESP32.
I purchased two development boards, one of them is the Heltec WiFi_Kit_32 that comes with a 0.96 inch OLED display.
When 2018 arrives, what's a better way to say Happy New Year than on the ESP32?
Therefore, I crawled out of the bed at 4AM, turned on the computer, and started Arduino IDE.
Half an hour later, I tweeted this picture:
The code is simple yet effective.
It was modified from u8g2 library full_buffer/HelloWorld example, with the constructor line found on Robot Zero One.