Sensors and Sensing Motors, Encoders and Motor Control

Similar documents
Sensors and Sensing Motors, Encoders and Motor Control

Lab Exercise 9: Stepper and Servo Motors

2.017 DESIGN OF ELECTROMECHANICAL ROBOTIC SYSTEMS Fall 2009 Lab 4: Motor Control. October 5, 2009 Dr. Harrison H. Chin

Assembly Language. Topic 14 Motion Control. Stepper and Servo Motors

MICROCONTROLLERS Stepper motor control with Sequential Logic Circuits

L E C T U R E R, E L E C T R I C A L A N D M I C R O E L E C T R O N I C E N G I N E E R I N G

Experiment Of Speed Control for an Electric Trishaw Based on PID Control Algorithm

CIS009-2, Mechatronics Signals & Motors

Sensors and Sensing Force, Torque, Tactile and Olfaction

Page ENSC387 - Introduction to Electro-Mechanical Sensors and Actuators: Simon Fraser University Engineering Science

Computer Numeric Control

DC motor control using arduino

Step vs. Servo Selecting the Best

Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-4: Electric Actuators

Robot Actuators. Motors and Control. Stepper Motor Basics. Increased Resolution. Stepper motors. DC motors AC motors. Physics review: Nature is lazy.

Sensors and Sensing Force, Torque, Tactile and Olfaction

Design of stepper motor position control system based on DSP. Guan Fang Liu a, Hua Wei Li b

ME375 Lab Project. Bradley Boane & Jeremy Bourque April 25, 2018

combine regular DC-motors with a gear-box and an encoder/potentiometer to form a position control loop can only assume a limited range of angular

Administrative Notes. DC Motors; Torque and Gearing; Encoders; Motor Control. Today. Early DC Motors. Friday 1pm: Communications lecture

Job Sheet 2 Servo Control


Basic NC and CNC. Dr. J. Ramkumar Professor, Department of Mechanical Engineering Micro machining Lab, I.I.T. Kanpur

6.270 Lecture. Control Systems

CSE 3215 Embedded Systems Laboratory Lab 5 Digital Control System

Draw the symbol and state the applications of : 1) Push button switch 2) 3) Solenoid valve 4) Limit switch ( 1m each) Ans: 1) Push Button

The Discussion of this exercise covers the following points: Angular position control block diagram and fundamentals. Power amplifier 0.

Introduction to BLDC Motor Control Using Freescale MCU. Tom Wang Segment Biz. Dev. Manager Avnet Electronics Marketing Asia

ServoStep technology

Feedback Devices. By John Mazurkiewicz. Baldor Electric

Control Strategies for BLDC Motor

7 Lab: Motor control for orientation and angular speed

UNIVERSITY OF JORDAN Mechatronics Engineering Department Measurements & Control Lab Experiment no.1 DC Servo Motor

EE152 Final Project Report

Laboratory Exercise 1 Microcontroller Board with Driver Board

Based on the ARM and PID Control Free Pendulum Balance System

EE 308 Spring Preparation for Final Lab Project Simple Motor Control. Motor Control

Technical Cognitive Systems

Latest Control Technology in Inverters and Servo Systems

DC Motor Speed Control using PID Controllers

Brushed DC Motor Microcontroller PWM Speed Control with Optical Encoder and H-Bridge

Design of double loop-locked system for brush-less DC motor based on DSP

MODEL BASED DESIGN OF PID CONTROLLER FOR BLDC MOTOR WITH IMPLEMENTATION OF EMBEDDED ARDUINO MEGA CONTROLLER

DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING BANGLADESH UNIVERSITY OF ENGINEERING & TECHNOLOGY EEE 402 : CONTROL SYSTEMS SESSIONAL

International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering. (An ISO 3297: 2007 Certified Organization)

Lab 5: Inverted Pendulum PID Control

Training Schedule. Robotic System Design using Arduino Platform

Lock Cracker S. Lust, E. Skjel, R. LeBlanc, C. Kim

DC Motor and Servo motor Control with ARM and Arduino. Created by:

PROPORTIONAL INTEGRAL &DERIVATIVE CONTROLLER FOR BLDC MOTOR

Position Sensors. The Potentiometer.

Embedded Systems Lab Lab 7 Stepper Motor Application

9/28/2010. Chapter , The McGraw-Hill Companies, Inc.

PYKC 7 March 2019 EA2.3 Electronics 2 Lecture 18-1

