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

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

Module: Arduino as Signal Generator

Direct Current Waveforms

Sensors and Sensing Motors, Encoders and Motor Control

Multipurpose Iron Man Glove & Moveable Platform

DC motor control using arduino

Lab 4 Rev. 1 Open Lab Due COB Friday April 6, 2018

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

LEDs and Sensors Part 2: Analog to Digital

System Board 6219 MAXREFDES89#: MAX14871 Full-Bridge DC Motor Driver MBED Shield

Sensors and Sensing Motors, Encoders and Motor Control

ARDUINO BASED DC MOTOR SPEED CONTROL

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

ILR #1: Sensors and Motor Control Lab. Zihao (Theo) Zhang- Team A October 14, 2016 Teammates: Amit Agarwal, Harry Golash, Yihao Qian, Menghan Zhang

o What happens if S1 and S2 or S3 and S4 are closed simultaneously? o Perform Motor Control, H-Bridges LAB 2 H-Bridges with SPST Switches

Lesson 3: Arduino. Goals

Training Schedule. Robotic System Design using Arduino Platform

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

100UF CAPACITOR POTENTIOMETER SERVO MOTOR MOTOR ARM. MALE HEADER PIN (3 pins) INGREDIENTS

P15051: Robotic Eye for Eye Tracker

SPEED CONTROL OF INDUCTION MOTOR WITHOUT SPEED SENSOR AT LOW SPEED OPERATIONS

Castle Creations, INC.

Job Sheet 2 Servo Control

Robotic Navigation Distance Control Platform

INTRODUCTION OF SOME APPROACHES FOR EDUCATIONS OF ROBOT DESIGN AND MANUFACTURING

I. INTRODUCTION MAIN BLOCKS OF ROBOT

Rodni What will yours be?

ISSN: [Singh* et al., 6(6): June, 2017] Impact Factor: 4.116

FABO ACADEMY X ELECTRONIC DESIGN

Brushed DC Motor Control. Module with CAN (MDL-BDC24)

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

Digital-to-Analog Converter. Lab 3 Final Report

Micromouse Meeting #3 Lecture #2. Power Motors Encoders

Electronics. RC Filter, DC Supply, and 555

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

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

Using Servos with an Arduino

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

Design of a Microcontroller-Based Push-Pull Inverter with Automatic Voltage Regulator

Microcontroller Based Closed Loop Speed and Position Control of DC Motor

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

Bill of Materials: PWM Stepper Motor Driver PART NO

Real Time Implementation of Power Electronics System

Implementation of a Fuzzy Logic-Based Embedded System for Engine RPM Control. (Speed Control)

Arduino Setup & Flexing the ExBow

MOBILE ROBOT LOCALIZATION with POSITION CONTROL

roject work presentation

DigiSpeed-GX DC-03. Isolated Control Voltage Generator User s Guide. DigiSpeed-GX PCB Ver:2.0 Firmware Ver: 1.0 Mach3 Ver: 1.84

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

Internet of Things Student STEM Project Jackson High School. Lesson 3: Arduino Solar Tracker

CHAPTER-5 DESIGN OF DIRECT TORQUE CONTROLLED INDUCTION MOTOR DRIVE

LINE MAZE SOLVING ROBOT

DeviceCraft Revision #1 11/29/2010

Jaguar Motor Controller (Stellaris Brushed DC Motor Control Module with CAN)

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Laboratory set-up for Real-Time study of Electric Drives with Integrated Interfaces for Test and Measurement

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

ARDUINO / GENUINO. start as professional. short course in a book. faculty of engineering technology

Laboration: Frequency measurements and PWM DC motor. Embedded Electronics IE1206

Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

EEL4914 Senior Design. Final Design Report

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

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 11 Motor Control

3-Degrees of Freedom Robotic ARM Controller for Various Applications

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

Digital Electronics Course Objectives

LAB 1 AN EXAMPLE MECHATRONIC SYSTEM: THE FURBY

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

Development of a MATLAB Data Acquisition and Control Toolbox for BASIC Stamp Microcontrollers

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

Motors and Servos Part 2: DC Motors

