This hands-on project aims to introduce you to Piezoelectric sensors, the use of amplifiers, the modeling of circuit transfer functions, and the use of live models vs the real data. At the completion of all four sections, students will have experience using the Piezoelectric sensor, operational amplifiers, and the Control Design and Simulation toolkit.
1. What You Will Do
Throughout each of the four (4) sections, we will use the NI ELVIS with the RIO Control Module and LabVIEW to explore the Piezoelectric sensor and how you would use it in a real world scenario. With prebuilt LabVIEW applications, complete the respective tasks for each section.
It is recommended that you have some exposure to LabVIEW, but it is not required. The instructions for the exercises cover all necessary steps to complete the task. Note that you are expected to learn basic tasks as you progress, and the instructions become less detailed and require that you retain some of the knowledge.
You are expected to be familiar with using a computer, mouse, and keyboard.
2. Piezoelectric Fundamentals
The piezoelectric effect is the electric charge that accumulates in certain solid materials in response to applied mechanical stress. Depending on the specific design the Piezoelectric sensor can use this property to measure changes in pressure temperature, strain, acceleration, or force. Piezoelectric devices have a high frequency response and signal conversion without mechanical components. This makes them more reliable and thus preferred over conventional electromechanical pressure sensors. We will explore how a simple piezoelectric sensor reacts to various movements, pressures, and actions using the ELVIS. As we use the sensor we will note various barriers to using the sensor with the RIO Control Module and solve these problems in later sections.
Gain an understanding of this piezoelectric sensor’s voltage and what physical actions it can be used to observe and how the output changes with time.
2x Male to Male Connector Wires
Open the DMM from the NI ELVISmx Instrument Launcher.
Figure 1 Select the Digital Multimeter
After opening the DMM press the play button and proceed to probe the Piezo sensor with one of the methods depending on your available probes.
Figure 2 Digital Multimeter
Method 1: DMM Alligator Clips
Using the DMM alligator clips assemble the Piezo sensor and wires as shown in the following image.
Figure 3 DMM Alligator Clips Connection
Method 2: DMM Probes Without Alligator Clips
Using the oscilloscope probe, assemble the Piezo sensor and wires as shown in the following image.
Figure 4 Oscilloscope Probe Connection
The oscilloscope probes hold the wires in place and allow us to probe the wires connected to the Piezo sensor.
Bend the Piezo back and forth and look at the output on the DMM. The value is transient and you will notice that it only briefly appears. When bending one direction the value will be positive and in bending the other direction it will be negative. Notice that the output value is approximately 122 mV when bent. It might go higher but the only consistent max value appears to be around 122 mV in either direction. With the DMM not much detail is visible because we only see a single data point at a time. To see the data over time let’s switch to the oscilloscope. Go to Figure 4 Oscilloscope Probe Connection to see how to connect the oscilloscope. Open the Oscilloscope from the NI ELVISmx Instrument Launcher.
Figure 5 Select the Oscilloscope
Configure the Oscilloscope as shown below.
Figure 6 Example of Oscilloscope Configuration
Scale Volts/div – 50mV
Trigger Type – Edge
Since the peak value of the waveform is 240 mV and there are 5 divisions on the scope, I’ve set the Scale to 50 mV to maximize the waveform on the chart. With the Edge trigger turned on you can get a sine wave when bending the Piezo with your fingers. Bending the piezo produces a charge in the material which will quickly dissipate. This sine pattern is likely due to the micro movements of your skin due to your pulse. Try with a pen and notice that the sine is not present. Immediately we can see that there is a significant difference between the DMM and the scope. The scope shows us a peak waveform of 240 mV rather than an apparent maximum of 122 mV. Piezoelectric material can be configured for different types of stimuli. In this case, the most visible effect appears to be when the material is vibrated. The vibration still produces a fairly low voltage for it to be useful in an embedded application. In the next section we will address this. Carefully flick the end of the Piezo sensor. Observe the vibration in the material and see it in the oscilloscope. Experiment with adjusting the Time/Div to stretch and compress the waveform and the Scale Volts/Div to change its vertical scale. The trigger only holds a snapshot of the waveform for a few seconds and then it resets. Try experimenting with various actions and settings. Observe the waveforms produced then proceed to the next section.
Figure 7 Vibration Sensing with the Piezo Sensor
3. Amplifier Interface Circuit
The piezoelectric film produces a small charge centered on 0 V which is too small to be used by the RIO Control Module. To make it useful we need to offset the Sensors output and amplify it to take full advantage of the 0-5V Analog Input. The following amplifier circuit will offset the center voltage of the Piezo and amplify its output to values easily read by the RIO.
Build and observe an amplifier circuit which will allow the Piezoelectric film to be used as a sensor.
Piezo Film Sensor
AD8541 Rail-to-Rail single-supply op amp.
0.001 μF ceramic disk capacitor, marking “102”
Resistor, 10 MΩ
Resistor, 10 kΩ (2x)
Jumper wires, M-M (7x)
Build the circuit shown on the following page.
Wire colors in pictures correspond to the following:
Red/Orange - 5V
Black - Ground
Green/White - Piezo Sensor
Blue - AO 0
Note: The colors of the wires are consistent. Assume any wire of the same color to be the same signal.
Figure 8 Amplifier Circuit
Connect the MXP Breadboard to Connector A and then Run the “Section 2 Piezo Through Amplifier” VI.
The output of the circuit should now center around 2.5 V.
Figure 9 Centered Amp Output
The paired 10 kΩ resistors on the positive terminal of the opp amp bias the output to 2.5V.
By moving the Piezo back and forth you will see a decaying sinusoid similar to an underdamped second-order system.
Figure 10 Piezo Being Moved
The VI shown below uses a single Analog Acquisition Express VI which simplifies instrument development. By double clicking on the Express VI you can configure it for any of the analog inputs you wish to use.
Figure 11 Section 2 VI Diagram
At the end of the VI we reset the myRIO which clears the FPGA and resets all of the I/O.
The circuit is a charge amplifier with a feedback resistor for a DC Gain path and bias resistors to raise ground to Vrail/2.
The charge amplifier’s sensitivity is controlled by the capacitor. The larger the capacitor, the more sensitive to small changes.
The 10MΩ resistor is large enough to minimize the current flow from the output of the amplifier.
Now that we have an amplified output we can address another issue with the piezo sensor. Its output can rapidly change which can lead to noisy control responses. By adding a low pass filter, we can change the behavior of the output to be what we want in our system. Before building a circuit it is best to simulate it so that we can save time later. In the next section we will choose the components for our circuit and simulating it.
4. Transfer Function Modeling
Transfer functions are mathematical representations of the inputs and outputs of black box models. By using models, we can predict the behavior of a circuit before building it. In this section we will look at implementing transfer functions and simulating a system while acquiring real sensor data to drive the simulation.
The LabVIEW Control Design and Simulation Module provides a framework to simulate dynamic systems and design sophisticated controllers. Within this framework you can use both classical and state-space approaches to design controllers and estimators. The loops use included solvers and strict timing controls to provide customizable and accurate simulations.
Gain an understanding of the Control Design and Simulation Module and how you can model your transfer function with it while using real circuit data.
Complete Section 2 Circuit
The Section 3 Simulate Transfer Function VI is prepared to accept a Single Input Single Output (SISO) Symbolic model. The symbolic model accepts the numerator and denominator of the transfer function arranged in polynomial form. The index of the element is the exponent of that term.
Figure 12 Symbolic Notation Example
The transfer function of a simple Low Pass Filter is as follows.
Figure 13 Low Pass Filter and its transfer function
The VI is preconfigured with a Low Pass Filter using a 1kΩ resistor and a 10 μF capacitor. This filter tracks very closely to the actual value. By changing the values of R and C, you can customize the transfer function for your circuit.
Figure 14 Transfer Function Configuration
Run the Section 3 Simulate Transfer Function VI
Flex the Piezo sensor.
View the output.
Stop the VI.
Choose a different R or C Value from the suggestions below and repeat.
Resistor (1 kΩ, 47 kΩ, 100 kΩ)
Capacitor (10 μF, 22 μF, 220 μF)
Choose a resistor and capacitor value which removes the large spikes but still follows the output quickly.
Figure 15 VI Block Diagram
Taking a closer look at the VI we can see that the code is in two specific parts. The first is the creation of the transfer function and the second is the Control and Simulation Loop which is acquiring and displaying the data. The Construct Transfer Function Model VI is just one of several VIs which have been collected together into what is called a Polymorphic VI. These are distinguished by the drop down menu under them and allow similar VIs to be collected together for convenience and cleaner organization. Most VIs are also connected to their owning palette allowing easy access to the other functions related to themselves. For this VI there are many other Model types which we might want to use. By right clicking on the Construct Transfer Function Model VI and going to the Model Construction Palette you can see these options.
Figure 16 Viewing other Modeling Options
The same can be done with the Transfer Function VI inside the Control and Simulation Loop. If you decide to explore this lab further and try one of the other models be sure to match the VIs to the model, you wish to use. Otherwise the VI will have a broken arrow which will indicate what is wrong.
In the next section we will modify this VI to add in a second Analog Input channel and test the actual circuit to see how it matches the model.
5. Comparing Models to Real Circuits
Models are only approximations of the actual behavior of a system. In this section we will build and test a real circuit which matches our transfer function. We can then compare the output of the real circuit to the response the model expects.
Observe how a model compares to the actual circuit and how by simulating the circuit before building minimized your time spent implementing the circuit.
Section 2 Hardware
Resistor (1 kΩ, 47 kΩ, 100 kΩ)
Capacitor (10 μF, 22 μF, 220 μF)
Using your chosen resistor and capacitor from Section 3 or the bolded values in the hardware list, build the low pass filter and connect it to your circuit as follows.
Figure 17 Resistor and Capacitor Connections
Note: When using an electrolytic capacitor remember that the shorter side is the negative side.
Open the Section 3 Track Piezo Data. Click on File->Save As. Select Open additional copy and the “Add copy to” option below it.
Figure 18 Save As Settings
Save it as “Section 4 Comparing Models to Real Circuits”.
Go to its block diagram and double click on the blue Express VI Analog input (1 sample). Click on the plus symbol on the right and name the new channel “Circuit Output”. Once done click Ok.
Figure 19 Express VI Configuration
We need more space for the next step. Hold Ctrl and click on the empty space below the Transfer Function VI inside the Control and Simulation Loop. Drag the mouse downward a bit to give us some more space.
Figure 20 Adding Space to the VI
Copy the Simulation Time Waveform VI into the new space. We then click on the Build Array VI and drag it down to add a new input. After cleaning up the wiring it should look like this:
Figure 21 Modified VI
Next, expand the plot label for the graph on the front panel. Click on the blue square found while hovering the mouse over the Plot Legend and drag downwards. Change the plot name to Circuit Output.
Figure 22 Updated Plot Legend
Finally, configure the variables to the values you’ve chosen for your circuit and run the VI.
Run the VI and compare the real and simulated curves. With the default values of the resistor and capacitor you will get data as seen below when moving the Piezo back and forth.
Figure 23 Example Result Data
6. Next Steps
To learn about New NI ELVIS boards for the NI ELVIS RIO Control Module please review the following resources:
- Learn more about the Quanser Mechatronics Systems Board to teach advanced topics in your classroom
- Learn more about the Quanser Energy Conversion Board to teach advanced topics in your classroom
- Review the complete Qnet family of products to teach topics such as controls, mechatronics and robotics
- See NI ELVIS RIO Control Module pricing