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

Similar documents
MD10B Enhanced 10A Motor Driver

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

DC Geared Motor with Encoder MO-SPG-30E-XXXK

SC16A SERVO CONTROLLER

IFC-RS08 Interface Free Controller RC Servo Card

MD13S 13Amp DC Motor Driver

MD10C 10A DC Motor Driver

Enhanced SmartDrive40 MDS40B

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

ELCT 912: Advanced Embedded Systems

' The PicBasic Pro Compiler Manual is on line at: '

(DC)TR-76D. Data Sheet. Transceiver Module MICRORISC s.r.o. Datasheet_TR-76D_ Page 1

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

LP3943/LP3944 as a GPIO Expander

High Current DC Motor Driver Manual

About LC Meter This is one of the most accurate and simplest LC inductance / capacitance Meters that one can find, yet one that you can easily build y

LV8716QAGEVK Evaluation Kit User Guide

Design and Fabrication of High Frequency Linear Function Generator with Digital Frequency Counter using MAX038 and a PIC microcontroller

PIC ADC to PWM and Mosfet Low-Side Driver

Design of Low Cost Embedded Power Plant Relay Testing Unit

EXPERIMENT 6: Advanced I/O Programming

Design and Construction of PIC-based IR Remote Control Moving Robot

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

TR-72D. Data Sheet. Transceiver Module MICRORISC s.r.o. Datasheet_TR-72D_ Page 1

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

MD04-24Volt 20Amp H Bridge Motor Drive

Simple Bridge Stand Alone H-Bridge Data Sheet Revision 1 August 2005

DIY KIT 141. Multi-Mode Timer

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

34112-TE 8-digit LED Frequency Counter Module Model PLJ-8LED-C User Manual V 1.0 May 2014

3.3V regulator. JA H-bridge. Doc: page 1 of 7

Introduction to the Arduino Kit

GF of 9 THE GADGET FREAK FILES CASE #165. Analog Clock Measures Time in Meters

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

EVAL-ADM8843. Evaluation Board for Charge Pump Driver for LCD White LED Backlights. Preliminary Technical Data

(DC)TR-72D. Data Sheet. Transceiver Module MICRORISC s.r.o. Datasheet_TR-72D_ Page 1

EDE1204 Bi-Polar Stepper Motor IC

CMOS Serial Digital Pulse Width Modulator INPUT CLK MODULATOR LOGIC PWM 8 STAGE RIPPLE COUNTER RESET LOAD FREQUENCY DATA REGISTER

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

Electric Bike BLDC Hub Motor Control Using the Z8FMC1600 MCU

DESCRIPTION DOCUMENT FOR WIFI / BT HEAVY DUTY RELAY BOARD HARDWARE REVISION 0.1

Designing with a Microcontroller (v6)

Ocean Controls KT-5221 Modbus IO Module

I2C Demonstration Board I 2 C-bus Protocol

PS2-SMC-06 Servo Motor Controller Interface

(DC)TR-52D. Transceiver Module. Data Sheet

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

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

ZKit-51-RD2, 8051 Development Kit

Pulse Width Modulation

Breadboard Arduino Compatible Assembly Guide

MLX83100 Automotive DC Pre-Driver EVB83100 for Brushed DC Applications with MLX83100

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

6. HARDWARE PROTOTYPE AND EXPERIMENTAL RESULTS

TR-72D. Data Sheet. Transceiver Module MICRORISC s.r.o. Datasheet_TR-72D_ Page 1

Programming the Dallas/Maxim DS MHz I2C Oscillator. Jeremy Clark

MD03-50Volt 20Amp H Bridge Motor Drive

LED controllers. Voltage-switch drivers, constant-current drivers, and Flash LED drivers

TLE5014 Programmer. About this document. Application Note

Figure 1: One Possible Advanced Control System

ARDUINO BASED DC MOTOR SPEED CONTROL

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

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

Ocean Controls KT-5198 Dual Bidirectional DC Motor Speed Controller

Debugging a Boundary-Scan I 2 C Script Test with the BusPro - I and I2C Exerciser Software: A Case Study

Evaluation Board for DC Motor Control with the IFX9201. This board user manual provides a basic introduction to the hardware of the H-Bridge Kit 2Go.

