EXPERIMENT 6: Advanced I/O Programming

Similar documents
MICROCONTROLLERS Stepper motor control with Sequential Logic Circuits

Embedded Systems Lab Lab 7 Stepper Motor Application

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

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

Experiment#6: Speaker Control

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

Laboratory Exercise 1 Microcontroller Board with Driver Board

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

Introduction to the ME2110 Kit. Controller Box Electro Mechanical Actuators & Sensors Pneumatics

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 11 Motor Control

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

Lab Exercise 9: Stepper and Servo Motors

School of Engineering Mechatronics Engineering Department. Experim. ment no. 1

ARDUINO BASED DC MOTOR SPEED CONTROL

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

The Torxis Linear Servo meets the following environmental conditions:

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

FRIDAY, 18 MAY 1.00 PM 4.00 PM. Where appropriate, you may use sketches to illustrate your answer.

WifiBotics. An Arduino Based Robotics Workshop

RFID ACCESS CONTROL. SRðAN LALE FACULTY OF ELECTRICAL ENGINEERING EASTERN SARAJEVO

1 Day Robot Building (MC40A + Aluminum Base) for Edubot 2.0

Programming PIC Microchips

Job Sheet 2 Servo Control

Microcontroller Based Electric Expansion Valve Controller for Air Conditioning System

DC-Motor Driver circuits

Introduction to MS150

Brushless 5 click. PID: MIKROE 3032 Weight: 25 g

ServoStep technology

Motor control using FPGA

THE IMPORTANCE OF PLANNING AND DRAWING IN DESIGN

Design and Development of an Innovative Advertisement Display with Flipping Mechanism

Introduction to Relays. ECE/CS 5780/6780: Embedded System Design. Various Relay Configurations. Types of Relays. Drawing of an EM Relay

AN Industrial Stepper Motor Driver. Application Note Abstract. Introduction. Stepper Motor Control Method

Interfacing to Analog World Sensor Interfacing

Laboratory Tutorial#1

Experiment (2) DC Motor Control (Direction and Speed)

Speed Rate Corrected Antenna Azimuth Axis Positioning System

LED Driver 5 click. PID: MIKROE 3297 Weight: 25 g

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

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor

Automobile Prototype Servo Control

