It is hard to end this blog; I keep thinking of new things to do…(maybe that is why I am ‘Sir Blog-a-Lot’!) We may not have time in class for these; but you can do these at home or if you finish early.

Piezoelectric Effect

what is piezo


The piezoelectric effect is found in certain ceramics and crystals. When a mechanical force squeezes the piezoelectric material a voltage is generated (like in the igniter for a gas barbecue). The reverse also works; when a voltage is applied the piezoelectric crystal structure warps. If the electric current is alternating the material vibrates as in a buzzer or speaker application.

piezo action


Soldering Wires to Piezo Element

soldering piezo

Too much heat can damage a piezo element; so follow these instructions carefully. Pre-tin the wires with solder (sacrifice a black and a red wire jumper from your kit; cut off one end and strip off a quarter-inch of insulation). Add 2 drops of wire to the element; one on the rim and the other near by on the white center. Place the tinned wires to the element and reflow quickly.

Piezo Heartbeat Monitor

Wire the circuit below:

fz heart rate sensor

I found this here: Link

heart sch

Copy and paste the code in your Arduino IDE:

int threshold = 60;
int oldvalue = 0;
int newvalue = 0;
unsigned long oldmillis = 0;
unsigned long newmillis = 0;
int cnt = 0;
int timings[16];

void setup() {

void loop() {
  oldvalue = newvalue;
  newvalue = 0;
  for(int i=0; i<64; i++){ // Average over 16 measurements
    newvalue += analogRead(A2);
  newvalue = newvalue/64;
  // find triggering edge
    oldmillis = newmillis;
    newmillis = millis();
    // fill in the current time difference in ringbuffer
    timings[cnt%16]= (int)(newmillis-oldmillis); 
    int totalmillis = 0;
    // calculate average of the last 16 time differences
    for(int i=0;i<16;i++){
      totalmillis += timings[i];
    // calculate heart rate
    int heartrate = 60000/(totalmillis/16);

Tape the piezo sensor to your finger tip and run the code. Open the serial monitor (make sure to change the baud rate to 57600). Keep you finger still and try to let the wires relax (i.e. not taunt or they will show every vibration as junk data).

finger heart monitor

monitor heart rate piezo

Optical Theremin

playing theremin

Old science fiction movies loved the eerie and ghostly sounds an odd instrument called the Theremin made. The original used the body capacitance of the musician to interact with radio energy between 2 antennas. The version we have below uses light and a CDS cell (light sensor).

ftz themmmm

ftz sch theremin

Copy and paste the code in your Arduino IDE:

/* Theremin
 * --------
 * Created 24 October 2006
 * copyleft 2006 Tod E. Kurt <

int potPin = 0;    // select the input pin for the potentiometer
int speakerPin = 7;

int val = 0;

void setup() {
  pinMode(speakerPin, OUTPUT); 

void loop() {
  digitalWrite(speakerPin, LOW);
  val = analogRead(potPin);    // read value from the sensor
  val = val*2;                 // process the value a little
  //val = val/2;                 // process the value a little
  for( int i=0; i<50; i++ ) {  // play it for 50 cycles
    digitalWrite(speakerPin, HIGH);
    digitalWrite(speakerPin, LOW);

Load the code to your Arduino manipulate the light hitting your optical sensor by shading it with your hands.

FET Electrometer

This is a super easy circuit but lots of fun. It responds to static electric fields. If you bring a plastic snack wrapper, or a piece of clear tape near the antenna it will extinguish the LED. It can be bread-boarded or built on a 9V battery snap as illustrated.

electrometer 9V