ELD-3110

docx

School

Thomas Edison State College *

*We aren’t endorsed by this school

Course

311

Subject

Mechanical Engineering

Date

Jan 9, 2024

Type

docx

Pages

8

Uploaded by DrJellyfish3760

Report
Messier, Michael J (mjmessier) ELD-3110 LAB3
Report (60 percent): The report should list all the major procedures required to complete each of the exercises. Here are the general guidelines for the report: 1. Cover Sheet (5 points): The lab report must include a completed cover sheet with your name, student ID number, the lab number, lab title, and submission date. Note: Your lab report will not be graded without a completed cover sheet. 2. Objective (15 points): A short paragraph stating the purpose (main ideas) of the experiment. Procedure (30 points): At the beginning of this section, give a summary description of the procedures taken during the lab. 3. Discussion/Conclusion (30 points): State your understanding of this experiment. (What did you learn from these experiment?) State the challenges and problems faced, and measures taken to resolve these problems and overcome challenges. 4. Arduino Sketches (20 points): At the end of the report, please append the text of all the Arduino sketches you have developed. To do this, simply cut the entire text from the Arduino IDE editor window and paste it in the report document. Start on a fresh page for each sketch. Video Demonstration (40 percent): In this section, your video demonstration should provide a visual record of the results obtained in each exercise. Please start with recording a brief video clip giving your name, course number, and assignment number. Record a video clip for each exercise according to the instructions provided. Use a video editor to combine all the clips into one video file before you submit/upload to the course website. For guidelines to record and merge video clips, check Record, Merge, and Upload Your Videos . Exercise 1: Toggling LEDs using IR remote Connect three LEDs (different colors) and the IR receiver to the UNO board. The purpose is to turn the LEDs on and off using keys on the remote. Select three keys on the remote that you would use to toggle the LEDs. Write an Arduino sketch to detect the keys and turn the corresponding LED on or off when the key is pressed. The sketch should turn on all the LEDs in the setup part. In the loop part, it will simply look for the selected keys being pressed and change the state of the corresponding LED. This implies that you will need to store the present current of each LED in a variable. The video clip for this exercise should show the wiring of the experiment and the use of the remote to toggle the three LEDs. Exercise 2: Using a potentiometer to control the servo Attach the small (one-sided) arm to the servo. Connect the servo and a potentiometer to the UNO board as shown in the example. Use the potentiometer to position the servo. The video clip for this exercise should show the wiring of the experiment and the changing position of the servo arm with the setting of the potentiometer.
Exercise 3: Controlling the speed of a stepper motor Modify the test program to let the stepper motor run continuously in the clockwise direction at about 10 RPM. This means that one full rotation should take about 6 seconds. The motion should take place at a constant speed which would require that the delay in each step is the same. Experiment Report: Arduino Uno Control Experiments Objective The overarching objective of these experiments was to explore various control mechanisms using an Arduino Uno board, encompassing IR remote control for LEDs, potentiometer-driven servo motor control, and stepper motor speed regulation. The experiments aimed to showcase interfacing capabilities, remote-controlled functionalities, and motor control mechanisms within the Arduino ecosystem. Exercise 1: Toggling LEDs using IR Remote Objective To control three LEDs through an IR remote, toggling their states (ON/OFF) using specific keys on the remote. Procedure Connected three LEDs to digital pins and an IR receiver to another pin on the Arduino Uno. The code initialized the IR receiver, set LED pins as outputs, and toggled LED states based on received IR signals. Discussion/Conclusion Insights into IR communication and remote-based control systems were gained. Challenges involved IR code interpretation and verification, resolved through meticulous code validation and hardware verification. SKETCH: include <IRremote.h> // Define the pins for LEDs const int redLedPin = 9 ; const int greenLedPin = 10 ; const int blueLedPin = 11 ; // Define the pin for the IR receiver
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
const int receiverPin = 12 ; // Define IR receiver object IRrecv irrecv ( receiverPin ) ; decode_results results; // Variables to store LED states bool redLedState = HIGH; // Assume initially LEDs are off bool greenLedState = HIGH; bool blueLedState = HIGH; // Replace these with the actual IR codes from your remote #define RED_CODE 0x FF30CF #define GREEN_CODE 0x FF18E7 #define BLUE_CODE 0x FF7A85 void setup () { Serial . begin ( 9600 ) ; // Initialize Serial communication irrecv . enableIRIn () ; // Initialize IR receiver // Set LED pins as outputs pinMode ( redLedPin, OUTPUT ) ; pinMode ( greenLedPin, OUTPUT ) ; pinMode ( blueLedPin, OUTPUT ) ; // Turn on all LEDs initially digitalWrite ( redLedPin, redLedState ) ; digitalWrite ( greenLedPin, greenLedState ) ; digitalWrite ( blueLedPin, blueLedState ) ; } void loop () { if ( irrecv . decode ( &results )) { unsigned long receivedCode = results . value ; // Get the received IR code Serial . println ( receivedCode, HEX ) ; // Print received code (for debugging) // Change the state of LEDs based on the received IR code if ( receivedCode == RED_CODE ) { redLedState = !redLedState; digitalWrite ( redLedPin, redLedState ) ; } else if ( receivedCode == GREEN_CODE ) { greenLedState = !greenLedState; digitalWrite ( greenLedPin, greenLedState ) ;
} else if ( receivedCode == BLUE_CODE ) { blueLedState = !blueLedState; digitalWrite ( blueLedPin, blueLedState ) ; } irrecv . resume () ; // Receive the next IR signal } } Exercise 2: Using a Potentiometer to Control the Servo Motor Objective To manipulate the position of a servo motor using a potentiometer. Procedure Connected a servo motor and potentiometer to the Arduino Uno. Wrote code to read potentiometer values and adjust the servo motor's position accordingly. Discussion/Conclusion An understanding of servo motor control via analog input was obtained. Challenges centered around calibrating the potentiometer's range and mapping values, resolved through iterative adjustments in code and hardware setup.
Sketch: include <Servo.h> // Create a servo object Servo myServo; // Define the potentiometer pin const int potPin = A0; void setup () { // Attach the servo to pin 9 myServo . attach ( 9 ) ; } void loop () { // Read the value from the potentiometer int potValue = analogRead ( potPin ) ; // Map the potentiometer value (0-1023) to the servo range (0-180) int servoPos = map ( potValue, 0 , 1023 , 0 , 180 ) ; // Move the servo to the mapped position myServo . write ( servoPos ) ; // Add a delay to slow down the movement (optional) delay ( 120 ) ; }
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Exercise 3: Controlling the Speed of a Stepper Motor Objective To regulate a stepper motor's speed to approximately 10 RPM. Procedure Modified the stepper motor control code, adjusting delays between steps to achieve a consistent speed. Observed the stepper motor's rotation for speed verification. Discussion/Conclusion Successful control of stepper motor speed was achieved. Challenges included fine-tuning delay values for precise speed control, addressed through iterative adjustments and speed verification tests. Sketch: v #include < Stepper . h > // Define the number of steps per revolution const int stepsPerRevolution = 200 ; // Create a Stepper object Stepper myStepper ( stepsPerRevolution, 8 , 10 , 9 , 11 ) ; void setup () { // Set the speed for the stepper motor in RPM (revolutions per minute) myStepper . setSpeed ( 30 ) ; // Adjust this value to achieve approximately 10 RPM // To calculate delay between steps for 10 RPM // RPM = 10 // Time for one revolution = 60 seconds / RPM = 60 / 10 = 6 seconds // Number of steps in one revolution = stepsPerRevolution = 200 // Time for one step = Time for one revolution / Number of steps = 6 seconds / 200 = 30 milliseconds } void loop () { // Step one step in the clockwise direction myStepper . step ( 1 ) ; // Adjust the delay here if needed for smoother movement delay ( 30 ) ; // Set the delay to the calculated value for 10 RPM
} Overall Understanding The experiments provided a comprehensive understanding of interfacing various components with the Arduino Uno, ranging from IR remote control to servo and stepper motor manipulation. Challenges were met with iterative adjustments in code and hardware setup, enhancing proficiency in Arduino-based control systems.