JX pin PIC Microcontroller Project Board

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

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

I2C Encoder. HW v1.2

Training Schedule. Robotic System Design using Arduino Platform

ams AG austriamicrosystems AG is now The technical content of this austriamicrosystems application note is still valid. Contact information:

MicroToys Guide: Motors N. Pinckney April 2005

Lesson 19 In-Circuit Programming

EE 308 Lab Spring 2009

AN3134 Application note

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

Pololu DRV8835 Dual Motor Driver Kit for Raspberry Pi B+

Building an Analog Communications System

CMOS Serial Digital Pulse Width Modulator INPUT CLK MODULATOR LOGIC PWM 8 STAGE RIPPLE COUNTER RESET LOAD FREQUENCY DATA REGISTER

TMS320F241 DSP Boards for Power-electronics Applications

ARDUINO / GENUINO. start as professional

DASL 120 Introduction to Microcontrollers

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation

NJ88C Frequency Synthesiser with non-resettable counters

Bill of Materials: PWM Stepper Motor Driver PART NO

ADS9850 Signal Generator Module

The Guitar Chord Learning System

Adjustable Parametric Equalizer Hardware Description

To Measure Dielectric Constant of Liquid By Using PIC Microcontroller

TKT-3500 Microcontroller systems

LM5022 Boost LED Driver Evaluation Board

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

PICee Development System

TB6612FNG Dual Motor Driver Carrier

USB-PWM10. User s Manual

OM29110 NFC's SBC Interface Boards User Manual. Rev May

PIC Analog Voltage to PWM Duty Cycle

SKIM USER S GUIDE SMART KAN INTERFACE MODULE 2 & 8 I/O

MV1820. Downloaded from Elcodis.com electronic components distributor

Transcription:

PR10 Controlling DC Brush Motor using MD10B or MD30B Version 1.2 Aug 2008 Cytron Technologies Sdn. Bhd. Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumed by Cytron Technologies Incorporated with respect to the accuracy or use of such information or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Cytron Technologies s products as critical components in life support systems is not authorized except with express written approval by Cytron Technologies. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights. OVERVIEW This document describes the development of Cytron Technologies DIY (Do It Yourself) Project No.10 (PR10). This project will use PIC microcontroller to control MDXXB further drive a brush motor with variable speed and bi-directionally. Circuit schematic and PIC source code will be provided. FEATURES PIC16F876A - 8K x 14words of program memory - On board programming - PWM generator 10A or 30A DC brush motor - Capable of driver DC brush motor up to 10A (MD10B) or 30A (MD30B) Speed controlled with PWM - Speed of motor controlled using PWM from PIC - 1KHz to 5KHz Start, Stop, Brake and Bi-directional control Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 1

SYSTEM OVERVIEW Push Buttons Microcontroller (PIC16F876A) Motor Driver (MDXXB) DC Brush Motor GENERAL DESCRIPTION MD30B Driving DC brush motor is common necessity in most robotic project. However, is difficult to source for high ampere motor driver with controllable speed. Cytron Technologies offers several model of DC brush motor driver. The most common and popular motor driver is MD10B. Using relays and power MOSFET, this motor driver could be used to drive brush motor up to 10A. These include Stop, Start and also Brake on motor. It even provides speed and direction control to brush motor. Combining PR10 and MDXXB offers a simple and fast development yet reliable result. Cytron Technologies also offer higher ampere motor driver with capability to drive DC brush motor up to 30A, MD30B. GND PWM CCW CW 12V From Battery To Motor + - Motor Driver Figure 2 MD10B 1 To Motor - + As shown MD10B and MD30B offer simplest interface, adding motor power source and 12V as Vcc, it is ready to be plug and play. Basically, to Start a brush motor, simply connect a battery with rated voltage to both terminal of motor. The motor will start rotating with a speed at one direction, let s say CW (Clock Wise). To reverse the rotation into CCW (Counter Clock Wise), simply change the polarity of battery connected to motor s terminals. Connecting both the motor terminal will make the motor into Brake condition, and this can only be done without connecting to battery. It is more complicated if speed of motor is desired to be controlled. There are several methods which can be used to control speed of DC brush motor. In this project, PWM (Pulse Width Modulation) will be used. Both MD10B and MD30B offer PWM control of speed. The difference is MD10B can drive a DC brush motor up to 10A but MD30B can drive it up to 30A. Simply control the logic of 3 input pins on MD10B or MD30B offer the full control of brush motor. From Battery Figure 1 Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 2

