Tải bản đầy đủ (.pdf) (28 trang)

embedded control system design rotating welding positioner

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.96 MB, 28 trang )

<span class="text_page_counter">Trang 1</span><div class="page_container" data-page="1">

<b>EMBEDDED CONTROL SYSTEM DESIGN </b>

<i><b>Rotating Welding Positioner Group 4 </b></i>

Instructors: M.Sc. Chu Duc Viet

Class: 128336

</div><span class="text_page_counter">Trang 3</span><div class="page_container" data-page="3">

Figure 5. MCU and user interface block ... 8

Figure 6. Digital output and analog input block ... 9

Figure 7. Digital input block ... 10

Figure 8. Digital Input ... 11

Figure 9. Digital Output npn type ... 13

Figure 10. Digital output pnp type ... 15

Figure 11. Analog input... 16

Figure 12. Power supply rails diagram ... 18

Figure 13. Isolated DC/DC 24V/5V ... 18

Figure 14. Voltage regulator (5V-3.3V) using LDO LP5907MFX-3.3/NOPB ... 19

Figure 15. User interface ... 19

Figure 16. Emergency button circuit ... 20

Figure 17. User interface finite state machine ... 21

Figure 18. Mode selection flow chart ... 22

Figure 19. Setting flow chart ... 22

Figure 20. Keyboard specification ... 23

Figure 21. Control unit finite state machine ... 24

</div><span class="text_page_counter">Trang 4</span><div class="page_container" data-page="4">

o Control the machine through keyboard and interact with users through LCD o 2 modes of operation:

- Continual mode (mode 1): enter speed through keyboard

- Periodical mode (mode 2): enter number of welding points, pausing time after each point through keyboard

o Emergency stop: button o LCD: Displaying • Mode of operations

o Continuous mode: display the speed

o Periodic mode: display number of welding points

• Errors: too fast/ slow rotating speed (table), position error, motor error (receiving from motor drive)

<b>Controller Specification </b>

• 8 Digital Input: receiving the signal from the motor controller when occurring the error in the motor.

</div><span class="text_page_counter">Trang 5</span><div class="page_container" data-page="5">

4 Type

of limit

Digital Input VL

(V) IL (mA)

VH (V)

IH (mA)

</div><span class="text_page_counter">Trang 6</span><div class="page_container" data-page="6">

5 • LCD: display in each mode of operation

o Mode 1 (continuous): display speed

o Mode 2 (periodical): display number of welding points, temporary stopping time o Error notification

• Keyboard:

o Mode 1 (continuous): set the speed

o Mode 2 (periodical): set the number of welding points, temporary stopping time • Button: let users emergency stop the machine

o Speed setting for mode 1.

o Number of welding points and temporary stopping time settings for mode 2. • Read the signal regarding speed and position of welding table from rotating sensor of the

table

o Mode 1: Receive the working speed of the table and notify error if the table is not working properly (too over/under speed).

o Mode 2: Receive and notify positioning error of the table.

• Process the input from keyboard and sensor signal to display necessary information corresponding each mode in LCD as indicated in 3.1.

• Process the input from keyboard and give command to motor controller to make the welding table work properly as users’ settings. Receive motor error notification from motor controller.

<b>• Receive emergency signal from the button and stop the table immediately. </b>

</div><span class="text_page_counter">Trang 7</span><div class="page_container" data-page="7">

6 o 4x4 keyboard (3.3V supply voltage)

o 128x64 LCD (3.3V supply voltage)

• Requirements: stop the machine in emergency situations

head button)

• Requirements: o Input 24 VDC o Output 5 VDC

• Solution: MEAN WELL SPBW03F-05: o Regulated DC/DC converter o Input 9-36 VDC (typical 24 VDC) o Output 5 VDC

o Efficiency 81%

o Ripple & noise (max.) 50mVp-p o Voltage accuracy ±1.5% o 1.5KVDC I/O isolation o Operating temperature -40-85°C

<small>Figure 2. SPBW03F-05 </small>

<b>• Requirements: o Input 5 VDC o Output 3.3 VDC </b>

<b>o Input 2.2-5.5 VDC o Output 3.3 VDC o Voltage tolerance ±3.0% o Operating temperature -40-125°C </b>

</div><span class="text_page_counter">Trang 8</span><div class="page_container" data-page="8">

o 1 pin for external button interrupt

o Pins for connecting rotating sensor from the table • Solution:

<b>Choose the microcontroller STM32F103RF </b>

o Flash memory 768Kb, RAM 96Kb o 51 pins I/O

o 3x12-bit ADC

</div><span class="text_page_counter">Trang 12</span><div class="page_container" data-page="12">

