t-535-mech mechatronics ii dc conveyor motor control using ... project... · t-535-mech...

18

Upload: tranminh

Post on 18-Apr-2018

240 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

T-535-MECH Mechatronics II

DC Conveyor motor control using Arduino Uno

programmed in C

Final report

Gunnar Óli Sölvason

February 26, 2014

Page 2: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

Contents

Abstract 2

1 Introduction 3

1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Arduino Uno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.3 DC Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.4 Light sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.5 Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.6 Pulse width modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 Design and progress 7

2.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2 Component selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.1 Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.2 Transistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.2.3 Light sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.2.4 Conveyor and parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.3 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.5 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Testing 11

4 Usage 12

4.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5 Results and Discussion 12

6 Conclusion 12

6.1 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

7 Appendix 14

7.1 Timeplan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

7.2 Design documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

7.2.1 Cad drawings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

7.3 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

1

Page 3: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

Abstract

Work in progress. - Abstract chapter will be placed here.

2

Page 4: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

1 Introduction

Conveyors have a wide use in industrial applications. Moving goods around is a common task

in the real world, and a conveyor is one way to go about doing so. A wide variety of motors

can be used to drive a conveyor, with geared DC motors being a common solution.

The project discussed in this report is to use a Ardunio Uno board programmed in the C

programming language to control the speed of a small conveyor running on a DC motor with a

built in encoder. The speed of the conveyor should keep constant, even though load is applied

to it, meaning that power needs to be adjusted dynamically as the load varies with time. At

the end of the conveyor a end stop sensor senses if a piece is going to fall of the motor end of

the conveyor.

The idea for this assignment came from a list of possible topics proposed by the course in-

structor. At the time the project was chosen I had problems blinking a diode using C, so a

project of a fairly low complexity seemed like a good idea. To add a little bit to the idea

from the instructor and not just use it raw, a endstop sensor was added to the conveyor. Also,

having worked with conveyors before would mean that the focus could be on working with the

Arduino microcontroller and the programming part of the assignment. Rather than spending

a whole lot of time on physical design, which is maybe not the focus of the course, a bigger

portion of the time could go into building the software and learning the ins and outs of the

Atmel processor being used, something I have lesser experience with.

1.1 Background

The basic idea for the project is this : A Geared DC motor is connected to a power supply

and a transistor. The transistor is connected to the Arduino board, and modulated pulses from

the Arduino control how much power the motor gets. The determination of power is directly

proportional to the percentage time the port controlling the transistor is on, in other words,

the duty cycle of the pulse width modulation. If the duty cycle of the pulse width modulation

is, for example, 70%, the motor will be running at 70% of maximum power.

1.2 Arduino Uno

"The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital in-

put/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic

resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains

everything needed to support the microcontroller; simply connect it to a computer with a USB

cable or power it with a AC-to-DC adapter or battery to get started.

The Uno di�ers from all preceding boards in that it does not use the FTDI USB-to-serial

driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed

3

Page 5: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

Figure 1: Arduino Uno board.[1].

as a USB-to-serial converter. [· · · ] "Uno" means one in Italian and is named to mark the

upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions of

Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards, and the

reference model for the Arduino platform; for a comparison with previous versions, see the

index of Arduino boards [2]."

As mentioned in the summary above, from the web page of the producers of the Arduino

board, it runs on the ATmega328 microcontroller. The operating voltage of the board is 5V,

and runs at a clock speed of 16MHz. Available memory is 32KB (Flash, of which 0.5 is allocated

for the bootloader), 2KB SRAM and 1KB EEPROM.

The communication to a computer goes on through a USB port on the board, or as phrased on

the website : "The Arduino Uno has a number of facilities for communicating with a computer,

another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial

communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on

the board channels this serial communication over USB and appears as a virtual com port to

software on the computer. The '16U2 �rmware uses the standard USB COM drivers, and no

external driver is needed [2]."

1.3 DC Motors

Write background on DC motors.

1.4 Light sensor

Write background on sensor (proximity, light...)

1.5 Transistors

