Intro to Robot Movement Topics: DC motors Servos Line following.

Slides:



Advertisements
Similar presentations
Sensing and Control.
Advertisements

EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Proportional, Integral, Derivative Line Following October 5, 2013.
Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
Add and Use a Sensor & Autonomous For FIRST Robotics
Encoders, Motors, Power, Mini Project #1 10/24/2014.
Servos The material presented is taken from a variety of sources including:
Servos The material presented is taken from a variety of sources including:
L.
Living with the Lab Using servos with an Arduino EAS 199A Fall 2011.
Solar Tracking Project Team Members: –Cristian Ruvalcaba –Ken Seal –David Clark –Mark McKinley –Richard DeJarnatt.
Secret Door Knock Detector
SENIOR DESIGN 10/16.
Introduction.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Embedded Programming and Robotics
1 Servo Motor. 2 Overview A servo motor is a motor that is only capable of rotating 180 degrees A servo motor is controlled by giving it an angle to proceed.
Applied Control Systems Robotics & Robotic Control
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
Sensors Material taken from Robotics with the Boe-Bot.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
10/10/ Controlling YOUR ROBOT. 10/10/2015 Basic Stamp  Basic Stamp Input - output pins Interpreter Chip Power supply: 5 Volts voltage Memory: EEPROM.
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi. Objectives 1. Control the rotation of standard servo motor  A standard servo motor is limited in its rotation.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
Robot sensors MVRT 2010 – 2011 season. Analog versus Digital Analog Goes from 0 to 254 Numerous values Similar to making waves because there are not sudden.
Pulse Width Modulation (PWM). 100% Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control.
Using Hobby Servos with the Arduino living with the lab © 2012 David Hall.
Material taken from Robotics with the Boe-Bot
Servos The material presented is taken from a variety of sources including:
Microprocessors Tutorial 2: Arduino Robotics. Agenda 1. Robot Anatomy 2. Sensor Review 3. PWM 4. MAKE: Fade 5. Motors 6. H Bridge 7. Robot Control library.
Digital Electronics The Boe-Bot and Servo Motors.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Istituto Tecnico Industriale A.Monaco EURLAB Control a Servo Motor If you want to swing an robot arm or … steer a robot you need a special motor (Servo).
Limited rotation servo basics David Hall output shaft servo horn red wire = 5V + black wire = Gnd - white wire = control signal standard servo.
INTERNET OF EVERYTHING SDU 2016 Week 9. Physical Output  Make things move by controlling motors with Arduino  Servo-motors  Rotary actuator that allows.
The “Board of Education” 1 Three-position switch 0 = OFF 1 = ON / wheels OFF 2 = ON / wheels ON breadboard (for building circuits) electrical power (V.
Microcontroller basics Embedded systems for mortals.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Motors & Motor Controllers
Introduction to Motors, servos and steppers
Controlling Servos with the Arduino
CU ATLAS Practical electronics Motion and Servos
Microcontroller basics
If you want to swing an robot arm or …
Introduction to Servos
Using servos.
Microprocessors Tutorial 1: Arduino Basics
Servos The material presented is taken from a variety of sources including:
Arduino - Introduction
DC MOTOR SPEED CONTROL 1. Introduction
Control a motors angular position with a flex sensor
Servos The material presented is taken from a variety of sources including:
Servos The material presented is taken from a variety of sources including:
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Controlling YOUR ROBOT
Secret Door Knock Detector
Arduino : Introduction & Programming
Sensors and actuators Sensors Resistive sensors
frclabviewtutorials.com/workshop
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Arduinos
Servo Motor.
Presentation transcript:

Intro to Robot Movement Topics: DC motors Servos Line following

Many ways to move Focus on wheeled movement

Alternative drive-trains Demos Mecanum demo UNCA demo Mecanum wheel Omni wheel Image credit:

Making wheels move (using servos) Image credit:

Topic 1: DC Motor Electromagnetism: A changing magnetic field makes an electric field. A changing electric field makes a magnetic field. How it works Image credit:

Topic 2: Servos Servo motors can also be retrofitted to provide continuous rotation: – Remove mechanical limit (revert back to DC motor shaft). – Remove pot position sensor (no need to know position) and replace it with 2 equal-valued resistors with a combined resistance equivalent to that of the pot. Makes the servo “think” it is in the 90 deg position. Image credit: Not always necessary

Servo control An external controller (such as the Arduino) tells the servo where to go with a signal know as pulse proportional modulation (PPM) or pulse code modulation (which is often confused with pulse width modulation, PWM). PPM uses 1 to 2ms out of a 20ms time period to encode information. Image credit:

PPM Each pulse is from 1300 to 1700 microsec (μs) in duration The pulses repeat about 50 times each second---once every 20 millisec Image credit: 20 ms

Continuous rotation servo The amount of power applied to the motor is proportional to the distance to be traveled. If the shaft needs to turn a large distance, the motor runs at full speed. If it needs to turn a small amount, the motor runs at a slower speed. and speed

Analog vs digital servos Advantages: – Higher and more consistent torque throughout the servo travel – Constant holding power when stationary and less deadband – Faster control response - increased acceleration Disadvantages: – Higher costs – More power consumption Image credit:

Parallax Servo Connections Servo Connector: Black – ground Red – power White – signal Image credit:

Calibration Program #include Servo myServo; void setup() { myServo.attach(9); myServo.writeMicroseconds(1500); // Stop } void loop() { } The parallax servos are modified servos with the potentiometer intact. The potentiometer (a.k.a., pot) should be adjusted to make the servo think that it is at the 90 degree mark. Do that now. Servo library

In-Class Activity 1 Read and work activity 6 in Chapter 2 of Parallax’s Robotics with the Board of Education Shield for Arduino. The activity makes reference to the “BOE Shield,” a piece of hardware designed by Parallax to interface with the Arduino. The shield contains a breadboard as well as a few switches and connectors that we don’t have, but not to worry. The Arduino programs and the information about the Parallax servos are correct for our setup.6Robotics with the Board of Education Shield for Arduino Complete the assembly of your boe-bot chassis before beginning activity 6. The completed chassis should include both servos, the arduino, and the breadboard. For power, you can leave your robot tethered to the USB cable or use a battery pack.

Topic 3: Line Following Pololu QTR-8A Reflectance Sensor Array

QTI sensor  The QTI is a reflective object sensor. There’s an infrared LED behind its clear window and an infrared phototransistor behind its black window.  When the infrared light emitted by the LED reflects off a surface and returns to the black window, it strikes the infrared phototransistor’s base, causing it to conduct current.  The more infrared incident on the phototransistor’s base, the more current it conducts. Image credit: Connect to power Connect to ground Connect to digital pin

Using a sensor array Control the servos based on the sensor readings The more sensors the more accurate the control Image:

Line following with one sensor? try to follow the edge of the line Image credit:

Code (missing two functions) #include // Include servo library Servo servoLeft; Servo servoRight; // Declare left and right servo objects //Parameters int target = 210; // target sensor reading int maxSpeed = 100; // control forward speed void setup() { // initialization method Serial.begin(9600); servoLeft.attach(12); // Attach left signal to pin 13 servoRight.attach(3); // Attach right signal to pin 12 } void loop() { // main loop auto-repeats int light = (int) rcTime(9); // Read QTI sensor float error = light - target; // Difference between target &current reading int speedLeft, speedRight; // Declare speed variables if (error > 0.0) { // over only black? speedLeft = -maxSpeed; // Slow down left wheel speedRight = maxSpeed; // Full speed right wheel } else { // over only white? speedRight = -maxSpeed; // Slow down right wheel speedLeft = maxSpeed; // Full speed left wheel } maneuver(speedLeft, speedRight, 20); // Set wheel speeds }

rcTime() function // rcTime function measures decay at pin long rcTime(int pin) { pinMode(pin, OUTPUT); // Charge capacitor digitalWrite(pin, HIGH); //..by setting pin ouput-high delay(5); //..for 5 ms pinMode(pin, INPUT); // Set pin to input digitalWrite(pin, LOW); //..with no pullup long time = micros(); // Mark the time while(digitalRead(pin)); // Wait for voltage < threshold time = micros() - time; // Calculate decay time return time; // Returns decay time }

maneuver() function // maneuver function void maneuver(int speedLeft, int speedRight, int msTime) { servoLeft.writeMicroseconds( speedLeft); // Set left servo speed servoRight.writeMicroseconds( speedRight); // Set right servo speed if(msTime==-1) { // if msTime = -1 servoLeft.detach(); // Stop servo signals servoRight.detach(); } delay(msTime); // Delay for msTime }

Proportional line following In proportional line following the turn varies smoothly between two limits If the light sensor reading indicates close to the line then do a small turn If far from the line then do a big turn Proportional means there is a linear relationship between the sensor reading and robot movement Image credit:

Code: loop() only float kp = 0.5; void loop() { // main loop auto-repeats int light = (int)rcTime(9); float error = light - target; int speedLeft, speedRight; // Declare speed variables if (error > 0.0) { // on black only ? speedLeft = int(maxSpeed - (error * kp)); // proportion adjust speedLeft = constrain(speedLeft, -maxSpeed, maxSpeed); // scale left wheel speed speedRight = maxSpeed; // Full speed right wheel } else { // on white only ? speedRight = int(maxSpeed + (error * kp)); // proportion adjust speedRight = constrain(speedRight, -maxSpeed, maxSpeed); // scale right wheel speed speedLeft = maxSpeed; // Full speed left wheel } maneuver(speedLeft, speedRight, 20); // Set wheel speeds }

PID control K P, K I, and K D are tunable constants (i.e., weights) (K P e) proportional to the current error—the basis of the previous algorithm (K I ∫ e) —the integral is the running sum of the error – integral = integral + error*(dT) (K D de/dt) —the derivative is the change in the error between two consecutive sensor readings – derivative = ((the current error) - (the previous error)) /(dT) movement = Kp*(error) + Ki*(integral) + Kd*(derivative)

Code: part of loop() void loop() { // Main loop auto-repeats int light = (int)rcTime(9); // read sensor float error = light - target; // proportional term int delta = error - prevError; // derivative term integral = integral + error; // integral term prevError = error; float correction = (integralMemory * integral * ki) + (error * kp) + (delta * kd); int speedLeft, speedRight; // Declare speed variables if (correction > 0.0) { // over black only? speedLeft = int(maxSpeed - correction); speedLeft = constrain(speedLeft, -maxSpeed, maxSpeed); speedRight = maxSpeed; } else { // over white only? speedRight = int(maxSpeed + correction); speedRight = constrain(speedRight, -maxSpeed, maxSpeed); speedLeft = maxSpeed; } … Link to the full program

Two sensors? place them on either side of the line OR Image credit:

Two sensor proportional line following Image credit: Image credit: Control based on the difference between the sensors readings: Negate left sensor reading Sum the right and left sensor readings Move based on the difference

In-Class Activity 2 Create a two-sensor line-following robot and compete in the in-class competition. Members of the winning team will each receive 5 extra credit pts.