Micromouse Meeting #3 Lecture #2. Power Motors Encoders

ANGULAR POSITION CONTROL OF DC MOTOR USING SHORTEST PATH ALGORITHM

Comparative Study of PID and Fuzzy Controllers for Speed Control of DC Motor

Modeling, Simulation and Implementation of Speed Control of DC Motor Using PIC 16F877A

A Searching Analyses for Best PID Tuning Method for CNC Servo Drive

Application Note Using MagAlpha Devices to Replace Optical Encoders

Figure 1.1: Quanser Driving Simulator

Open Loop Speed Control of Brushless DC Motor

ADVANCED SAFETY APPLICATIONS FOR RAILWAY CROSSING

EasyMotion User s Manual Ver

Tektronix AFG10022 Function Generator. Coming soon to B10: Sin, Square, Ramp, Swept, Arbitrary, Noise. Linear Actuators. Non-magnetized iron plunger

BLuAC5 Brushless Universal Servo Amplifier

Engineering Reference

Upgrading from Stepper to Servo

Motor control using FPGA

Actuators. EECS461, Lecture 5, updated September 16,

Motion Control Glossary

Automatic Control Systems 2017 Spring Semester

Motomatic Servo Control

Lecture #19 Digital To Analog, PWM, Stepper Motors Embedded System Engineering Philip Koopman Monday, 28-March-2016

Using Magnetic Sensors for Absolute Position Detection and Feedback. Kevin Claycomb University of Evansville

Exercise 5: PWM and Control Theory

Controlling an AC Motor

SERVO MOTOR CONTROL TRAINER

Industrial Automation Training Academy. Arduino, LabVIEW & PLC Training Programs Duration: 6 Months (180 ~ 240 Hours)

BLuAC5 Brushless Universal Servo Amplifier

Teaching Mechanical Students to Build and Analyze Motor Controllers

IT.MLD900 SENSORS AND TRANSDUCERS TRAINER. Signal Conditioning

MAE106 Laboratory Exercises Lab # 5 - PD Control of DC motor position

Simulation of Solar Powered PMBLDC Motor Drive

Figure 1: Unity Feedback System. The transfer function of the PID controller looks like the following:

A COMPARISON STUDY OF THE COMMUTATION METHODS FOR THE THREE-PHASE PERMANENT MAGNET BRUSHLESS DC MOTOR

SPEED CONTROL OF BRUSHLESS DC MOTOR USING FUZZY BASED CONTROLLERS

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 11 Motor Control

Microcontroller Based Closed Loop Speed and Position Control of DC Motor

DMCode-MS(BL) MATLAB Library

CHAPTER 2 PID CONTROLLER BASED CLOSED LOOP CONTROL OF DC DRIVE

Free Programmable Signal Processing inside a High Performance Servo Amplifier

Software Operational Manual

Effective Teaching Learning Process for PID Controller Based on Experimental Setup with LabVIEW

XC4e PWM Digital Drive

PART 2 - ACTUATORS. 6.0 Stepper Motors. 6.1 Principle of Operation

Sfwr Eng/TRON 3DX4, Lab 4 Introduction to Computer Based Control

Feed-back loop. open-loop. closed-loop

Rotary Motion Servo Plant: SRV02. Rotary Experiment #02: Position Control. SRV02 Position Control using QuaRC. Student Manual

Time Response Analysis of a DC Motor Speed Control with PI and Fuzzy Logic Using LAB View Compact RIO

Transcription:

Sensors and Sensing Motors, Encoders and Motor Control Todor Stoyanov Mobile Robotics and Olfaction Lab Center for Applied Autonomous Sensor Systems Örebro University, Sweden todor.stoyanov@oru.se 13.11.2014 T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 1 / 22

Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 2 / 22

Motors Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 2 / 22

Motors Motor Basics A motor is a device which transforms input energy into kinetic energy. Input energy could be chemical (e.g. gasoline engine), but we are interested in electro-magnetic motors. First electric motors were invented in the 19th century. Hungarian physicist Ányos Jedlik demonstrated the first electric motor. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 2 / 22

Motors Motor Basics A motor is a device which transforms input energy into kinetic energy. Input energy could be chemical (e.g. gasoline engine), but we are interested in electro-magnetic motors. First electric motors were invented in the 19th century. Hungarian physicist Ányos Jedlik demonstrated the first electric motor. Figure: Image source: wikipedia T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 2 / 22