A transistor is essentially a switch (much like normal mechanical switches), except it has no

moving parts.

4

Page 6: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

Figure 2: A section view of a brushed DC motor. [3].

There are two types of transistors, P-Type and N-Type. This means that the transistors

semiconductor is either infused (doped) with a material that has 1 more electrons than silicon

(5e−), like phosphorus (N-Type), or you dope the silicon with a material that has 1 less electrons

than silicone (3e−), like Bohron (P-Type). What this does is, that conductivity is increased by

more electrons being able to move freely inside the semiconducting material. Note that both

of the P and N type semiconductors are neutrally charged. What the P and N describes is

whether the electron itself moves inside the semiconducting material, or the "hole" left by the

missing electron in the material with only (3e−) in it.

Figure 3 shows my illustration of a NPN transistor and its basic functionality.

Figure 3: A graphical reprisentation of a NPN transistor.

When no voltage is applied to the gate, no current �ows through the transistor, it is an open

switch, much like a mechanical switch when it is not pressed down. When voltage is applied to

the gate, the electrons in the semiconductor overcome the barrier of the depletion layer, making

a channel for electrons to �ow under the oxide layer. Now the transistor is open and current

can �ow through it. This can be done very fast, and at very high rates.

5

Page 7: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

1.6 Pulse width modulation

In the simplest explenation, pulse with modulation is varying the time between something be-

ing on and being o�. In this case the pulse with modulation goes on through a 5V pin on an

Arduino Uno board. If the pin would be o� 100% o� the time, it would give out the average

voltage of 0V. If the pin was on 100% o� the time, it would give an average output of 5V.

Equally, if the pin was altered to be on 50% o� the time and on 50% o� the time, it would give

the average power of 2.5V. For someting that would normally run at 5V, lets just say a light,

this would mean that the light would be on, but on 50% of its maximum brightness.

Pulse width modulation has a wide variety of practical uses, and here it is used to vary the

speed of a DC motor using the principle described here above.

Figure 4: Graphical representation of Pulse Width Modulation. [4].

Figure 4 shows graphically how the principle behind PWM is executed.

6

Page 8: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

2 Design and progress

The system design started with the scope of the problem being decided. This was done by

setting some functional requirements and design parameters. These parameters can be seen

Table 1. The diagram is called a FRDPARRC diagram. FR stands for functional requirements,

DP for Design Parameters, A for Analysis, R for References, the other R for Risks and C for

Countermeasures.

The FRDPARRC Diagram helps identify most crucial functional requirements and design pa-

rameters, as well as possible risk factors and their countermeasures.

Table 1: FRDPARRC Diagram for DC Conveyor. Based on [5].

FR DP A R R C

Conveyor runs

at set speed.

Di�erence

from set speed

is < ±5%Realistic goal.

Previous

experience

working with

conveyors

Speed will

variate

outside of set

range

Design good

feed-back loop

Only minority

of pieces fall

of the edge.

<1% of pieces

fall of the

edge of the

conveyor.

100% success

rate not

realistic.

Former

experience

with

conveyors.

More than 1%

fall o� edge.

Position

sensor

correctly.

Quick

stopping of

conveyor.

Conveyor is

aesthetically

pleasing.

Gunnar likes

the aesthetics.

Designers

should strive

for good

looks.

Good looking

things sell

better.

Looks bad.

Use golden

ratios in

design.

Pieces are not

to big for

conveyor

Max size :

100x400x400

(WxLxH)

Too big pieces

could damage

conveyor

Physical

constraints of

conveyor.

Conveyor

breaks.

Clearly de�ne

maximum size

Pieces are not

to small for

sensor

Min size :

50x50x50

(WxLxH)

Too small

pieces would

not trigger

sensor.

Sensor

datasheet

Breaks design

parameter 2

Clearly de�ne

minimum size

7

Page 9: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

After con�guring the design parameters and functional requirements of the project the group

made a crude �rst sketch of the machine. The sketch can be seen in Figure 5

Figure 5: The �gure shows the �rst crude sketch of the idea.

The sketch shows...

This can be described in a step by step manner like so :

1. 1

