Piezoelectric Switch with Schmitt Trigger

Piezoelectric Switch with Schmitt Trigger

Introduction

For this project, we will be creating a switch that can turn an LED on and off by simply bending a piezoelectric element. The piezoelectric film will act as a sensor element and show a voltage difference when deformed (i.e., bent). This project will also utilize a component known as a Schmitt trigger. In the previous project “Using Force Buttons ,” you learned how a Schmitt trigger operated and how to construct one from an opamp. This device acted as comparator, easily converting a variable voltage analog signal into strictly on/off digital one. Instead of using an opamp for this project, we will be using the 74HC7014 six channel Schmitt trigger.

Figure 1. Overall Piezoelectric Switch with Schmitt Trigger circuit model.

Inventory:

Qty Description Typical Image Schematic Image breadboard Image
1 220 Ω resistor
1 10 MΩ resistors
1 LED
2 1N4001 Diodes
1 74HC7014 Schmitt Trigger
1 Piezoelectric Film

Piezoelectric Film:

If you are unfamiliar with piezoelectric materials, they are formed from special types of ceramics or plastics that will produce a voltage difference when compressed or distorted (and likewise physically distort when large enough voltage is applied). This property makes them very good mechanical transducers (the ability to convert a mechanical force into an electrical signal), and are often found in microphones, speakers, and vibration sensors (quartz crystals also exhibit this type of piezoelectric effect).

A simple electrical model of a piezoelectric film is shown in Fig. 2b. The piezoelectric film can be thought of as a variable voltage source in series with a small value capacitor (around 1 to 10 pF). This small capacitance can be thought of as “source impedance” of the device, where impedance is a measurement of the opposition to the flow of current. Impedance differs from just resistance in that it is a measurement of both resistance and reactance (reactance being a frequency specific opposition to current flow introduced by components such as capacitors and inductors). When deformed, the piezo element will produce a positive voltage pulse, and when the element returns to its original shape it will produce a negative pulse.

Figure 2a. Piezoelectric film.
Figure 2b. Electrical model of a piezoelectric film.

In the previous project, “ Debouncing via RC filter,” you created a small first order RC filter to effectively block small variations (i.e., high frequency components of a signal) in the input signal from a button. This was called a low pass filter (a filter that blocks high frequency signals, but passes low frequency ones). Our piezoelectric film model is loaded with a purely resistive load (we simply connect a resistor across the two poles, like in Fig. 3). This circuit now acts like a high pass filter; it will stop low frequency signals and pass high frequency ones.

Figure 3. Electrical model of a piezoelectric film.

The equation to determine the output voltage would be:

$$ \frac{2 \pi f}{ \sqrt{(2 \pi f)^2 + (\frac{1}{R*C})^2}}*Vin = Vout $$

You can see that the equation is very dependent on frequency, and as the variable f increases the $\frac{1}{RC}$ term becomes less and less important (higher frequency signals are not attenuated). To increase the circuit's response at low frequencies, we will need a very large resistor to counteract such a small capacitance value. This resistor should be in the range of 10 MΩ or so to pick up bending the piezoelectric film slowly. This frequency response is also why if we keep the piezo element deformed, the voltage output will fall to 0V.

Diode protection:

In Fig. 1 you can see that the output of the piezoelectric film is connected to two diodes, one connected to ground and the other the 3.3V rail. This is done because the voltage output of the piezoelectric film can potentially produce large voltage spikes of short duration (but can range upward to about 50V). The diodes essentially keep the voltage between 3.3V and ground, protecting the input of our Schmitt trigger. To read more about how this subcircuit functions, follow the link to the right.

Schmitt Trigger:

Finally, the output of our piezoelectric film is connected straight to the input of a Schmitt trigger as well. If you are unfamiliar with the operation of the Schmitt trigger, you can review the “Force button” project for a refresher. In short, a Schmitt trigger will act as a dual threshold comparator. When an input signal rises above the upper threshold, the output will assert HIGH. The output will not assert LOW again until the input signal falls below the lower threshold.

The 74HC7014 IC used for this project is a bank of six dedicated Schmitt triggers, so there will be no need to configure the component like you did in the “Force Button” project.

The 74HC7014 Schmitt trigger IC, like most CMOS transistor circuits, has a very high “input impedance”. This means that if you were to apply a voltage to the input of the circuit, it would be like trying to apply voltage across a very large resistor (10 M to 100 M range). This helps us to isolate the piezoelectric film from the rest of the circuit. Without isolation, connecting the piezo film to the rest of the circuit would change the overall resistance value seen by the element. (Imagine connecting a very small resistance in parallel with a 10M resistor, from the parallel resistance equation $\large \frac{1}{\frac{1}{R_{1}} + \frac{1}{R_{2}}}$ you can see that the equivalent resistance would be much smaller than expected). The output of the Schmitt trigger is then connected to the chipKIT™ board.