Motors Brush Motors Brush motors were the predominant type of motor until the 1960s. The design includes three key components: the stator, the rotor and the commutator. Stator is typically implemented as a permanent magnet. Rotors are coils which act as magnets when electricity flows through them. The commutator is a mechanical device used for switching the direction of electric current. S + - N T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 3 / 22

Motors Brush Motors Brush motors were the predominant type of motor until the 1960s. The design includes three key components: the stator, the rotor and the commutator. Stator is typically implemented as a permanent magnet. Rotors are coils which act as magnets when electricity flows through them. The commutator is a mechanical device used for switching the direction of electric current. S + - N T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 3 / 22

Motors Brush Motors Brush motors were the predominant type of motor until the 1960s. The design includes three key components: the stator, the rotor and the commutator. Stator is typically implemented as a permanent magnet. Rotors are coils which act as magnets when electricity flows through them. The commutator is a mechanical device used for switching the direction of electric current. S + - N T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 3 / 22

Motors Brushless Motors Brush motors have a major disadvantage: the mechanical components wear off and generate sparks. Digital logic circuits invented in the 60s allowed for brushless commutator designs. Typical brushless motors use a smaller and lighter permanent magnet, suspended in a magnetic field generated by static coils. The commutator is typically implemented using semiconductor elements. switch logic + - T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 4 / 22

Motors Brushless Motors Brush motors have a major disadvantage: the mechanical components wear off and generate sparks. Digital logic circuits invented in the 60s allowed for brushless commutator designs. Typical brushless motors use a smaller and lighter permanent magnet, suspended in a magnetic field generated by static coils. The commutator is typically implemented using semiconductor elements. switch logic + - T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 4 / 22

Motors Brushless Motors Brush motors have a major disadvantage: the mechanical components wear off and generate sparks. Digital logic circuits invented in the 60s allowed for brushless commutator designs. Typical brushless motors use a smaller and lighter permanent magnet, suspended in a magnetic field generated by static coils. The commutator is typically implemented using semiconductor elements. switch logic + - T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 4 / 22

Motors Stepper Motors and Servos Motors in robotics and automation applications often have to be actuated to achieve particular rotational increments. Most popular designs for this application are stepper motors and servos. Stepper motors are brushless motors with a cogwheel-like tooth design. By using a higher number of stators, stepper motors can be commanded to actuate one tooth at a time and can achieve and hold desired number of rotational ticks. Servos are typically implemented as a brushless motor, coupled with a rotary encoder and a microcontroller. We will discuss servos more in the lab. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 5 / 22

Motors Stepper Motors and Servos Motors in robotics and automation applications often have to be actuated to achieve particular rotational increments. Most popular designs for this application are stepper motors and servos. Stepper motors are brushless motors with a cogwheel-like tooth design. By using a higher number of stators, stepper motors can be commanded to actuate one tooth at a time and can achieve and hold desired number of rotational ticks. Servos are typically implemented as a brushless motor, coupled with a rotary encoder and a microcontroller. We will discuss servos more in the lab. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 5 / 22

Motors Stepper Motors and Servos Motors in robotics and automation applications often have to be actuated to achieve particular rotational increments. Most popular designs for this application are stepper motors and servos. Stepper motors are brushless motors with a cogwheel-like tooth design. By using a higher number of stators, stepper motors can be commanded to actuate one tooth at a time and can achieve and hold desired number of rotational ticks. Servos are typically implemented as a brushless motor, coupled with a rotary encoder and a microcontroller. We will discuss servos more in the lab. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 5 / 22

Motors Actuating Motors: Pulse Width Modulation DC motors are actuated with a fixed input voltage. In order to move slower or faster, we could change the set input voltage (between 0 and V max ) In digital circuits it is typically easier to use pulse width modulation to achieve control values. Wider pulses integrate to larger area under the curve and longer duty cycles. This is also safer for the motor. 30% 50% T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 6 / 22

Motors Motor Data Sheets Parameters of motors to check when designing your application: Operating voltage Maximum load current Maximum short-term current Maximum torque Maximum rpm Gear ratio T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 7 / 22

Encoders Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 8 / 22

Encoders Encoder Basics The rotary encoder is one of the basic sensors in robotics A rotary encoder is typically mounted on a motor shaft or gear output shaft and used to count the numbers (and fractions) of rotation. Encoder output is typically used as feedback for motor control in servo systems. Wheel encoder readings are used in vehicle kinematic models to deduce the relative position and orientation of mobile robots (odometry). T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 8 / 22