DMC-8 (SKU#ROB )

The NMIH-0050 H-Bridge

Temperature controlling system using embedded equipment

Electronic Speed Controls and RC Motors

LINE MAZE SOLVING ROBOT

Sensors and Sensing Motors, Encoders and Motor Control

Built-in soft-start feature. Up-Slope and Down-Slope. Power-Up safe start feature. Motor will only start if pulse of 1.5ms is detected.

PLC BASED RAILWAY LEVEL CROSSING GATE CONTROL

III. MATERIAL AND COMPONENTS USED

DC motor control using arduino

EE 314 Spring 2003 Microprocessor Systems

MOBILE ROBOT LOCALIZATION with POSITION CONTROL

The Motor sketch. One Direction ON-OFF DC Motor

Microprocessors B Lab 4 Spring Motor Control Using Pulse Width Modulation (PWM)

Laboratory Seven Stepper Motor and Feedback Control

Stepper Motors in C. Unipolar (5 lead) stepper motorr. $1.95 from 100 steps per rotation. 24V / 160mA / 600 gm cm holding 160mA

VEX Robotics Platform and ROBOTC Software. Introduction

I. INTRODUCTION MAIN BLOCKS OF ROBOT

M-S Quad Driver X12.017

PREREQUISITES: MODULE 10: MICROCONTROLLERS II; MODULE 14: DISCRETE COMPONENTS. MODULE 13 (SENSORS) WOULD ALSO BE HELPFUL.

Stepper Motors and Control Part I - Unipolar Stepper Motor and Control (c) 1999 by Rustle Laidman, All Rights Reserved

Integrated Easy Servo

PID MOTOR CONTROLLER. Version 1.0. October Cytron Technologies Sdn. Bhd.

ies-2309 Integrated Easy Servo

Contents NUDRIVE ACCESSORY USER GUIDE

Sensors and Sensing Motors, Encoders and Motor Control

TB6612FNG Dual Motor Driver Carrier

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Directions for Wiring and Using The GEARS II (2) Channel Combination Controllers

DM8010 tm. Hardware Reference Manual. Document Revision B3 May 16, 2018

MicroToys Guide: Motors N. Pinckney April 2005

Available online Journal of Scientific and Engineering Research, 2018, 5(4): Research Article

HB-25 Motor Controller (#29144)

Introduction: Components used:

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

Jaguar speed controllers

Positioning drives DC motor, brushless Absolute multiturn position detection, Profibus-DP

Bill of Materials: PWM Stepper Motor Driver PART NO

Figure 1. Digilent DC Motor

Microprocessors A Lab 4 Fall Analog to Digital Conversion Using the PIC16F684 Microcontroller

Semiconductor 9/21/2015

PEAKTRONICS AMC-103 ADDITIONAL FEATURES. AC Motor Controller, 2A AMC-103 AMC-103A AMC-103B

Servo click. PID: MIKROE 3133 Weight: 32 g

Page 1. Relays. Poles and Throws. Relay Types. Common embedded system problem CS/ECE 6780/5780. Al Davis. Terminology used for switches

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

Application Information

Testing the hardware 7. Worksheet 1 - Driving the DC motor 8. Worksheet 2 - Driving the stepper motor 10. Worksheet 3 - Driving the servo motor 12

Introduction to PLC and Ladder Logic Programming

Stepper motor basics

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

Lab 5: Inverted Pendulum PID Control

Learning Objectives. References 10/26/11. Using servos with an Arduino. EAS 199A Fall 2011

Controlling Stepper Motors Using the Power I/O Wildcard

ECE 511: MICROPROCESSORS

Using Servos with an Arduino

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

Advanced Mechatronics 1 st Mini Project. Remote Control Car. Jose Antonio De Gracia Gómez, Amartya Barua March, 25 th 2014

Galil Motion Control. DMC 3x01x. Datasheet

Transcription:

EXPERIMENT 6: Advanced I/O Programming Objectives: To familiarize students with DC Motor control and Stepper Motor Interfacing. To utilize MikroC and MPLAB for Input Output Interfacing and motor control. Introduction to DC Motor DC (Direct Current) brush motor is the most common and easy-to-control actuator which is usually used in many types of machines and automation systems. The main advantage of DC motor is that it can be operated by DC current, normally is from batteries. In many applications such as cars, ships, remote controlled racing cars or mobile robots where AC power supply is not available, DC operated components are preferred. In normal application, a DC brush motor is equipped with a set of gear to reduce the output speed of the motor and increase the torque at the same time. Controlling DC Motor Most of the DC motors can be controlled easily by providing the necessary voltage to it. To change the rotating direction of DC motor, simply reverse the polarity of the DC input. This changeover process can be achieved via a simple changeover switch (relay) or by using a suitable motor driver. In this training kit, motor driver L293D is employed to control the DC motor as the output pins of the microcontroller cannot directly drive a DC motor. Another advantage of DC motors is speed control of motor can be easily achieved by providing variable voltage to it. There are many methods to offer more precise control and maximum efficiency in controlling the speed. PWM (pulse width modulation) is among the popular alternative in DC motor speed control. Figure below shows the connection between DC motor and PIC. Figure 6.1 Interface between Motor Driver (L293D) and microcontroller. EEEB371 E4-1

Figure 6.2 Interfaces between Motor Driver (L293D) and DC Motor. From Figure 6.1, the two inputs (IN1 and IN2) to the motor driver are connected to PORTB, pin RB4 and RB5. The enable pin of the motor driver is connected to PWM pin (RC2). As long as the motor driver is enabled via pin RC2, the two inputs will produce the required outputs at pin MO1 and MO2. If IN1 is supplied with high logic, MO1 will produce high logic as the same applies to IN2 and MO2. Using these two inputs, we can easily control the direction of the DC motor. To rotate the DC motor clockwise, supply IN1 with low logic and IN2 with high logic. To rotate the DC motor anti-clockwise, supply IN1 with high logic and IN2 with low logic. By manipulating the input logic, we are actually changing the polarity of the DC input to the DC Motor and hence we are able to control the rotation of the DC Motor. Hardware Configuration For hardware configuration, put mini jumper on JP20 and JP21 to select DC motor and mini jumper on JP10 to select PWM. EEEB371 E4-2

Introduction to Stepper Motor A stepper motor is a brushless, synchronous electric motor that converts electrical pulses into mechanical movement. Every revolution of the stepper motor is divided into a discrete number of steps, and the motor must be sent a separate pulse for each step. The stepper motor can only take one step at a time and each step is the same size. Since each pulse causes the motor to rotate a precise angle, the motor s position can be controlled without any feedback mechanism. As the electrical pulses increase in frequency, the step movement changes into continuous rotation, with the speed of rotation directly proportional to the frequency of the pulses. Step motors are used every day in both industrial and commercial applications because of their low cost, high reliability, high torque at low speeds and a simple, rugged construction that operates in almost any environment. Unipolar Stepper Motor The unipolar stepper motor has five or six wires and four coils (actually two coils divided by center connections on each coil). The center connections of the coils are tied together and used as the power connection. They are called unipolar steppers because power always comes in on this one pole. Figure 6.3 Unipolar Stepper Motor Windings EEEB371 E4-3

Stepper Motor Interfacing with Microcontroller Stepper motors can be used in various areas of microcontroller projects such as making robots, robotic arm, automatic door lock system etc. Here, Full Step Interfacing Technique using L293D to control stepper motor will be described. In the full step sequence, two coils are energized at the same time and motor shaft rotates. The order in which coils has to be energized is given in the table below. Figure 6.4 Full Step Sequence In PTK40A, we use a motor driver L293D to drive the stepper motor. Figure 6.5 shows the schematic diagram to control stepper motor. Figure 6.5 Circuit connections for stepper motor. EEEB371 E4-4

The four inputs (A, B, C, D) to control the stepper motor are connected to pin RB4, RB5, RB6 and RB7 respectively. The motor driver enable pin is connected to pin RC2 and must be enabled at all times to control the stepper motor. By manipulating the inputs as illustrated in Figure 6.4, we will be able to control the step angle of the stepper motor. Stepper Motor Step Angle Step angle of the stepper motor is defined as the angle traversed by the motor in one step. To calculate step angle, simply divide 360 by number of steps a motor takes to complete one revolution. As in figure 6.4, Stepper Motor rotating in full mode sequence takes 24 steps to complete a revolution, So, step angle can be calculated as Step Angle ø = 360 / 24 = 15. One full sequence as in Figure 6.4 produces an angle of 30, so by repeating the sequence 12 times, we can achieve a full 360 rotation. So in this way we can calculate step angle for any stepper motor. Usually step angle is given in the spec sheet of the stepper motor you are using. Knowing stepper motor s step angle helps you calibrate the rotation of motor also to helps you move the motor to correct angular position. Hardware Configuration For hardware configuration, set mini jumper to stepper motor at JP20 and JP21. Then put mini jumper JP24 to unipolar and JP23 to select bipolar. Another mini jumper used on JP10 to select PWM. EEEB371 E4-5

Procedure Part A: DC Motor Control 1. Write the source code in MikroC Compiler, build it and download the Hex file into the microcontroller and run the program. Print out the source file and write down your observation. //Put students ID No and Names here! void main() { ADCON1 = 0x0F; // Configure A/D for digital inputs CMCON = 0x07; // Configure comparators for digital input TRISB = 0x00; // Configure PORTB as output TRISC = 0x00; // Configure PORTC as output PORTC.F2 = 1; //Enable the motor driver while(1) // Endless loop { PORTB.F4 = 1; Delay_ms(5000); Delay_ms(2000); PORTB.F5 = 1; Delay_ms(5000); Delay_ms(2000); }//End of while(1) //Rotate motor //anti-clockwise //for 5 seconds //Stop //rotating motor //for 2 seconds //Rotate motor //clockwise // for 5 seconds // Stop // rotating motor // for 2 seconds }//End of void main() 2. Modify the program in MikroC to fulfill the following requirement: - when SW1 is pressed, the DC motor will rotate clockwise. - when SW2 is pressed, the DC motor will rotate anti-clockwise and - when SW3 is pressed, the DC motor will stop. Write down your observation and explain the changes which you have made to the program. Print out the source file. 3. Write the source code in procedure 1 in assembly language using MPLAB. Build it and download the Hex file into the microcontroller and run the program. Print out the ASM source file with proper comments. EEEB371 E4-6

PART B: Stepper Motor Control 4. Write the source code below in MikroC so that the stepper rotates a full 360 degree rotation. Print out the source file and write down your observation. //Put students ID No and Names here! void main() { int i = 0; ADCON1 = 0x0F; // Configure A/D for digital inputs CMCON = 0x07; // Configure comparators for digital input TRISB = 0x00; // Configure PORTB as output TRISC = 0x00; // Configure PORTC as output PORTC.F2 = 1; //Enable the motor driver while(i<12) // Loop for 12 times to achieve 360 rotation { PORTB.F4 = 1; PORTB.F6 = 0; PORTB.F7 = 1; Delay_ms(100); PORTB.F4 = 1; PORTB.F5 = 1; PORTB.F6 = 0; PORTB.F7 = 0; Delay_ms(100); PORTB.F5 = 1; PORTB.F6 = 1; PORTB.F7 = 0; Delay_ms(100); PORTB.F6 = 1; PORTB.F7 = 1; Delay_ms(100); i++; }//End of while(1) }//End of void main() 5. Modify the program in MikroC to achieve an angle of 60, 120 and 180. Write down your observation and explain the changes which you have made to the program. Print out the source file. 6. Write the source code in procedure 4 in assembly language using MPLAB. Build it and download the Hex file into the microcontroller and run the program. Print out the LST file. Don t forget to include student s ID No and Names in the ASM file. EEEB371 E4-7

7. Turn off the PTK40A power supply, rearrange the USB cable back into the Training Kit. Exit from MikroC, MPLAB and PICKit 2 programmer. Shutdown your PC and rearrange your workstation before you leave. EEEB371 E4-8