Choosing hardware - fpga-theremin/theremin GitHub Wiki
Why FPGA?
Any modern MCU is powerful enough for digital theremin implementation - at least for synthesis of sound. But most important part of theremin is antenna sensor. Antenna capacity is usually being measured by measuring of LC oscillator frequency. It's necessary to measure frequency of oscillator with high precision (although it's easy to see hand movements while hand is near antenna, capacity C of LC tank changes by 0.001pF when hand moves far from antenna). Heterodyning techniques and averaging of measures for longer time interval help a bit. But since time interval measure hardware capabilities of MCUs are limited, longer average interval is required to get enough bits of hand position data.
Really precise and sensitive theremin sensor can be built using FPGAs. There are a lot of (relatively) inexpensive development boards with FPGAs or FPGA+MCU SOCs.
RAM
For good reverb, we need RAM to fit at least several seconds. For 48KHz, 5 seconds of mono 16bit sound will occupy about 500K bytes of RAM.
For loops, much bigger RAM is needed.
Block RAM and static RAM in FPGAs is usually 250K-1M bytes. Only devices with SDRAM provide bigger capacity.
Pure FPGA or PSOC?
Digital theremin most likely will need some CPU, at least for controls handling. Soft cores occupy significant part of FPGA (especially if SDRAM controller is instantiated). Soft cores are slow comparing to dedicated CPU cores.
It makes sense to choose solution with integrated CPU (usually ARM).
So, requirements are:
- PSOC (FPGA+ARM) development board
- 1-2 ARM cores
- SDRAM - 256Mb or more
- FPGA resources big enough for advanced synthesizer designs.
- Enough number of available pins
- 4-10 analog input pins for pots / pedals
- On-board audio i/o - nice to have
- Easy enough connection to LCD touch screens
- Price - the less the better
Xilinx / Altera / Other?
Xilinx devices look more friendly for me.
AFAIK, Intel/Altera does not provide free license for standalone configuration (e.g. w/o Linux).
I've chosen Digilent Cora Z7 board - FPGA development board on Zynq.
- $99 for single ARM core version
- $129 for dual ARM cores with 20% bigger FPGA resources
Photo of my Cora Z7-10 with two PMods:
LCD touch screen
LCD with touch could provide a lot of advantages for digital theremin:
- on-screen pitch preview
- advanced GUI may provide more flexible controls and settings than just a few encoders, buttons and pots
I was considering HDMI+USB(for touch) LCD panels, but...
- LCDs with HDMI are expensive (~$50)
- Xilinx does not provide USB Host controller driver for standalone mode
- If there are enough pins on board, parallel RGB interface is better - at least cheaper (<$20)
So...
- Touch controller interface - SPI or i2C is much better than USB
- Screen size - 7" looks overkill. 4.3 or 5" are enough for this project.
Waveshare 4.3" LCD with parallel RGB interface and resistive touch controller accessible via SPI is selected for project.
Audio I/O
At least, digital theremin requires mono line out to connect to amp.
Stereo instead of mono output may be useful sometimes. Synthesizer might produce some nice stereo effects.
Headphones output is nice to have. For pitch preview feature with headphones, separate audio out with amplifier is needed.
Line input may allow mixing accompaniment to line out and/or headphone output.
Cora Z7 doesn't have embedded audio I/O.
Although it's easy to implement sigma-delta DAC on FPGA, it requires additional filtering / amplification. Too much soldering for me. Internal 12bit ADC is not enough for audio input. So, it's better to choose some ready solution (PMod format is ideal for interfacing to Difilent boards).
Cora board has two PMod connectors which can be used for audio i/o PMods.
For line in and out, PMod I2S2 is a good solution. It provides 24bit stereo DAC and ADC with sampling rate 48KHz or higher, with I2S interface.
PMod AMP3 provides 24bit stereo DAC with amplification enough for feeding headphones.
Final list of main hardware components
- $99 Digilent Cora Z7 FPGA board
- $17.99 Waveshare 4.3" LCD with touch controller (B)
- $21.99 Digilgent PMod I2S2 - line in/out
- $9.99 Digilent PMod AMP3 - output for headphones