Encoders Potentiometers A potentiometer consists of a resistor and a movable contact element. When the contact element moves, it divides the resistor in to two resistance elements R 1 and R 2. The terminals are connected over a load resistor R L and the voltage over R L is calculated as V L = R 1 R 1 +R 2 V in This is a typical voltage divider circuit. Knowing V in and R 1 + R 2, we can deduce the position of the contact element from the measured voltage V L. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 9 / 22

Encoders Optical Encoders: Incremental Potentiometers don t allow for continuous rotation. Optical encoders can provide continuous rotation measurements using light sensitive elements and an encoded disk. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 10 / 22

Encoders Optical Encoders: Incremental Incremental optical encoders use one disk with equally spaced black lines to generate multiple signal pulses. A second disk is added at a 90 o phase offset to add for direction variance. light source detector light source detector T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 10 / 22

Encoders Optical Encoders: Incremental Incremental optical encoders use one disk with equally spaced black lines to generate multiple signal pulses. A second disk is added at a 90 o phase offset to add for direction variance. light source detector light source detector A B T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 10 / 22

Encoders Optical Encoders: Incremental Incremental optical encoders use one disk with equally spaced black lines to generate multiple signal pulses. A second disk is added at a 90 o phase offset to add for direction variance. light source detector light source detector A B T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 10 / 22

Encoders Optical Encoders: Absolute Absolute encoders solve the problem of initialization errors in incremental encoders. Each tick of the encoder has a unique optical bit word. With gray codes neighboring words have only 1 different bit, adding robustness to measurement error. 10100000 T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 11 / 22

Encoders Optical Encoders: Absolute Absolute encoders solve the problem of initialization errors in incremental encoders. Each tick of the encoder has a unique optical bit word. With gray codes neighboring words have only 1 different bit, adding robustness to measurement error. 01100000 10100000 T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 11 / 22

Encoders Optical Encoders: Absolute Absolute encoders solve the problem of initialization errors in incremental encoders. Each tick of the encoder has a unique optical bit word. With gray codes neighboring words have only 1 different bit, adding robustness to measurement error. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 11 / 22

Encoders Magnetic Encoders Sensors based on magnetic field strength can also be used to implement rotary encoders. Typical magnetic encoders use the Hall effect which produces voltage potential proportional to the proximity of a magnet. A small disc permanent magnet is fixed on the rotating shaft, while four hall sensors provide 360 degree sensitivity. + - T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 12 / 22

Encoders Magnetic Encoders Sensors based on magnetic field strength can also be used to implement rotary encoders. Typical magnetic encoders use the Hall effect which produces voltage potential proportional to the proximity of a magnet. A small disc permanent magnet is fixed on the rotating shaft, while four hall sensors provide 360 degree sensitivity. + + - + - + + - + + - - - Hall voltage + - T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 12 / 22

Encoders Magnetic Encoders Sensors based on magnetic field strength can also be used to implement rotary encoders. Typical magnetic encoders use the Hall effect which produces voltage potential proportional to the proximity of a magnet. A small disc permanent magnet is fixed on the rotating shaft, while four hall sensors provide 360 degree sensitivity. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 12 / 22

Encoders Interfacing Encoders Encoders are often packaged with their own microcontrollers for low-level logic. Reading encoder measurements from those is device-dependent and follows manufacturer-defined protocols. Occasionally, you may need to read encoder ticks directly in your microcontroller code. The encoder square waves are often tied to interrupts on the microprocessor. Once an interrupt is triggered, you may need to check other input pins to determine direction of the wave, before updating encoder positions incrementally. You will get some practical experience with this in the lab. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 13 / 22

Motor Control Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 14 / 22

Motor Control Open-loop Motor Actuation Open loop control is generally a very bad idea in precision applications It may however make sense if you just need to move for a pre-defined time at a pre-defined rate: just set the motor duty cycle to a specific value and hope for the best Motor control however implies you need to have some more sophisticated feedback: usually in terms of encoder ticks, but also load current, force or torque sensors. The most common control framework for simple motor control is the PID controller. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 14 / 22

Motor Control control action measured signal PID Control The Proportional Integral Derivative (PID) control framework scales control outputs in accordance with the error, it s derivative and integral. Motor model predicted setpoint error Given a function, which generates set point values r(t), the objective of the controller is to produce control actions u(t), such that the error e(t) = y(t) r(t) is minimized. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 15 / 22

