mechanical system - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/ppt/chapter 6 control...
TRANSCRIPT
![Page 1: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/1.jpg)
MechanicalSystem
Machinery Sensor Driver Control
Control algorithm
ControlSystem
Mechanical System
![Page 2: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/2.jpg)
Engineering realization
• Design of Computer Control System
Hardware: Circuit schematic design + PCB
Software : Algorithm + Programing + Software Simulation
• Question
How to choose a appropriate controller or design a control system
![Page 3: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/3.jpg)
Questions
1. How to choose a controller?
2. Step of designing a control system?
3. How to design a MCU system?
4. How to implement the motion control
of step motor?
![Page 4: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/4.jpg)
Robotic Gecko
AVR microcontroller
![Page 5: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/5.jpg)
Contents
1
2
3
4
Classification and characteristics of
computer control system
AVR fundamental setup
MCU development process
Example : stepper motor motion
control
![Page 6: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/6.jpg)
Classification and characteristics of computer control system
ComputerMCU
ARM、DSP embedded
system
PLC
IPC
Universal PC
Dedicated
embedded
systems
![Page 7: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/7.jpg)
MCU
• AdvantagesTargeted
Small size
Low cost
• DisadvantagesLow reliability
Long development cycle
![Page 8: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/8.jpg)
Principles of choosing a MCU
• Micro control system: Using a self-designed
microcontroller, such as Intelligent instrumentation.
• Normal control system: Choose existing industrial
controller in order to speed up development, such as
PLC.
• Large control system: Choose Industrial PC, and use
high-level language to develop or configure software.
![Page 9: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/9.jpg)
Contents
1
2
3
4
Computer control system
AVR basis
MCU system development
process
Examples: stepper motor control
![Page 10: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/10.jpg)
AVR Microcontroller Basics
2.1 MCU basis;
2.2 Development of MCU;
2.3 Characteristics of AVR;
2.4 ATmega 8 architecture and on-
chip resources;
![Page 11: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/11.jpg)
Typical MCU application system
The development trend of MCU: low power consumption,Wide voltage, high-performance, low cost, ISP or ISP baseddevelop environment.
![Page 12: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/12.jpg)
2.1 MCU basis
Definition of MCU:
CPU, RAM, ROM, timer/counter, and I/O interface
circuit and other major computer components are
integrated on a chip, which is composed of such a chip
microcomputer is called the single chip microcomputer.
![Page 13: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/13.jpg)
• MCU performance indicators:
Clock Speed: The CPU clock frequency CPU
Instruction set : CISC and RISC, the later is more efficiency
Word length: The bits of binary number it processed(8 bits is the mainstream)
MCU comparison of similar prices
CPU AT、STC series 51 MSP430F1 AVR
Clock Speed 2MHz 8MHz 20M Hz
Instruction set CISC RISC RISC
Word length 8 bits 16位 8位
2.1 MCU basis
![Page 14: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/14.jpg)
2.2 Characteristics of AVR
AVR program can be written in parallel, or through ISP,
which can be erased online.
Just a parallel port download cable ISP, the debugged
program can be written into the AVR. So, an ISP
download cable can go through AVR development, the
cost is very low.
![Page 15: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/15.jpg)
ATmega8 architecture
2.3 ATmega8 architecture and on-chip resources
![Page 16: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/16.jpg)
Plastic Dual In-Line Package Thin Quad Flat Pack
2.4 ATmega8 architecture and resources
![Page 17: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/17.jpg)
Contents
1
2
3
4
Classification and characteristics of
computer control system
AVR basis
MCU system development
process
Example: stepper motor control
![Page 18: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/18.jpg)
MCU system development process
MCU application system development is the process of achieving a specific function SCM system, according to the needs of customers or markets,
Need analysis
overall design of system
design of the hardware
in the system
system software design
MCU
system simulation
Program download
1
1
![Page 19: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/19.jpg)
3.1 Need analysis
• Goal: Determine the task the system to complete and its function.
• Product design-work instructions
-- SCM system functions implemented
-- Specifications
• Input and output;
• Function and property;
• Cost;
• Physical size and weight;
• Power consumption.
![Page 20: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/20.jpg)
3.2 Overall design of system
• Design description
• General block diagram
• The overall structural design
• Preparatory for design– Plan design schedule and
organize manpower;
– Prepare place and instrument;
– Develop components’ procurement and external processing program ;
– Budget.
![Page 21: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/21.jpg)
3.3 Design of the hardware in the system
• Selection of the components–MCU Selection;
–Select the peripheral device;
• Circuit Design–Standardization and modular of hardware system;
–Plan and control the system resource;
• Computer-aided design of hardware circuits–Schematic Design;
–PCB diagram design.
![Page 22: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/22.jpg)
• Control system = Scheme selection + modeling and Simulation + Hardware development +
software debug + Joint debugging
3.3 Design of the hardware in the system
![Page 23: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/23.jpg)
Software System Development Tools
Compilation tools: ICC AVR
Simulation tools: AVR STUDIO
Download tools: PROGISP
![Page 24: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/24.jpg)
Software Development
• To develop a MCU software system, it generally go through the following process:
Write code compile Simulation Download
• AVR can use assembly language or C language to programme.
• Atmel offer us a suit of develop tools:– Compiling: ICCAVR
– Simulation: AVR Studio
– Download: PROGISP
![Page 25: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/25.jpg)
Connection
ISP
USB
+12V
220V
USB
Serial
communication
![Page 26: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/26.jpg)
Robotic fish motor control
![Page 27: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/27.jpg)
Contents
1
2
3
4
Classification and characteristics of
computer control system
AVR basis
MCU system development
process
Example: stepper motor control
![Page 28: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/28.jpg)
Experimental Platform
USB转串口线
![Page 29: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/29.jpg)
USB to serial
port cable
MCU ISP download
cable
12V
power
Box
Experimental Platform
![Page 30: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/30.jpg)
AVR Development Board
ZLG728
9
Serial
Communication
12V
Power
input
Power
switch
Nixie tube ISP
Control
button
Potentiom
eter
Step
motor
DC motor
interface
Servo
interface
Step
motor
interface
L298
LM780
5
ATmeg
a8
Motor
Control
Jumper
Reset
LED
![Page 31: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/31.jpg)
PCB diagram
![Page 32: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/32.jpg)
SCH layout
![Page 33: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/33.jpg)
Connection
Power port
Serial port ISP port
![Page 34: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/34.jpg)
• Minimum system:Include ISP, maintain the operation of MCU;
• PMU: For power management, The input voltage is 7.5V~24V(12V);
• RS232communication module: Can undertake serial communication with PC ;
• Keyboard, the analog signal input module: The input control and A/D acquisition experiments;
• LED, Digitron: Common display device;
• Stepper motor module: Control four phase stepper motor
Development board function module
![Page 35: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/35.jpg)
• Input:The AD module; The keyboard module;
• Output:Stepper motor module; LED ;digitron; Steering gear module;
• Input output unit:USART;
Input-output channel
control
systeminput output
I/O
![Page 36: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/36.jpg)
The minimum system wiring diagram
![Page 37: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/37.jpg)
LED1——PC0 LED3——PC2
LED2——PC1 LED4——PC3
LED display
![Page 38: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/38.jpg)
Digitron display
ZLG7289 Digitron
CS_7289
CK_7289
D_7289
CS_7289——PD5
CK_7289——PD6
D_7289 ——PD7
![Page 39: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/39.jpg)
LED and digital display wiring diagram
![Page 40: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/40.jpg)
Serial port communication
This part by PC
This part to the TXD、
RXD of MCU
Max232PC MCU
TXD
RXD
![Page 41: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/41.jpg)
Serial port communication wiring diagram
![Page 42: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/42.jpg)
Keyboard interface module
SW1——PD2(INT0)
SW2——PD3(INT1)
normal state Key
down
Key
up
![Page 43: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/43.jpg)
AD collection module
AD7——ADC7
potentiometer AVRAD7
analog
voltage
0~VCC
digital
quantity
0~1023
![Page 44: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/44.jpg)
Input module wiring diagram
![Page 45: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/45.jpg)
Stepper motor control instance
• Use AVR chip as main control unit ,L298
As the driver chip . Control block diagram
is as follows :
AVR L298Step
Motor
![Page 46: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/46.jpg)
• Displacement: proportional to the input pulse
number strictly
• Rotating speed: proportional to the pulse frequency
•Direction: related to the winding way of electricity
Stepper motor
![Page 47: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/47.jpg)
No. A B C D Dir
1 1 0 0 0 Reverse
Forward
2 1 1 0 0
3 0 1 0 0
4 0 1 1 0
5 0 0 1 0
6 0 0 1 1
7 0 0 0 1
8 1 0 0 1
Four phase eight beats circular distributor
numerical tables as follows
Circular distributor
![Page 48: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/48.jpg)
Stepper motor module
L298 stepper motorIN2
IN3
IN3
IN1
IN1——PB1
IN2——PB3
IN3——PB2
IN4——PB4
![Page 49: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/49.jpg)
Stepper motor layout
![Page 50: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/50.jpg)
• ICCAVR main interface
source file editor window
The Project Manager Window
Compile status window
![Page 51: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/51.jpg)
• Build a new project
• The wizard is used to establish the file, added to the project project
file
wizard
![Page 52: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/52.jpg)
Choose the chip and XTL :
– as follows ,the chip is Atmega64,XTL is 11.059MHz ,External interrupt 4 (rising along the trigger)
![Page 53: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/53.jpg)
• I/Osetting
select the corresponding state according to the need。in the graphic :PB0 output high level;PB1 output low level;PB3 is high resistance 。
![Page 54: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/54.jpg)
Progispfunction:download the program from PC to MCU
![Page 55: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/55.jpg)
• Choose chip ATmega 8
• Set the programming options (Choose the chip erase,
programming FLASH, calibration FLASH )->Load Flash->click automation
①
②
③
④
![Page 56: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/56.jpg)
Let us see how the
Step motor works…
![Page 57: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/57.jpg)
The stepper motor
24BYJ48A
![Page 58: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/58.jpg)
• Stepper motor speed control
Control stepping motor speed is to control pulse frequency or
phase of the cycle。
Two way:
software delay:By calling the delay subroutine method, it
takes up CPU time.
Timer :By setting the TOCNT register.
![Page 59: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/59.jpg)
Stepper motor drive circuit
PB1(OC1A)、PB3(MOSI)、PB2(OC1B)、PB4(MISO)
respectively control A、B、C、D phase。
Jumpers:3---2、6---5、9---8、12---11。
![Page 60: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/60.jpg)
Three sets of control scheme
• Pure MCUprogram control
• Potentiometer and the button control
• upper computer control
![Page 61: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/61.jpg)
Pure MCU control
• Stepper motor speed and direction decide
by the burning process, if you want to
change the speed and direction of step
motor, you can only change in the original
MCU program, burning again.
• Usually the final actual running program is
implemented in this way.
![Page 62: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/62.jpg)
AD sampling circuit and buttons
MCU AD samples analog voltage value to control the
speed of the stepper motor。Two buttons control the direction of stepping motor。
![Page 63: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/63.jpg)
Four phase stepper motor control algorithm
• 1、 Four phase four beat:A->B->C->D->A
• 2、 Four phase double four beat:
AB->BC->CD->DA->AB
• 3、 four phase eight beat:
A-> AB-> B->BC-> C-> CD -> D-> DA->A
![Page 64: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/64.jpg)
Two key points of stepper motor control
• Angular displacement: pulse number
• Speed: pulse frequency
360=
ZNstep angle
60 fSpeedn
ZN (r/min)
Z is the number of teeth on the rotor type, N is the number of beats, f is pulse frequency
![Page 65: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/65.jpg)
What we do now
• 1、 What kind of pulse we need?
• 2、How to generate the pulse ?
– How to produce a certain number of pulse ?
– How to produce the required frequency pulse ?
![Page 66: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/66.jpg)
How to generate pulse signal
• Timer of the MCU --- generate pulse
– Regularly produce beats
– Use PWM function
• Timer generates a certain number of pulse.
change winding current order in Overflow timer interrupt.
• Change the timing - to produce the required frequency pulse
![Page 67: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/67.jpg)
AD sampling circuit and buttons
MCU AD samples analog voltage value to control the
speed of the stepper motor。Two buttons control the direction of stepping motor。
![Page 68: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/68.jpg)
Review our learning :
development board frame
ICC
AVR Studio
AVR AVR JDK sample
functional modules
download softwareProgi
sp
Stepping Motor control exp
eriment
powerMinimum
system
Serial Communi-
cationMotor Module
Digitaldisplay
buttons
LEDAD
sampling
![Page 69: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/69.jpg)
Learning resource
• 1. guidance notes;
• 2. OurAVR Website: www.ouravr.com;
• 3. ATmega8 Datasheet;
• 4. C programming;
![Page 70: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/70.jpg)
MIT Cheetah Robot
![Page 71: Mechanical System - softrobotics.buaa.edu.cnsoftrobotics.buaa.edu.cn/PPT/Chapter 6 Control system.pdf · ... The CPU clock frequency CPU Instruction set : CISC and RISC, ... system](https://reader031.vdocuments.us/reader031/viewer/2022022014/5b3fdedf7f8b9a4b3f8c9bec/html5/thumbnails/71.jpg)