Cypress Theremin
The Analog Coprocessor Pioneer Kit, CY8CKIT-048 inspired me to think about how the Cypress PSoCs can be used to recreate classic analog musical instruments. My long term goal is to recreate a Moog synthesizer, but this project is used to sharpen my skills with the PSoCs that will make this happen!
Cypress Semiconductor has been very active in supplying capacitive touch sensing electronics for product designs. Now this design area includes gesture recognition as a new and important focus. Gesture recognition uses capacitance sensing from distances of 10 centimeters or so. This is called proximity sensing.
I am using the Cypress Proximity Sensing Arduino shield CY8CKIT-024 to create a Theremin musical instrument. This example board will give the capability to do proximity sensing to about 10 centimeters.
What is a Theremin?
A musical instrument played by moving the hands toward and away from capacitive sensors.
Project Details
The goal is to use the Analog Coprocessor Pioneer Kit to its best advantage, with the least help from outside components or external systems.
The following application note were used to get feel for how to implement proximity sensing for the tone capacitive sensor and the volume capacitive sensor.
http://www.cypress.com/documentation/application-notes/an92239-proximity-sensing-capsense
If you are new to using Cypress PSoCs I highly recommend the videos at the Cypress PSoC 101 web page.
http://www.cypress.com/training/psoc-101-video-tutorial-series-how-use-arm-cortex-m0-based-psoc-4
The tone capacitive sensor is implemented as a 16-bit resolution sensor, since there is a desire for fine control of the tone frequency.
The volume capacitive sensor is implemented as a 12-bit resolution sensor since the volume control is deemed less critical in need the fine control.
Using the Universal Analog Block
The Universal Analog Block is a unique feature of the Cypress Analog Coprocessor. It is used to create a 13-bit Digital to Analog converter for creating digital audio. I had considered creating an analog audio oscillator using the operational amplifiers on the PSoC, but I rejected the idea since I thought it would make a poor overall use of resources within the PSoC.
The 13-bit Digital to Analog converter is used at half of its full speed at 31,250 samples per second. I need to work through a development issue on creating an interrupt from the Digital to Analog converter component to use it at full speed, but that is not important to this design.
The timer counter component is used to step through a sine wave table in just the correct way to create the desired tone. This is called Direct Digital Synthesis DDS, and I will let the curious Wikipedia DDS .
https://en.wikipedia.org/wiki/Direct_digital_synthesizer
The DDS aspects of the code permit easy construction of the vibrato and tremelo audio effects needed to achieve that classic Theremin sound. Check out the Improved Theremin with Audio Effects project in the software download section for the improved code using DDS techniques.
Bumping the Timer to Higher Priority
When CapSense and the Timer Counter components are operated at the same interrupt priority, there is noticable jitter in the audio output. Increasing the Timer Counter Interrupt to a higher priority than the CapSense interrupt priority gets rid of the jitter.
Putting it Together
A wooden TV tray table is re-purposed to make a nice portable stand for the completed Theremin project. It is important to keep metal objects from interfering with the tone and volume capacitive sensors. The wooden TV tray table solves these problems nicely.
Unzip the project zip file provided in the software download section below. Then open the workspace file named TH1.cywrk in PSoC Creator. Clean and Build the project. Program the CY8CKIT-048 development board or run the debugger if you are curious about the software.
Wiring Connections
Audio Output Pin 1[3] Shield Connector J3 - pin 8
Audio Ground Shield Connector J3 - pin 7
Tone Antenna CapSense Pin 1[2] Shield J4 - pin 5 -----> to antenna
Volume Proximity CapSense Pin1[5] Jumper removed J17 - pin2 ----> to proximity loop on CY8CKIT-024 Proximity Shield Board J4 - pin 5
Pictures below show the connections for a powered speaker, the tone CapSense antenna and the volume CapSense loop on the CY8CKIT-024 Proximity Shield. I hope you enjoy the project.
Improved Cypress PSoC Theremin with added Audio Effects
There are two projects to choose from in the code downloads!
TH1.cywrk.Archive04.zipThe original project relies on the person the playing the theremin to produce all of the tone and volume variation.
Improved Theremin with Audio EffectsThe improved version adds audio effects called vibrato and tremelo to create the classic "science fiction" sound.
Further Projects
My long term goal is to use what was learned on this project to recreate a Mini Moog synthesizer. The Cypress PSoC Analog Coprocessor is the perfect tool for this. I am looking forward to new versions of the Analog coprocessor with more UABs!
Comments