Demon Pumpkin APPROXIMATE TIME (EXCLUDING PREPARATION WORK): 1 HOUR PREREQUISITES: PART LIST:

Monitoring Temperature using LM35 and Arduino UNO

Total Hours Registration through Website or for further details please visit (Refer Upcoming Events Section)

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

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

Citrus Circuits Fall Workshop Series. Roborio and Sensors. Paul Ngo and Ellie Hass

Sensors and Motor Control Lab Individual lab report #1 October 16, 2015

DigiSpeed DC-03. Isolated Control Voltage Generator User s Guide. PCB: DC-03 V3.0 Firmware: Ver: 3.0 Mach3: Ver: 1.84

Validation Document. ELEC 491 Capstone Proposal - Dynamic Projector Mount Project. Andy Kwan Smaran Karimbil Siamak Rahmanian Dante Ye

UTILIZATION OF ROBOTICS AS CONTEMPORARY TECHNOLOGY AND AN EFFECTIVE TOOL IN TEACHING COMPUTER PROGRAMMING

Teaching Mechanical Students to Build and Analyze Motor Controllers

Designing with a Microcontroller (v6)

LDOR: Laser Directed Object Retrieving Robot. Final Report

PWM CONTROL USING ARDUINO. Learn to Control DC Motor Speed and LED Brightness

Design and Implementation of AT Mega 328 microcontroller based firing control for a tri-phase thyristor control rectifier

Six-degree-of-freedom robot design

Breadboard Traffic Light System

SERVO MOTOR CONTROL TRAINER

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

ARDUINO / GENUINO. start as professional

LED + Servo 2 devices, 1 Arduino

GE 320: Introduction to Control Systems

ME 461 Laboratory #5 Characterization and Control of PMDC Motors

Part 1: Determining the Sensors and Feedback Mechanism

International Journal of Advance Engineering and Research Development

MDM5253 DC Motor Driver Module with Position and Current Feedback User Manual

Adafruit 16-channel PWM/Servo Shield

Experiment 9 : Pulse Width Modulation

UNIVERSAL INPUT RESISTANCE OUTPUT

Transcription:

DC Motor and Servo motor Control with ARM and Arduino Created by: Andrew Kaler (39345) Tucker Boyd (46434) Mohammed Chowdhury (860822) Tazwar Muttaqi (901700) Mark Murdock (98071) May 4th, 2017

Objective (written by Tucker Boyd) The goal of this semester project was to create a system that uses embedded processors and pulse width modulation (PWM) to control a DC and servo motor. To create this project the following materials were needed: ARM Cortex-M4 Microprocessor Arduino Uno Microprocessor Micro Servo Motor 12V DC Motor Switch Breadboard L298N H-bridge 9V battery Potentiometer Oscilloscope To control either motor, an analog signal will be generated when the shaft of the potentiometer is rotated. That analog signal will determine the duty cycle of a PWM wave generated by either the ARM or the Arduino. If the switch is in position 0, then the PWM of the ARM processor will control the speed of the DC motor. If the switch is in position 1, then the PWM of the Arduino will control the position of the servo motor. In either of these cases, rotating the shaft of the potentiometer will control whichever motor is enabled by the switch. The oscilloscope will be used to verify the PWM signal going to either motors.

Procedure (written by Andrew Kaler) The main steps of this project included both designing the circuit and the code for the processors. To simply focus on either the circuit design or coding was extremely impractical as the designs for both were interdependent on each other. Consequently, there was much collaboration between those responsible for coding and those responsible for circuit design. The results of this collaboration resulted in the following circuit design (Figures 1 and 2) and code for the ARM and Arduino (Figure 3): Figure 1: The physical circuit, including all of the components outlined in the Objectives section (the oscilloscope probes are currently connected in the circuit)

Figure 2: A diagram showing the connections of the physical circuit (Provided by Tazwar)

