Shop OBEX P1 Docs P2 Docs Learn Events
The Boe-Bot Theremin — Parallax Forums

The Boe-Bot Theremin

BryceBryce Posts: 1
edited 2007-04-16 14:58 in Learn with BlocklyProp
This is a trivial program I wrote up, based on some playing with the Boe-Bot robot I did during a seminar at Yuba College Friday, presented by Andy Lindsay. Very interesting.

Anyhow, he recomended that I post this program here, which turns your Boe-Bot into a musical instrument. The hardware configuration is per the light sensitive circuit setup on page 211 of the "Robotics with the Boe-Bot" book - RC circuits with 0.01 mf caps and the CdS photoresistors on pins 3 and 6, and the piezo speaker on pin 4. The version I've posted doesn't actually use the pin 6 sensor, but you might wish to modify it to use it.

By moving your hand over the photoresistor, you can raise the pitch of the note produced from the speaker. Unfortunatly, A/D conversion via an RC circuit is really slow, so there is a notable click in the note produced, caused by the single-tasking BS2 stopping to read the sensor. I don't think a faster BS2 would help (I'm just using a plain one in my Boe-Bot), as the issue is probably the A/D conversion time. I've tried to minimize the click - maybe you'll have some ideas. Obviously, if you want a nicer Boe-Bot theremin, you can use a faster method (such as a converter IC), but this is supposed to be something you can do with the "stock" hardware.

There is a trade off between the bothersomeness of the clicking sound and the responsiveness of your "theremin," you may wish to tweak the value below (10), as also the scaling factor between change in the delay and the frequency (40).

(Edit: Corrected rather daft bug caused by coding past 10 without caffine.)

Enjoy.
'{$STAMP BS2}
' Hardware assumptions:
' P4 is the + of the peizo speaker
' P6 & P3 are RC circuits with the CdS photoresistors included with the 
' Boe-bot kit (or their equivalent)
debug "Boe-bot Robot Theremin, by Bryce Schroeder, (C) 2007.", cr

freq    var    word
freq = 2200
start:
    high 3
    freqout 4, 10, freq
    rctime 3, 1, freq
    freq = 2200 + (freq*40)
goto start
end


Post Edited (Bryce) : 4/2/2007 5:21:17 PM GMT

Comments

  • dbc1218dbc1218 Posts: 33
    edited 2007-04-04 02:11
    Don't try this until someone else says its a good idea too, but if you were to put two capacitors in series it will decrease the total capacitance and therefore decrease the RC time. This could give you a faster response but I'm just one guy, let's see what everyone else says.
  • hitswarehitsware Posts: 156
    edited 2007-04-16 14:58
    ' FREQOUT is pretty dirty. Big pops on each new frequency.
    ' This seems to work pretty well:
    x var word
    play
    high 1
    rctime 1,1,x ' pin 1 ... variable resistance to gnd. cap to +5V
    pulsout 2,x ' pin 2 ... audio output
    goto play
Sign In or Register to comment.