2. 2...

2.1 Requirements

All the main requirements for the project have been analysed in the FRDPRRC diagram in

section 2. (ADD TEXT HERE)

2.2 Component selection

This chapter deals with the reasons behind the selection of components for the project, and

goes through a little analysis on each and every one of the parts chosen.

2.2.1 Motor

When selecting a motor for a conveyor, the main selection criteria are most often speed and

torque requirements. The maximum load of the conveyor is known in most situations, both the

static load due to weight of the belt itself, and the dynamic load added by goods moving on

the conveyor. Along with that the maximum time for delivery to the end of conveyor is most

often known, so the speed can be calculated.

8

Page 10: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

Justify selection of motor with the hand calculations already made. Include the formulas.

To calculate the speed of the conveyor we need to know two parameters: The rotational speed

of the motor, and the diameter of the sprocket.

The nominal pitch diameter of the sprocket is ø41. (the sprocket is the smallest one available

for Intralox 1100 series �at top belt, as can be seen in [insert citation to intralox manual].

The rotation of the motor is 160RPM.

u = d · π = 120mm = 0, 12m

rev

160rev

min

60sec

min

= 2, 667rev

sec

v = 0, 12m

rev· 2, 667rev

sec' 0, 35m/s

This gives the speed of 0,35 m/s for the conveyor when no frictional factors are considered.

From previous experience with conveyors I am happy with that operating speed, since it is

strikes a good balance between being fast enough, and not producing a lot of noise.

2.2.2 Transistor

Justify selection of transistor and calculate size.

2.2.3 Light sensor

Justify selection o� sensor (numerical values, price, performance, availability). Analyse what

is needed from the sensor, and what sensor meets that criteria the best.

2.2.4 Conveyor and parts

Justify selection for parts in conveyor.

2.3 Software

The software used to control the motor is written in C using Eclipse equipped with AVRDude

to compile the code and send it to the Arduino board. The entire code is written speci�cally for

this project, without relying on built in libraries of the ANSI standard C code. An exception

for this is the io.h header �le and the interrupt.h header �le, which were allowed for use by the

9

Page 11: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

instructor of the course.

The software is split into...(add more text here on the software when ready)

2.4 Hardware

The hardware used for this project was as follows :

- A computer (laptop/desktop pc) for programming.

- Arduino Uno board.

- USB Cable (to connect the AU board to the computer)

- DC Gearmotor with Encoder (Hennkwell HG37D670WE12-052FH was used for this project,

others could be considered)

- Light sensor (velja sensor...)

- Conveyor (Frame, Conveyor belt and supports)

- Control circuit (breadboard, transistor, 2x7segment display)

The motor was sourced from the Electronics lab of the Reykjavík University and the Arduino

Uno board was bought for use in Mechatronics I preliminary class last semester. The most

complicated hardware of the project is the conveyor construction. The conveyor was supplied

pro bono from a company the remains anonymous by request. This means that all the parts

for the project were sourced for free, so there is no cost �gure next to the parts in the BOM.

2.5 Limitations

Limitations for this project are the same as for most design projects, time and money. The

project does have a limited budget, and the timeframe is only 8 weeks. This limits the features

the project can have.

For the conveyor to work properly, it needs to be on a solid base and placed horizontal. All

calculations made assumed that the conveyor would not be inclined, since that adds load on

the relatively small motor. Since the control circuit is open, and not in any way protected, the

conveyor is obviously not equipped to be used in factory environment since its not waterproof.

The conveyor can only handle loads inside of the speci�cations of the motor (INCLUDE MO-

TOR CALCULATIONS HERE!!). Since the actual belt itself can carry upwards of a 1000kg

without breaking, the motor torque will be a limiting factor long before that load is reached,

along with the conveyor frame breaking. Since the constructional integrity of the conveyor was

far out of the scope of this project, no calculations were carried out to proof how much it could

10

Page 12: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

withstand, but it is safe to assume that it will be a matter of no concern here. The maximum

torque of the motor is 0,65 Nm, so the motor will stall long before any physical damage is

done to the conveyor. Since the width of the conveyor is roughly 100mm, and the length is

about 500mm it can obviously not handle pieces or items exceeding that size. For the sensor

to be able to sense items on the conveyor, the items must be of adequate size. Maximum and

minimum sizes are de�ned in the FRDPARRC diagram, table 1.

Due to the rotational speed of the motor, the conveyor wont be able to run over 0.35 me-

ters per second without seriously lowering the torque the motor can handle. It could probably

be run faster, but it won't be guaranteed. The maximum rated speed is 0.35m/s.

3 Testing

Work in progress.

11

Page 13: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

4 Usage

To use the conveyor one has to follow a simple procedure. The conveyor is simply connected

to power, the speed is set, and the conveyor should run.

It should by then run at the set speed, and maintain that speed even though load is added.

The physical button allowing or not allowing pieces to fall of the motor-end of the conveyor

can be set, allowing either of those two options.

4.1 Installation

For the conveyor to be able to run, the correct software needs to be installed onto the Arduino

board �rst. The software needed can be found in the appendix.

Step by step installation guide for for the Conveyor:

1. Turn on a computer.

2. Start operating system of own choice.

3. Start Eclipse software developement enviroment.1.

4. Connect the Arduino via USB cable to one of your computer's USB ports.

5. Upload the conveyor software to the Arduino board.

With the software installed on the Arduino board, the conveyor only needs external power to

run. This is done by plugging in the power cord supplied with the conveyor.

4.2 Instructions

Work in progress.

5 Results and Discussion

Work in progress.

6 Conclusion

Work in progress.

1This needs to be installed. If you have not installed Eclipse, it can be downloaded fromhttps://www.eclipse.org/downloads/

12

Page 14: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

6.1 Future work

Work in progress.

13

Page 15: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

7 Appendix

7.1 Timeplan

This is the original timeplan of the project turned in when the project was selected in week 5.

• Week 6 : Scope project, source parts.

• Week 7 : Design hardware.

• Week 8 : Design software.

• Week 9 : Build circuit.

• Week 10 : Build hardware.

• Week 11 : Start on report, �nish hardware.

• Week 12 : Simultaneously work on writing and programming.

• Week 13 : Writing, programming.

• Week 14 : Finish writing report, make presentation, �ne tune conveyor

This is the timeplan as it was executed. Notice the di�erence in week numbers. Green tasks

have already been �nalized. Orange parts are underway. Others have not been started.

• Week 8 : Scope project, source parts.

• Week 8 : Design hardware.

• Week 8 : Design software.

• Week 9 : Build circuit.

• Week 10 : Build hardware.

• Week 11 : Start on report, �nish hardware.

• Week 12 : Simultaneously work on writing and programming.

• Week 13 : Writing, programming.

• Week 14 : Finish writing report, make presentation, �ne tune conveyor

14

Page 16: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

7.2 Design documents

7.2.1 Cad drawings

Work in progress.

15

Page 17: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

7.3 Code

This is the source code that was used for the conveyor ??. The code would need to be tweaked

for the �nal design.

belowcaptionskipbelowcaptionskip belowcaptionskipWork in progress.

16

Page 18: T-535-MECH Mechatronics II DC Conveyor motor control using ... project... · T-535-MECH Mechatronics II DC Conveyor motor control using Arduino Uno programmed in C ... speed of a

References

[1] Web Page. [Online]. Available: https://dlnmh9ip6v2uc.cloudfront.net//images/products/

1/1/0/2/1/11021-01a.jpg

[2] Arduino, �Arduino uno,� Webpage, 2014. [Online]. Available: http://arduino.cc/en/Main/

arduinoBoardUno#.Uwyxk_l_s5Q

[3] 2b�y, �Dc motor anatomy,� Web page. [Online]. Available: http://2b�y.com/assets/

DC-Motor-Anatomy-sm.png

[4] Web page. [Online]. Available: http://d32zx1or0t1x0y.cloudfront.net/2011/06/

atmega168a_pwm_02_lrg.jpg

[5] A. H. Slocum, Precision Machine Design. Society of Manufacturing Engineers, 1992.

17