Digital Input VL

(V) IL (mA)

VH (V)

IH (mA)

</div><span class="text_page_counter">Trang 13</span><div class="page_container" data-page="13">

12

<b>➢ Op amp comparator circuit </b>

</div><span class="text_page_counter">Trang 14</span><div class="page_container" data-page="14">

A clamping circuit will bind the upper or lower extreme of a waveform to a fixed DC voltage

−0.6𝑉.

Choose Schottky Diode SL110PL

✓ Maximum DC Blocking Voltage 100V ✓ Average Forward Current 1A

<b>➢ Diode TVS </b>

Diode TVS is used for protecting sensitive components against high voltage spikes from transient or electrostatic discharge (ESD) and is selected according to the following parameters: working voltage, breakdown voltage and diode power.

✓ Breakdown Voltage: 44.40 ÷ 49.10V ✓ Peak Pulse Power Dissipation: 600W ✓ Low impedance and fast response time

<b>a, npn type: </b>

<small>Figure 9. Digital Output npn type </small>

</div><span class="text_page_counter">Trang 15</span><div class="page_container" data-page="15">

14

<b>• Isolated by photo coupler PC817 </b>

<b>• ESD and transient voltage protection: using TVS diode • Overvoltage/ undervoltage protection: clamping diodes • Logic level: High (24V), Low (0V) </b>

<b>• Calculation: ➢ Resistor R1 </b>

The input current/voltage of PC817 is in the range 5-20mA/1.2-1.4V.

✓ Breakdown Voltage: 33.3 ÷ 36.8V ✓ Peak Pulse Power Dissipation: 600W ✓ Low impedance and fast response time Diode D1 and D2 are the same as in Digital Input section.

</div><span class="text_page_counter">Trang 16</span><div class="page_container" data-page="16">

15

<b>b, pnp type: </b>

<small>Figure 10. Digital output pnp type </small>

<b>• Calculation: ➢ Resistor R4 </b>

<b>➢ Diode TVS clamping diodes </b>

Choose the same TVS diode and clamping diodes as in the npn type.

</div><span class="text_page_counter">Trang 17</span><div class="page_container" data-page="17">

16

<small>Figure 11. Analog input </small>

<b>Requirement: </b>

• Input voltage: 0-10V • Receive analog signal with filter

• Isolated MCU and overvoltage/ under-voltage protection • ESD and transient voltage protection

(because the input voltage of ADC range from 0 to 5V). We have:

</div><span class="text_page_counter">Trang 18</span><div class="page_container" data-page="18">

17

A clamping circuit will bind the upper or lower extreme of a waveform to a fixed DC voltage

Choose Schottky Diode SL110PL

✓ Maximum DC Blocking Voltage 100V ✓ Average Forward Current 1A

✓ Maximum Instantaneous Forward Voltage 0.6V

<b>• Unity gain amplifier, it completely isolates the input side of the circuit from the output </b>

side of the circuit. We choose LM324.

Output of LM324, choose RC low pass filter with cut-off frequency 100Hz

✓ Breakdown Voltage: 44.40 ÷ 49.10V ✓ Peak Pulse Power Dissipation: 600W ✓ Low impedance and fast response time

</div><span class="text_page_counter">Trang 19</span><div class="page_container" data-page="19">

18

<b>➢ R<small>4</small>, R , R <small>56</small></b>

</div><span class="text_page_counter">Trang 20</span><div class="page_container" data-page="20">

19

<small>Figure 14. Voltage regulator (5V-3.3V) using LDO LP5907MFX-3.3/NOPB </small>

<small>Figure 15. User interface </small>

<b>High-speed external (HSE) clock oscillator: Choosing ECS ECS-2520MV-080-CN-TR </b>

• Frequency 8MHz • Frequency stability ±25ppm • Operating temperature -40-85°C

</div><span class="text_page_counter">Trang 21</span><div class="page_container" data-page="21">

20 • Frequency 32.768KHz

• Frequency stability ±20ppm • Operating temperature -40-85°C

<b>LCD: choosing 10kΩ potentiometer to adjust the contrast of the LCD </b>

<b>Emergency button circuit: to avoid bounce effect, implementing a hardware debounce circuit </b>

as shown in figure 14, connecting to 5V-tolerant PC12 pin of the MCU

<small>Figure 16. Emergency button circuit </small>

• Choosing Schmitt trigger ON Semiconductor NL17SZ14DBVT1G

o DC input voltage -0.5-6.5 V

The pull-up resistor should not be too low since it will consume more power, but not too high to lead to a weak pull-up. Therefore, choosing the pull-up resistor value is as close to 1/10 of MCU pin impedance as possible. Weak pull-up mode GPIO resistance of STM32F103RF is 40kΩ, so