Figure 3: Code for both the Arduino and ARM mbed. Figure 1 represents the physical circuit actually created, and Figure 2 shows a symbolic depiction of our circuit mainly displaying the connections between the different components. The logic behind the connections of the processors are only apparent when examining Figure 3. As seen in Figure 3, the code compiled on the ARM mbed gave a certain set of inputs and outputs: a PWM output on pin 26 labeled dc, an output on LED1 on the mbed ARM labeled led1, an output on LED2 on the mbed ARM labeled led2, a digital output on pin 28 labeled ins, an analog input on pin 19 labeled pot, and a digital input on pin 20 labeled sw. The code compiled on the Arduino also creates certain inputs and outputs: pin 8 is a designated digital input, A0 is an analogue input, and pin 9 is a designated PWM output wave. When analyzing Figures 1, 2, and 3, the correlation between the circuit and software design becomes evident.

Results (written by Andrew Kaler) In order to control the DC motor, pin 20 on the mbed ARM should not receive a logic high (correlating to position 0 on the switch). If this is the case, then manipulation of the potentiometer controls the DC motor and the brightness of LED1 on the ARM mbed platform (LED2 of the ARM mbed will be off). The potentiometer is connected in our circuit with three terminals: one connected to the 5V output on the H-bridge (pin 6, explained later), one connected to ground, and one connected to pin 19 on the mbed ARM (these are done through common nodes on the breadboard, not direct connections). The potentiometer connection between pin 19 and pin 6 of the H-bridge establishes a voltage divider circuit. By rotating the potentiometer, the resistance of the potentiometer changes and consequently changes the amount of voltage pin 19 receives of the mbed ARM. This value of voltage read into pin 19 will translate to a relative duty cycle of a PWM wave generated from pin 26. For example, twisting the potentiometer fully one way will give a 100% duty cycle, and twisting it fully the other way will give a 0% duty cycle. These two extremes are depicted in Figures 4 and 5 respectively, and Figure 6 shows a PWM with approximately a 50% duty cycle. Figure 4: PWM wave generated by ARM as shown on the oscilloscope. The PWM wave is set to approximately 100% duty cycle.

Figure 5: PWM wave generated by ARM as shown on the oscilloscope. The PWM wave is approximately set to a 0% duty cycle. Figure 6: PWM wave generated by ARM as shown on the oscilloscope. The PWM wave is approximately set to a 50% duty cycle.

This PWM wave is then input to the H-bridge before it reaches the DC motor. There are 7 pins that are used on the H-bridge. Figure 7 outlines the pins on the L298N H-bridge used (note the picture in Figure 7 is a red color, but it is the same chip as the blue version in our circuit in Figure 1): Figure 7: Pins of the L298N H-bridge used for control of the DC motor. Pin 9 of the H-bridge is for the input of the PWM wave from the mbed ARM. Pins 8 and 5 are attached to ground, pin 4 is the 9V input voltage from the Batteries, pin 6 is a 5V output voltage regulator (if pin 4 has between 7V-12V, this feature is available), and pins 1 and 2 connect to the positive and negative terminals of the DC motor respectively. This integrated circuit takes the PWM wave and enables the supply voltage to reach the terminals of the DC motor when the PWM wave is a logic high. For example, when the duty cycle of the PWM is 100% then 9V will supply the motor, and when the duty cycle is 0%, then 0V will supply the motor. Basically, whatever percentage of duty cycle the PWM wave is, this will be the percentage of 9V that is supplied to the motor. For control of the servo motor, the switch must be in position 1. The switch in position 1 gives a logic high to pin 20 on the ARM, and this indicates that the potentiometer will no longer control the PWM wave generated from the ARM. A logic high on pin 20 of the ARM also creates a logic high from pin 28 of the ARM, and this signals the Arduino to take control of the servo motor. In this case, the potentiometer will control the position of

the servo motor, LED1 of the ARM mbed will be off, and LED2 of the ARM mbed will be on. The potentiometer will be connected to the 5V supply from the H-Bridge, ground, and pin A0 on the Arduino (again not direct connections, but through a common node on the breadboard). Similar to its application with the ARM, the potentiometer creates a voltage divider between the 5V supply voltage from the H-bridge and pin A0 of the Arduino. This analogue input signal is then read by the Arduino and translated into an output signal (PWM wave) from pin 9 to control the position of the servo motor. The servo motor is connected by three wires: one is from the designated 5V output of the Arduino, one is to ground (connected from the Arduino board, but the ground is common to the whole circuit), and one is the PWM wave from pin 9 of the Arduino. Rotating the potentiometer will give different duty cycles of the PWM wave as shown in Figures 8 and 9. Note that in this case the PWM wave generated will be incapable of a 100% duty cycle as about a 25% duty cycle was enough to fully rotate the servo motor to 180 degrees. Figure 8: PWM wave generated by Arduino as shown on the oscilloscope. The PWM wave is approximately set to a 0% duty cycle.