Setting up the Circuit

Figure 4. Schmitt trigger pinout.

The 74GC7014 Schmitt trigger pinout is depicted in Fig. 4. This is a bank of six Schmitt triggers within one IC, so the input to each device is denoted by the number of the device and a subsequent “A” (likewise, the output is marked by the number of the device followed by a “Y”). The input thresholds for this device depend on the rail voltage and this device can accept a range from 3V to 6V (rail voltage is the voltage connected to the Vcc pin). At 3.3V (our operating voltage for this project) the upper threshold will be 1.95V and lower 1.65V.

Figure 6. Piezo wwitch circuit.
  1. Connect the 3.3V pin of the chipKIT board to a bus strip on your breadboard. This bus strip will now be designated the 3.3V bus strip. Then connect the GND pin from the chipKIT board to the bus strip next to the 3.3V bus strip (this strip will be designated as the Ground bus strip).
  2. Insert the Schmitt trigger into the breadboard, as in Fig. 6. Make sure that the notch in the IC is oriented like the figure.
  3. Connect pin 14 of the Schmitt trigger to the 3.3V bus strip.
  4. Connect pin 7 of the Schmitt trigger to the Ground bus strip.
  5. Insert the Piezoelectric film into the breadboard (the leads on the film will fit into the holes in the breadboard). When oriented like Fig. 6, the row that the top terminal of the piezo film is connected to will be called “Node A”, and the row that the bottom terminal of the piezo film is connected to will be called “Node B”. Now choose another row in the breadboard, and designate it “Node C”. Connect a wire from Node B to Node C.
  6. Connect a diode from Node A to Node C. The diode terminal connected to Node A should be the cathode (the cathode end of a diode is marked by a line on the device). Now connect Node C to the Ground bus strip.
  7. Connect a 10 MΩ resistor from Node A to Node C.
  8. Connect the Anode of another diode to Node A; the cathode of this diode should connect to the 3.3V bus strip.
  9. Place an LED into the breadboard, then connect the anode of the LED to pin 8 of the chipKIT board. The cathode of the LED is then connected to a 220 Ω resistor.
  10. Connect the other end of the 220 Ω resistor you just placed to the Ground bus strip.
  11. Connect Node A to pin 1 of the Schmitt trigger.
  12. Then connect pin 2 of the Schmitt trigger to pin 7 of the chipKIT board.

Software

The software sketch for this project is very minimal. When the board sees the input from the Schmitt trigger assert HIGH, it will toggle a “state” variable from LOW to HIGH (or HIGH to LOW accordingly). The pulses from the piezoelectric film will be very short in duration, so if you were to just turn on the LED for the duration of the pulse, you would only see a quick burst of light.

                  const int inputSwitch = 7;
                  const int outputLED = 8;
                  int State;
                  
                  
                  void setup() {
                  
                  
                  pinMode(inputSwitch,INPUT);
                  pinMode(outputLED,OUTPUT);
                  State = LOW;
                  }
                  
                  void loop() {
                  
                    
                    int temp = digitalRead(inputSwitch);
                    
                  // if input detected is HIGH, toggle states and write to output
                    if(temp == HIGH){
                    
                        
                        if (State == LOW){
                        State = HIGH; 
                        }
                        else{
                        State = LOW; 
                        }
                    
                      digitalWrite(outputLED,State);
                      delay(200);
                    
                    }
                    
                  }

Overall, the LED of the circuit should turn on when you bend the piezoelectric element and then turn off when you bend the element a second time.

Summary:

In this project, we created a circuit with a switch that could turn an LED on and off by bending a piezoelectric element. Piezoelectric elements produce a voltage difference when compressed or distorted and act as a high pass filter when loaded with a purely resistive load. We also used a Schmitt trigger in the circuit, which acts as a dual threshold comparator.

Core Concepts:
  • Piezoelectric Film
  • High Pass Filter
  • Diode Protection circuit
  • Input Impedance
  • Source Impedance
Figure 7. Overall Circuit.

Piezoelectric Switch Schematic


  • Other product and company names mentioned herein are trademarks or trade names of their respective companies. © 2014 Digilent Inc. All rights reserved.
  • Circuit and breadboard images were created using Fritzing.