DC Brush Motor Figure 4 shows the Pin Diagram for PIC16F876A. For more detail, please download the datasheet from microchip web site at: http://www.microchip.com HARDWARE This project will require following hardware: a. 1 x high speed DC brush motor (excluded) b. 1 x PR10 Printed Circuit Board (PCB) c. 1 x PIC16F876A d. 1 x MD10B or MD30B motor driver e. Related electronic components Figure 3 Cytron Technologies offers several power and gear DC brush motor. For this project, DC brush motor is sold separately. User can choose the suitable motor in the Cytron product page. http://www.cytron.com.my/listproductcategory.asp?ci d=91 PIC16F876A (Microcontroller) This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC architecture into an 28-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F876A features: 256 bytes of EEPROM data memory self programming an ICD 2 Comparators 5 channels of 10-bit Analog-to-Digital (A/D) converter 2 capture/compare/pwm functions the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI ) or the 2-wire Inter-Integrated Circuit (I²C ) bus A Universal Asynchronous Receiver Transmitter (UART) Figure 4 Please refer to the schematic diagram of PR10. The schematic is provided free therefore Cytron Technologies will not be responsible for any further modification or improvement. Interface PIC16F876A with MDXXB The 12V power source from circuit board provides the Vcc (12V) for the MDXXB. As mention early, there are 3 input pins (PWM, CCW and CW) on MDXXB board. PWM pin can be connected either to pin 13 (CCP1) or pin 12 (CCP2) only, however CCW pin and CW pin can be connected to any I/O pins. In this project, PWM, CCW and CW is connected to pin 13 (CCP1), pin 22 (RB1) and pin 23 (RB2) respectively. Power Supply for Circuit Figure 5 For this project, the voltage of power source could be given for this circuit board is 12V because MD10B require 12V to operate. Higher input voltage will produce more heat at LM7805 voltage regulator. Typical voltage is 12V. Anyhow, LM7805 will still generate some heat at 12V. There are two type of power connector on the circuit board, DC plug Adaptor is for AC-DC adaptor and 2510-02 Power is for battery source. Normally AC to DC adaptor can be plugged to Adaptor type connector. LM7805 (1A maximum) will regulate the given voltage to 5V (VCC) for supplying to the PIC16F876A and pull-up the push button (input). The purpose of using diode (D1) is for circuit protection in case the polarity of the power source is incorrect. Capacitor (C5) and capacitor (C1) is use to stabilize the voltage input and output of the LM7805. DS1 is a green LED (small) as power indicator. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 3

ICSP for Programming PIC Microcontroller SOFTWARE Flow Chart: Start Brake button pressed? Yes Stop and brake motor Figure 6 In Circuit Serial Programming (ICSP) is used for loading program in this project. ICSP offers a convenience way to load program into PIC microcontroller without removing the PIC from the circuit board. So pin 1 (Vpp), pin 27 (PGC) and pin 28 (PGD) from PIC should be connected to Cytron USB In Circuit Programmer (UIC00A) through the external cable. Besides, GND from the circuit board should be connected with GND from UIC00A and pin 24 (PGM) should be pulled to GND through a 10K resistor as shown in Figure 6. The programmer (UIC00A) is not included in DIY project set since it can be used several times for different project set. User can also choose other type of PIC programmer to load the program. Since the ICSP is used, three I/O pins (RB3, RB6 and RB7) should not be used as input, anyway it still can be used for output. No Direction/Run button pressed? No +Speed button pressed? No -Speed button pressed? No Yes Yes Yes Motor start running / change direction Increase speed Decrease speed Push Button as Input for PIC microcontroller Please download the sample program from Cytron website (same directory as this DIY project) The source code is provided free and Cytron Technologies will not be responsible for any further modification or improvement. Figure 7 One I/O pin is needed for one push button as input for PIC microcontroller. The connection of the push button to the I/O pin is shown in Figure 7. The I/O pin should be pull up to 5V using a resistor (with value range 1K- 10K) and this configuration will result an active-low input. When the button is being pressed, reading of I/O pin will be in logic 0, while when the button is not pressed, reading of that I/O pin will be logic 1. PWM (Pulse Width Modulation) Module PIC16F876A will generate PWM for the MD10B so that the speed of the DC brush motor can be controlled. The following steps should be taken when configuring the CCP module for PWM operation for PIC16F876A: 1. Set the PWM period by writing to the PR2 register. 2. Set the PWM duty cycle by writing to the CCPR1L register and CCP1CON<5:4> bits. 3. Make the CCP1 pin an output by clearing the TRISC<2> bit. 4. Set the TMR2 prescale value and enable Timer2 by writing to T2CON. 5. Configure the CCP1 module for PWM operation. A PWM output (Figure 8) has a time base (period) and a time that the output stays high (duty cycle). The frequency of the PWM is the inverse of the period (1/period). Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 4

