Tensile Testing Lab

advertisement
Introduction to Sensors and Motors
Engineering 1282H
Spring, 2014
Nimit Desai
Josh Kuehn
Ian Stamm
Brannon Oiler
B. Cohen
12:40am
Date of Experiment: 2/13/15
Date of Submission: 2/20/15
1. Introduction
Diagnostic testing is a crucial part of any design project. In order to make sure that
problems with robot functionality do not stem from malfunctioning parts, it is key to test sensors
and motors beforehand to identify potential issues. The purpose of this experiment was to
determine the functionality of the given Microswitches and CdS sensors and learn how to link
these sensors to motor function.
The following section describes the data observed and contains data tables. Section 3
discusses the results and their significance, and Section 4 summarizes the experiment and
concludes the purpose in question.
2. Results and Description
The results from this lab were mainly qualitative in nature and the laboratory assignment’s
main purpose was to instruct students on the features of the Proteus and its corresponding sensors
and motors. For Part I of the experimental procedure, each sensor, servo, and motor was tested at
every possible port to check if it is functional at every possible connection. Pictures of these
connections can be found in the Figures and Tables attachment. Each of these diagnostic tests
confirmed that each component was working properly at each of the individual component ports.
For Part II of the experimental procedure, the motor was successfully run at full power both
forwards and backwards with the status of the motor being printed to the screen. A key insight
gained during this portion of the lab was that the motor must be turned off (or the robot put to
sleep) between forward and backward motor functions. This sleep allows for the motors to
maintain proper functionality and subject these motors to less stress over time.
2
In Part III, those involved in the experiment were able to control motor function by using
a microswitch to stop the motor temporarily. Part IV used a cadmium sulfide cell to get readings
on a variety of lights with a variety of filters. A copy of the code written to yield these CdS readings
can be found in Figure 1 in Sample Code attachment. The values of the CdS readings are displayed
in Table 1 in Figures and Tables attachment.
Finally, Part V showed that a servo motor could adequately be controlled by varying values
returned by a CdS cell. It is important to note that the servo must be set to an initial minimum and
maximum value in order for the CdS cell to control the servo motor most accurately. A copy of
the code written to control the servo with a CdS cell can be found in Figure 2 in the Sample Code
attachment.
3. Discussion
There were a variety of issues that were encountered in all parts of the lab. A major issue was
with the wiring of our motors and our sensors. Some of the wiring had come out of the motor and
therefore the wire had to be stripped and then placed back into the plastic casing that inserts into
the side of the Proteus. Much of the initial problems with the lack of sensor and motor function
stemmed from these wiring issues. Another issue that was seen in Part II specifically was that
there was a lot of stress being put on the motor when the direction was changed from forward to
backward drive. The sleep function was not being run for an adequate amount of time to prevent
the motor from making an unhealthy screeching noise. Once this sleep was increased to 500
milliseconds, the motor functioned without excessive stress. Another issue that was encountered
was that the CdS cell was turning the servo, but the not to the correct degree amount. Later, it
was then seen that each servo rotation was off by the same degree amount. This problem was
3
fixed by setting a minimum and maximum number for the servo. These min and max values
helped properly configure the servo to turn to the correct degree angle.
As for the CdS cell readings, it is clear that a team would prefer a filter that gave the largest
difference between the Red light, Blue light, and No light values. Having this large discrepancy
would allow the robot more room for error when determining the color of the light being shined.
Through experimental testing, it seems that the Red filter returns the largest difference between
the light types. Therefore, using a Red filter would be logical in order to ensure that the robot is
properly detecting the presence of the different colored lights.
4. Summary and Conclusions
After completing the lab, the team gained valuable experience working with sensors,
motors, and making simple wiring connections. The purpose of the experiment was to check the
proper functionality of each robot component and it was concluded that each sensor and motor
worked for each motor and sensor port on the Proteus. The team also learned a great deal about
sensor and motor function as well as how to access these elements in the Qt Creator code. Future
diagnostic experiments may want to consider using multiple types of motors to gain experience
with each kind. Other labs may also want to consider making and using a pinwheel shaft encoder
so teams are not only comfortable with a built in shaft encoder.
Attachment: Figures and Tables, 2.
Attachment: Sample Code, 2.
4
References
[1]
Lab01 Write-Up Sp15 www.carmen.osu.edu
5
Figures and Tables
Figure 1: This figure displays the microswitch and CdS cell connections
Figure 2: This figure displays the motor connection to the Proteus
Figure 3: This figure displays the servo motor connection to the Proteus
Table 1: This table displays CdS readings given with a variety of lights and filters
CdS Readings
Red Filter
Blue Filter
Yellow Filter
Green Filter
No Filter
Red Light
.10
.355
.085
.22
.085
Blue Light
.75
.23
.25
.33
.17
No Light
.57
.79
.36
.67
.34
C2
Sample Code
Code for PART 3
#include <FEHLCD.h>
#include <FEHIO.h>
#include <FEHUtility.h>
#include <FEHMotor.h>
#include <FEHServo.h>
//Declare buttons and analog pin
ButtonBoard buttons( FEHIO::Bank3 );
AnalogInputPin an00 (FEHIO::P0_0);
//Use this function to wait for middle button to be pressed
void Wait()
{
/* Wait until the microswitch button is pressed and released */
while (!buttons.MiddlePressed()) {}
while (buttons.MiddlePressed()) {}
}
int main(void)
{
//Set LCD Display
LCD.Clear( FEHLCD::Black );
LCD.SetFontColor( FEHLCD::White );
//Print initial message to screen
LCD.Write("Press microswitch button to Start\n");
//Wait for button to be pressed
Wait();
//Use while loop to exit program when button is held
while(!buttons.MiddlePressed())
{
//Print the CdS value to screen
LCD.Write(an00.Value());
//Sleep and clear to not overload display
Sleep(250);
LCD.Clear();
}
}
C3
CODE FOR PART 4
#include <FEHLCD.h>
#include <FEHIO.h>
#include <FEHUtility.h>
#include <FEHServo.h>
int main(void)
{
//Declare buttons and input pin
ButtonBoard buttons( FEHIO::Bank3 );
AnalogInputPin an00 (FEHIO::P0_0);
//Set default LCD
LCD.Clear( FEHLCD::Black );
LCD.SetFontColor( FEHLCD::White );
//Declare Servo
FEHServo servo0 (FEHServo::Servo0);
//Use while loop to end program if middle button is held
while(!buttons.MiddlePressed()){
//Declare servo min and max
int min = 500;
int max = 2500;
//Use while loop to keep turning servo until power off
while(true)
{
//Set servo min and max
servo0.SetMin(min);
servo0.SetMax(max);
//Calculate and Set servo to degree value
int deg = 606*an00.Value()/max*180;
servo0.SetDegree(deg);
//Sleep to allow for servo to not be overloaded with commands
Sleep(250);
}
}
}
C4
Download