</div><span class="text_page_counter">Trang 22</span><div class="page_container" data-page="22">

21 The time constant of the filter should be a half of debounce time to make sure the output voltage from the filter to meet the logic level voltage requirement of Schmitt trigger in debounce period

<small>Figure 17. User interface finite state machine </small>

<b>➢ Mode selection: in the setting state, users can change the operation mode by pressing </b>

RESET to enter “mode selection”. In this state, press 1 or 2 means choosing mode 1 or 2 respectively.

</div><span class="text_page_counter">Trang 23</span><div class="page_container" data-page="23">

22

<small>Figure 18. Mode selection flow chart </small>

• Press 1 to choose mode 1 and press 2 to choose mode 2

<b>➢ Setting: enter speed (mode 1)/ number of welding points and pausing time (mode 2) into </b>

the keyboard. In case of continue operating like in the previous session, users only need to press ENTER.

<small>Figure 19. Setting flow chart </small>

</div><span class="text_page_counter">Trang 24</span><div class="page_container" data-page="24">

23

to continue

start running. If No (press 0), enter the parameters again.

<b>➢ Running: displaying the working information in each mode </b>

<b>➢ Warning: displaying the error in case the error is detected </b>

<small>Figure 20. Keyboard specification </small>

</div><span class="text_page_counter">Trang 25</span><div class="page_container" data-page="25">

24

<b>6.1.2. Control unit </b>

<small>Figure 21. Control unit finite state machine </small>

<b>➢ Idle: waiting while users entering the parameters </b>

➢ If the operation mode is mode 1 (denoted by mode==1), the controller will set the table speed that users entered from the keyboard for the motor controller to control the rotating speed of the table as desired; if the operation mode is mode 2 (mode==2), the controller will set the number of welding points and pausing time for the motor controller to control the position and pausing time of the table.

➢ While in operation, when users press PAUSE in the keyboard, value of pause variable becomes 1 then the table will temporarily stop rotating. Press PAUSE once again (pause==0) to continue working normally.

</div><span class="text_page_counter">Trang 26</span><div class="page_container" data-page="26">

25 ➢ When errors occur (error==1), the controller enters the error state. If errors are

cleared (error==0), waiting 5s to re-enter normal state; if error are not cleared after 10s, the table and controller will be emergency stopped

➢ Press START again to restart the machine after emergency stop; now if errors are cleared, waiting 5s to re-enter normal operation.

<b>➢ Error: In both modes, check the error from the motor controller. If there exist error </b>

from the motor controller, jump to the emergency stop state. Otherwise:

of the set speed), the controller will continuously recheck. After 10s, if error still exist, go to the emergency stop state.

set angle), the controller will continuously recheck. After 10s, if error still exist, go to the emergency stop state.

<small>27. state1 = intnormal_interface; 28. switch (state1) 29. { </small>

<small>30. normal_interface: 31. (error){state1 = ifwarning;} 32. state2 = intsetting; 33. switch (state2) 34. { </small>

</div><span class="text_page_counter">Trang 27</span><div class="page_container" data-page="27">

26

<small>36. (press RESET) {state2 = ifmode_selection;} 37. (press ENTER) {State2 = ifrunning;} 38. break; </small>

<small>48. (!error) {state1 = ifnormal;} 49. break; </small>

<small>50. } 51. } 52. </small>

<small>53. void control_unit () 54. { </small>

<small>55. state3 = intnormal; 56. switch (state3) 57. { 58. normal: </small>

<small>59. (error == ) { state3 = if1error_state;} 60. (button == ) {state3 = if1emergency_stop;} 61. state4 = intidle; </small>

<small>62. switch (state4)) 63. { 64. idle: </small>

<small>65. (mode == ) {state4 = if1mode_1;} 66. (mode == ) {state4 = if2mode_2;} 67. break; </small>

<small>68. mode_1: </small>

<small>69. state5 = intmode1_normal; 70. switch (state5) 71. { </small>

<small>81. state6 = intmode2_normal; 82. switch (state6) </small>

</div><span class="text_page_counter">Trang 28</span><div class="page_container" data-page="28">

<small>95. (error == && time == ) {state3 = if05normal;} 96. (time >= && error == ) {state3 = if101emergency_stop;} 97. break; </small>

<small>98. emergency_stop: </small>

<small>99. (start == && error == && time >= ) {state3 = if105normal;} 100. break; </small>

<small>101. } 102. } 103. 104. void main () 105. { 106. while (1) 107. { </small>

<small>108. user_interface(); 109. control_unit(); 110. } 111. } </small>

</div>

×