Hello folks!
Today's project is a personal favorite of mine because it got the amateur/wannabe musician inside me very excited. Building on yesterday's example of how to do proximity sensing with the CapSense Component, today we're going to use that concept in an application. This example project implements a Theremin, a 1920s electronic musical instrument played without physical contact.
The project uses two proximity sensors - one for Pitch and another for Volume. The proximity sensing itself is done using wires that act as antennas, input to the PSoC 4 using the CapSense block.
The theremin has 2 modes - discrete and continuous notes, toggled by using the pushbutton (SW2) on the board. Pitch information is indicated by the color of the LED, while Volume information is indicated by the brightness of the same LED.
The Cortex-M0 CPU takes the analog input from the CapSense proximity sensors and send a parameter indicating distance to the hardware PWMs, that in-turn modulate the LED. The CPU also sends data to the 2 other PWMs that are used to drive the a Buzzer that creates the musical notes.
The project also includes a UART Component so you can read the CapSense proximity sensor data over hyperterminal.
What's cool about this project?
- It uses 5 (five!) hardware 16-bit PWMs - 3 of which are implemented on the TCPWM block (modulating the RGB LEDs), wheres 2 more implemented using UDBs (to drive the buzzer).
- It implements distance sensing using CapSense proximity
- It lets you make music in the air! Check out the demo video above.
Hardware Connections:
The RGB LED and the pushbutton switch are on the board. In addition to the PSoC 4 Pioneer Kit, you're going to need -
- an 18 ohm Speaker/Buzzer (P2[0])
- 2 resistors, 2 capacitors
- hanful of jumper wires
The project is attached below, its all ready to go. Just build and program on to your PSoC 4 Pioneer Kit, and wire up a small buzzer.
Have fun making music!