Motor Control PID Control Proportional term: The proportional term applies a control, directly proportional to the current error e(t) The control action is then u(t) = K p e(t) Pure P-control suffers from overshoots and oscillations around the steady state, as well Amplitude 1.4 1.2 1 0.8 0.6 0.4 0.2 Step Response Kp=100 Kp=200 Kp=400 0 as steady state errors. 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (seconds) T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 15 / 22

Motor Control PID Control Derivative term: The derivative term applies controls, proportional to the derivative of the error. The derivative control action is then u(t) = K d d dt e(t). Derivative terms dampen oscillations and act to smoothen the system behavior. Typically, used in combination with a P-term. Amplitude 1.4 1.2 1 0.8 0.6 0.4 0.2 Step Response Kd=10 Kd=20 Kd=40 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (seconds) T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 15 / 22

Motor Control PID Control Integral term: The integral term applies a control, proportional to the sum of all previous errors. The integral control action is then u(t) = K i t 0 e(t)dt. Integral terms decrease the steady state error, as they accumulate even small errors over time to generate high enough controls. Typically used in combination with a P-term. Amplitude 1.5 1 0.5 Step Response Ki=100 Ki=200 Ki=400 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (seconds) T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 15 / 22

Motor Control PID Control Step Response 1 Kp=400, Ki=500, Kd=40 0.9 0.8 0.7 Amplitude 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 Time (seconds) The full PID equation is then: u(t) = K p e(t) + K i t 0 d e(t)dt + K d e(t) (1) dt T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 15 / 22

Motor Control Tuning of PID Gains Parameter Rise time Overshoot Settling time Steady-state error K p Decrease Increase Small change Decrease K i Decrease Increase Increase Eliminate K d Small change Decrease Decrease No effect Start by tuning K p. Increase until you see steady state oscillations. Add a K d term to decrease overshoot. If there is a steady state error, add a small K i to eliminate it. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 16 / 22

Motor Control Common Modes of Motor Control Position control: use an encoder after the gears to feedback the position for control. Velocity control: use the first time derivative of the encoder position as a control variable. Current control: use the electrical current absorption for control. Force/Torque control: couple the motor with a force or torque sensor and use the output in control space. Common mode for achieving compliance. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 17 / 22

Embedded Control Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 18 / 22

Embedded Control Microcontrollers Control of actuators is usually implemented on dedicated embedded devices. A microcontroller is essentially a single integrated circuit that provides a processor core, a memory array and input/output operations. Microcontrolers packaged on a printed circuit board with additional ICs and dedicated programming environments are often used used for convenience. Figure: Arduino Due microcontroller board T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 18 / 22

Embedded Control Digital I/O Microcontroller boards like the Arduino have a number of PINs that can be configured for input or output operations Pins for digital I/O can read/write logic values - high or low High values represent a fixed voltage potential relative to the digital ground Low values have zero potential relative to ground When using digital I/O the logic ground for target devices has to be set to the ground terminal of the board. Example applications: reading in binary streams from sensors, detecting switches T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 19 / 22

Embedded Control Analogue I/O Analogue input pins can be configured to measure voltage potentials relative to ground level. Analogue output pins produce a pulse-width modulated (PWM) square wave signal. Depending on the board, the PWM duty cycle and/or the frequency can be modified. Example applications: measuring values from a current sensor, driving a motor. 30% 50% T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 20 / 22

Embedded Control Programming Tips Programming for embedded devices can be tricky. Code needs to be cross-compiled for the controller and then uploaded to the on-board flash memory. Debugging can be difficult as outputs come on the serial port and programs cannot be paused. A useful tool for real-time processing are interrupts, which can trigger code pieces when the states of I/O pins change. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 21 / 22

Practice: Arduino Outline 1 Motors 2 Encoders 3 Motor Control 4 Embedded Control 5 Practice: Arduino T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 22 / 22

Practice: Arduino Practice Session Task For this task we will do some basic Arduino programming. Setup the arduino environment and try out the Blink sketch. You can follow the instructions from the Lab exercise for this part. Download the data sheet for the ELS-505GWA display. Your task is to make a countdown timer, which displays numbers from 9 down to 0, changing every second. T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 22 / 22

Practice: Arduino Sensors and Sensing Motors, Encoders and Motor Control Todor Stoyanov Mobile Robotics and Olfaction Lab Center for Applied Autonomous Sensor Systems Örebro University, Sweden todor.stoyanov@oru.se 13.11.2014 T. Stoyanov (MRO Lab, AASS) Sensors & Sensing 13.11.2014 22 / 22