Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Chip and 555 timer make a Theremin — Parallax Forums

Propeller Chip and 555 timer make a Theremin

Martin_HMartin_H Posts: 4,051
edited 2012-10-16 21:13 in Propeller 1
A few years ago I saw this PDF http://thereminvision.com/version-2/ThereminVision-II-manual.pdf which on page 20 contains a schematic for a 555 oscillator, a circuit to compare the oscillator output against a reference frequency, and a circuit to shift it into the audio range. It is supposed to be used as a proximity sensor for a BS2 robot. It occurred to me that a Propeller chip could do most of the signal measurement and audio output, so I would only need the 555 timer oscillator to do the same.

Well the 555 timer has been sitting in my parts box for the better part of a year, but tonight I finally built the oscillator, used a propeller chip to measure the reference frequency, and a piezo speaker to output the results. Here's a video of the result:

The piezo speaker is quiet, but you can hear the change in pitch as I move my hand. The propeller code to do it is easy using the BS2 functions.
{{
   File...... Theremin.spin
   Purpose... Measures the output of an oscillator on pin 0
   Author.... Martin Heermance
   E-mail....
   Started... 16 October 2012

 This program uses a 555 oscilator to measure frequency against a reference
 to measure changes in capacitance as audio output. IE it's a theremin!
}}

CON

  _clkmode      = xtal1 + pll16x
  _xinfreq      = 5_000_000

  tIn            = 0             ' 555 output connected here via level shifter 
  
DAT                               
  CLREOL        byte "\033[K", 0 ' ASCII terminal control codes to match PBASIC commands.       
  CRSRXY        byte "\033[%d;%dH", 0
  HOME          byte "\033[H", 0
  
OBJ

  BS2   : "BS2_Functions"       ' Create BS2 Object 

VAR
  long refFreq
  long freq

Pub Main   | i
  BS2.start (31,30)             ' Initialize BS2 Object timing, Rx and Tx pins for DEBUG     


  refFreq := BS2.FreqIn(0, 15)  ' Sample the reference frequence.
  repeat                        ' Begin the scan-and-process loop.
    freq := BS2.FreqIn(0, 15)   ' Sample current oscillator frequency
    BS2.FREQOUT_Set(4, refFreq - freq) 
    BS2.DEBUG_STR(STRING("Freq="))
    BS2.DEBUG_DEC(freq)
    BS2.DEBUG_CR

Comments

  • kwinnkwinn Posts: 8,697
    edited 2012-10-16 21:13
    Using a prop as the reference frequency generator and signal processor is a great idea. Using a 556 with 2 capacitor plates would allow both frequency and volume control. Have to give that a try if I ever get the time.
Sign In or Register to comment.