Figure 8 The PWM period is specified by entering a value to the PR2 register. The PWM period can be calculated using the following formula: Figure 9 PWM Period = [(PR2) + 1] 4 TOSC (TMR2 Prescale Value) Where TOSC is the period of crystal of PIC16F876A, in this project is 20MHz crystal. Thus, the TOSC is 50ns. For this project, PR2 is set to maximum value 0xFF (255) and the TMR2 Prescale Value is set to 4. The Timer2 Control Register is shows in Figure 9. Figure 10 shows the CCP1CON Register. The PWM duty cycle is specified by writing to the CCPR1L register and to the CCP1CON<5:4> bits. Up to 10-bit resolution is available for PIC16F876A. The CCPR1L contains the eight MSbs and the CCP1CON<5:4> contains the two LSbs. This 10-bit value is represented by CCPR1L:CCP1CON<5:4>. The following equation is used to calculate the PWM duty cycle in time: PWM Duty Cycle = (CCPR1L:CCP1CON<5:4>) TOSC (TMR2 Prescale Value) Program Figure 10 Figure 11 shows the main program of this project. The average voltage is depending on the PWM Duty Cycle. That means increment of PWM Duty Cycle may increase the average voltage so the speed of DC brush motor could be increased. Unimplemented TR2CON=0b00000101 Timer2 Clock Prescaler Select Bits Timer2 Output Postscaler Select Bits Timer2 On bit (ON) CCP1CON=0b00001100 Unimplemented Mode Select Bits (PWM Mode) PWM Least Significant bits Figure 11 Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 5

The program starts with configuring the I/O pin of PIC using TRISx register. Further continue with the configuration of CCP1 for PWM output. Step for soldering 2510 connector: 1 2 The following section will be the reading of switches and controlling DC brush motor. It will start by checking BUTTON1, if BUTTON1 = 0, the motor would be stopped and braked. In this condition, the both CW pin and CCW pin from MD10B are Low. 3 4 It will continue to check BUTTON2, if BUTTON2 = 0, rotational direction would be changed. Rotational direction can be changed by changing the polarity of battery connected to motor s terminals. MD10B provide the CW and CCW pins for different rotational direction. For condition with CW = 1(High) and CCW = 0(Low), the motor will rotate in Clockwise direction. For Counter Clockwise direction, CW and CCW should be 0(Low) and 1(High) respectively. Next, it will continue to check BUTTON3 then BUTTON4. PWM pin from MD10B is connected to pin 13 (CCP1) from PIC16F876A. The speed of the motor can be controlled by changing the value of PWM duty cycle. The motor speed would be increased and decreased when BUTTON3 = 0 and BUTTON4 = 0 is detected respectively. The BUTTON1, BUTTON2, BUTTON3 and BUTTON4 have been labeled with Brake, Direction/Run, +Speed and Speed respectively on the circuit board. 5 6 7 Figure 12 Step for soldering 3961 connector (for MD10B): 1 2 3 8 GETTING START User can obtain the hardware set for this project (PR10) either by online purchasing (www.cytron.com.my) or purchase it in Cytron Technologies Shop. 1. Once user has the hardware set, soldering process can be started. Please solder the electronic components one by one according the symbols or overlays on the Printed Circuit Board (PCB). Ensure the component value and polarity is correctly soldered. Please refer to PCB Layout in Appendix A. 4 7 5 8 6 Caution: Make sure all the connectors (2510) are soldered in proper side. Those electronic components have polarity such as capacitor, diode, PIC, LM7805 and LED should be soldered in right polarity or it may cause the circuit board fail to work. Figure 13 Warning: Before the battery (Power) is plugged in, make sure the polarity is correct to prevent the explosion. Be careful when connecting the motor and battery on MDXXB board. Do not connect the battery to the motor connector on the MDXXB or it might explode (short circuit). Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 6

