# Building Wireless Control Applications with XBee and LabVIEW
## 5 Case Study
### Materials and Layout  
The plant used in these experiments was a PEA, namely a PK4 FYC2, supplied by Thorlabs, which provided a 38.5 \(\upmu\)m range. Since a PEA is a high precision, non-linear actuator, the authors decided to use the auxiliary modules provided by the vendor. The PEA was actuated with a 0-150 V voltage by means of an open-loop piezo driver (Thorlabs Ref. KPZ101), which converted the input range of the driver (0-10 V) into the actuator range (0-150 V). For close-loop applications, a pre-amplification circuit was needed, for this purpose the Thorlabs Ref. AMP002 pre-amp circuit was also used. Due to the short range of the actuator (0-38.5 \(\upmu\)m), the displacement was measured by means of a high precision strain gauge integrated on the PEA. Thus, the position of the actuator was measured by means of a strain gauge reader (Thorlabs Ref. KSG101) that accurately delivered the position.  
XBee communication was used to connect the PEA actuator with the controller. More precisely, an XBee module was connected to an Arduino Uno, which was used both for reading the position of the PEA and setting the position reference of the piezo driver. The communication between the control algorithm, executed in a NI myRIO device, and the Arduino Uno was established by means of the XBee technology. Thus, the control algorithm was executed wirelessly. Since the piezo driver KPZ101 must be fed with a 0-10 V control signal an ad hoc module was used for testing purposes. This module was aimed at amplifying the output signal of the Arduino, received from the XBee module, in order to deliver the control signal to the piezo driver (See Figure 7). Thus, the module was composed of--(1) an XBee module, for communication purposes; (2) an Arduino Uno, for reading the position of the PEA from the KSG101 and setting the reference signal for the PEA; (3) an ad hoc amplifying module that converted the PWM output signal from the Arduino Uno into an analog signal to feed the piezo driver KPZ101. This amplifying circuit, based on a general purpose BJT NPN 2N2222A transistor (see Figure 7), allowed the feeding of the PEA pre-amplifier within the range of 0 and 10 V, so the same approach was applicable for other devices. Thus, this module sampled the position of the PEA and sent it, by means of the XBee module, to the NI myRIO, where the control algorithm was executed, and finally received the control signal for positioning the actuator.  
Figure 8 shows the layout of the experimental set up, which included the following major components--(1) the sensor; (2) the controller, and (3) the PEA actuator. Figure 9 shows all of the devices involved in the experimental set up--in particular, the PEA itself, the driver, and the pre-amplifier, which were all supplied by the vendor, the ad-hoc amplifier circuit, the two XBee modules attached to the Arduino Uno, and the NI myRIO, respectively. The controller was implemented in LabVIEW, namely by means of the standard PID library provided in the LabVIEW. The PID module was tuned with the following parameters: Proportional Gain, Kc = 1, Integral Time, Ti = 0.001 min, and without Derivative Time, Td, since a simple PI controller was chosen.  
Figure 7: Amplification circuit attached to the KPZ101 piezo-driver.  
The frames used to exchange information between the Arduino and the NI myRIO, followed the same format (shown in Figure 2), as described in Section 3.  
Figure 8: Layout of the experimental set up.  
Figure 9: Layout of the experimental set up.