Figure 8: PWM wave generated by Arduino as shown on the oscilloscope. The PWM wave is approximately set to a 25% duty cycle. Conclusion (written by Mark Murdock) This project required the interfacing of many different devices and the collaboration of group members working on different parts of the project. Originally we were pursuing a system design using the PIC32 processor. But as we continued to have difficulties getting a PWM wave or any output from the PIC32 s pins, we decided to switch to the ARM Cortex-M4 Microprocessor. We learned during this phase of work on the project just how difficult it is to create truly independent modules as we struggled to obtain a working signal to test the hardware side of the project. Switching to the ARM processor significantly simplified the coding process while still providing good results. We also learned how to pass the output of one microprocessor to another microprocessor when we later added the Arduino into our design. By using the ARM and Arduino microprocessors in the design we also learned how to program some in both platforms. By having started out using the PIC32 we also learned concepts of programming a microprocessor using a non-object oriented language (PIC32 uses C). We also learned how to connect and code a potentiometer to give an analog signal that controlled the duty cycle of the PWM wave produced by the microprocessors. We also saw that the duty cycle of the wave (percent of each period that the voltage signal is high) determines the average voltage supplied by the wave. We also learned how to connect an H-bridge to isolate the higher voltage motor device from the part of the circuit containing the lower voltage microprocessors, as well as to supply a 5V voltage

Discussion (written by Mark Murdock and Mohammed) This project had many different design aspects to it. Most of the designs were very simple and others became difficult, needing a lot of trial and errors to get the system to work. The major problem that the group encountered was attempting to perform this project with the PIC32 microprocessor. The problem with this platform was the low level coding language (C) and the group was not getting the proper PWM output to show on the oscilloscope in the initial output tests. With these problems being very difficult to problem solve the group decided to switch the platform to the Arm processor. The Arm processor had an easier coding language (C++) to work with and the group got an actual PWM waveform from the output of the processor. Our initial approach for the second circuit was to use the ARM mbed for controlling both motors, but this proved to be too much of a strain on the processor. The Arm processor would send the proper signal to the servo motor but this would cause the processor to overheat and shut down. In order to combat this problem, the group attached the servo motor to the Arduino Uno processor to lessen the strain on the Arm processor. This project was a success for what the group was aiming for, but when examining the circuit design and code there can be some improvements and additions to the physical design. Future Work (written by Mohammed) In future work, the speed (RPM) of the dc motor can be measured by Hall effect sensor. In this project, it was tried to build also the feedback system of for the dc motor speed. the plan was to build a feedback system, where the change of speed of dc motor with the change of potentiometer will be shown by the led intensity change from the feedback of hall sensor. Due to faulty sensor, it didn t work. Here a PC fan is used as hall effect sensor is built in there. Arduino mega is used as the microcontroller and led is used to visualize the speed. The plan was the intensity of the led will change with the speed from getting the feedback from hall effect sensor. Below is the image of the fan used here. The yellow line in there gives the analog signal from hall effect sensor. Figure 9: PC fan with integrated hall sensor

A Hall effect sensor is a transducer that varies its output voltage in response to a magnetic field. So, when motor runs the magnetic field change in every turn because of internal magnet of the motor. Hall effect sensor sense the change and generate analog signal. The hall effect sensor input is connected to the analog input port of the Arduino and led is connected with digital output pin and ground. The fan is powered from external power supply. The setup Arduino code, and the Simulink block for the system is given below. Figure 10: Feedback setup of dc motor speed. Figure 11: Simulink diagram for microprocessor.

Figure 12: Arduino code for feedback system