Make sure the wire and connector is correctly installed between MDXXB and circuit board as shown below: Same Node again the hex file into the PIC microcontroller using (UIC00A). 10. User can choose either adaptor or battery to provide the power for the circuit board but make sure the given voltage is 12V. This project needs two power sources, one is for circuit board and another one is for MDXXB. The power for the MDXXB is depend to the type of brush motor. For example, if the motor needs 12V, so the 12V battery should be plugged into the Power connector on the MDXXB. Figure 14 2. After soldering work is finished, please plug in the PIC16F876A to the 28 pins IC socket in proper side. AC to DC adaptor: 3. Please download the necessary files and document from Cytron Technologies website. These included documentation, sample source code, schematic, component list and software. 4. The next step is to install MPLAB IDE and HI-TECC C PRO into a computer. The MPLAB IDE and HI-TECC C PRO can be downloaded from www.cytron.com.my. Please refer MPLAB IDE installation step document to install the software. The documents can be used to any version of MPLAB IDE software. 12V Polarity Figure 15 (not included in DIY project set) 12V battery connector: 5. After the installation complete, open the project file provided using MPLAB IDE. Please refer MPLAB Open Project document to open the sample program. 6. Connect PR10 to MD10B or MD30B. Plug DC brush motor. 7. Please plug in the power supply and connect the programmer connector to the circuit board to reprogram the PIC. Do not forget to ON the slide switch! 8. Build the project and load the hex file into the PIC microcontroller using the USB In Circuit Programmer (UIC00A). When user build the project, MPLAB IDE will generate hex file. The hex file generated from MPLAB IDE will be named according to project name, not C file name. Cytron Technologies also provide hex file for user. Do not forget to switch ON the power. The programmer is not included in the hardware set but it can be found at Cytron website. (User manual is provided at website). 9. This program can be modified. After modification, build the project and load once Figure 16 (not included in DIY project set) Connection to the PCB board: Figure 17 11. When the power is provided, the green LED (small) will turn ON. If the sample program (without modification) is being used, the motor can be controlled by pressing the 4 buttons on the circuit board. The motor only can start running after pressing the Direction/Run button. The rotational Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 7

direction would be changed for every this button is pressed. Speed of the motor will increase and decrease if the +Speed button and -Speed button is pressed respectively. Brake button is used for stop and brake the motor immediately. TEST METHOD 1. Switch ON the power Power Led (green) will turn ON. 2. Press Direction/Run button Motor will rotate in clockwise To change the direction, press Direction/Run button again 3. Press +Speed button Motor speed will increase 4. Press Reset button Motor will stop To run the motor again, press Direction/Run button 5. Press Speed button Motor speed will decrease 6. Press Brake button Motor will stop immediately (same as when reset button is pressed) 7. If all steps mention above can be executed, your project is done successfully. Congratulations!! WARRANTY No warranty will be provided as this is DIY project. Please check the polarity of each electronic component before soldering it to board. Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 8

Appendix A PCB Layout: 4K7 Box header LM7805 4K7 LED 3mm 4K7 1N4148 Diode 4K7 C-cap 30pF PIC16F876A E-cap 10uF 16V C-cap 104 220R 4K7 20MHz Crystal C-cap 30pF C-cap 104 1N4007 Diode Adaptor socket 2510-05 Connector Slide switch 2510-02 Connector Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 9

Prepared by Cytron Technologies Sdn. Bhd. 19, Jalan Kebudayaan 1A, Taman Universiti, 81300 Skudai, Johor, Malaysia. Tel: +607-521 3178 Fax: +607-521 1861 URL: www.cytron.com.my Email: support@cytron.com.my sales@cytron.com.my Created by Cytron Technologies Sdn. Bhd. All Rights Reserved 10