Four-key Piano on Fipsy FPGA

The newest addition to's toy vault is Fipsy FPGA Breakout Board, a tiny circuit board offering a piece of Lattice MachXO2-256 field-programmable gate array (FPGA). After porting an SPI programmer to ESP32, it's time to write some Verilog! Blinky is boring, but I did it anyway. Then, I'm moving on to better stuff: a piano.

The piano is an acoustic music instrument played using a keyboard. When a key is pressed, a hammer strikes a string, causing it to resonate and produce sound at a certain frequency. A normal piano has 88 keys, and each key has a well-defined sound frequency. My "piano", built on Fipsy, has four keys, and uses a passive buzzer to produce sound.

Fipsy FPGA connected to a buzzer and a keypad

Play Tone on Passive Buzzer with FPGA

A passive buzzer plays a tone controlled by an oscillating electronic signal at the desired frequency. In Arduino, the tone() function generates a square wave of a specified frequency, which can be used to control a passive buzzer.

Program Fipsy FPGA Breakout Board from ESP32

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?

Fipsy connected to Heltec WiFi\_Kit\_32

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:



  • AHDL语言编写,使用带有FLEX®EPF10K20TC144-4芯片的JDEE-10K实验箱
  • 4层楼的电梯控制
  • 轿箱按钮、层站召唤按钮,按钮带有指示灯
  • 用LED表示马达运转方向
  • 点阵显示当前楼层
  • 点阵开关门模拟动画
  • 支持背景音乐,乐曲为“欢乐颂”

下载源代码 实验报告