Page 799 - Mechatronics with Experiments
P. 799

LABORATORY EXPERIMENTS  785
                             done directly by writing to the specific registers in C or assembly language or by calling
                             the appropriate C library functions which hide the details of register configuration. The
                             main purpose is to be able to read (and display) the voltage level at the ADC pin of the
                             microcontroller. In this lab, no output operation at the I/O ports are performed. It is only
                             an analog input experiment. Variations on the software can be made to handle the ADC
                             conversion process either using

                                1. the polling method (i.e., by repeatedly checking if the ADC conversion is done), or
                                2. the interrupt method (i.e., a timer generate periodic signal triggers ADC conversion
                                  to start, and the ADC registers can be setup to generate interrupt every time an ADC
                                  conversion is completed). If the interrupt method is used, then an interrupt service
                                  routine (ISR) must be written and interrupt conditions must be configured by setting
                                  appropriate register bits.
                                  Relevant header files to be included with C-18 compiler are as follows,
                             #include <p18f4331.h>
                             #include <adc.h>
                             #include <timers.h>
                             #include <delays.h>


                             Procedure
                                1. Assemble the circuit on the breadboard as shown in the circuit diagram. Take care
                                  not to connect the 5-V supply until the entire circuit has been assembled.
                                2. Glue the strain gauge onto the fixture using the strain gauge adhesive provided.
                                3. Connect the strain gauge outputs to one arm of the Wheatstone bridge setup and the
                                  operational amplifier. Notice that one arm of the Wheatstone bridge is made as an
                                  adjustable resistor (potentiometer). This will help us adjust the offset voltage output,
                                  hence it will be used in the calibration of the sensor. We will use the adjustable
                                  potentiometer to make sure the sensor output voltage is zero when there is zero
                                  deformation. Note that, in order to build an accurate Wheatstone bridge, the resistor
                                  values should be the same. As a result, for higher accuracy applications, resistors with
                                  higher tolerance (smaller variation in their value due to manufacturing variations)
                                  should be used.
                                4. Open MPLAB and load your project into the workspace. The source code must
                                  contain commands to configure the analog to digital converter on the PIC, and read
                                  input voltage at the ADC pin to which the sensor signal is connected to, and display
                                  the results.
                                5. Download and run the program on the PIC microcontroller. Then, deflect the alu-
                                  minum beam on the strain gauge fixture by lowering the screw at the tip. Take care
                                  not to deflect it by more than a few millimeters (about an eighth of an inch at most).
                                6. Verify that the ADC now shows a value. Now raise the screw by a few turns. This
                                  will reduce the strain on the beam; read the value of the ACD again. The value in the
                                  ADC should now have reduced to reflect lower strain value.
                                7. Repeat the procedure for various deflections of the beam, all the while taking care
                                  not to deflect the beam by more than 2 or 3 mm. Record the deflection versus the
                                  strain measurements. Calculate the force applied at the tip of the beam. Note that
                                  for the calculation of force, you need the beam material and geometric parameters
                                  (E, b, h, l ), strain gauge gauge factor (G), Wheatstone bridge parameters V , R , and
                                                                                              i
                                                                                                0
                                         s
                                  signal amplifier gain K =−R ∕R . Plot the results:
                                                    a
                                                             1
                                                          2
   794   795   796   797   798   799   800   801   802   803   804