Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OBJECTIVEs: To interface a DC motor to AVR. To write a program to control the speed and direction of DC motor rotation by the user.

OBJECTIVEs:

  • To interface a DC motor to AVR.
  • To write a program to control the speed and direction of DC motor rotation by the user.
  • To use serial communication for motor control (from PC)

REFERENCE:

  • Mazidi and Naimi The AVR Microcontroller and Embedded System, Chapter 16.

MATERIAL:

  • Atmel Studio
  • Proteus:
    1. AVR Atmega32 or 328
    2. DC motor module
    3. L298N or L293D module

Using Proteus, connect the DC motor to your AVR Trainer as shown in the following figure.

ACTIVITY 1

Write and run a program to rotate the DC motor clockwise continuously.

ACTIVITY 2

After making sure that Activity 1 works, connect two switches to one of the ports and write and run the following program:

Use the SW1 and SW2 to choose the speed of rotation, as shown in the following table.

SW2

SW1

Duty Cycle

0

0

50%

0

1

65%

1

0

80%

1

1

100%

ACTIVITY 3

Connect a switch to a pin on one of the PORTs. Use this SW for the purpose of choosing clockwise (CW) or counter clockwise (CCW) direction. Write and run a program to rotate the motor as follows:

SW=0 for CW.

SW=1 for CCW.

  1. What is the use of Opto-isolator in Figure 16-8? Does your DC module have one?

  1. In Activity 1, explain how you turned the DC motor on and off.

  1. In Activity 2, explain how you controlled the speed of DC motor.

  1. Explain the PWM

  1. What is the disadvantage of using a group of instructions (instead of PWM feature of AVR) in controlling the speed of the DC motor?

ACTIVITY 4

Using the knowledge acquired in the Serial interface lab, apply the following requirements:

  • Write a program to transfer a serial command (from a terminal program to Proteus) to run the DC motor at 50%, 60% then 80% speed of rotation.
  • Display the speed in an LCD both as a percentage and with speed units (such as: rotation per minute); refer to the datasheet of the motor to convert to a speed unit.
  • Send a stop command to the motor (from the terminal program) , make sure the motor has stopped and display the stop state in the LCD.
  • Write a program that increases the speed of the motor from 0% to 100% by steps of 10% and dynamically display the current speed in an LCD; Finally, use serial communication (using a command from the terminal) to launch this process (increase the speed from 0% to 100% by steps of 10% and dynamically display the current speed in an LCD) from your PC (terminal program).

Note:

  • The project should be performe
  • d in two teams (please chose your partner(s).
  • Collaborative work is strongly encouraged and even required.
  • Individual knowledge of each student may be tested by professor.
  • The teams which demonstrate the project successfully before 01.03.2020 will be awarded by additional bonus.
  • Bonuses are judge by the professor according to performance (may vary between 30% and 5% additional bonus)image text in transcribed
ACTIVITY 4 Using the knowledge acquired in the Serial interface lab, apply the following requirements: WORKSHEET Name: Last Name: Class: final project: Write a program to transfer a serial command (from a terminal program to Proteus) to run the DC motor at 50%, 60% then 80% speed of rotation. Display the speed in an LCD both as a percentage and with speed units (such as: rotation per minute); refer to the datasheet of the motor to convert to a speed unit. > Send a stop command to the motor (from the terminal program), make sure the motor has stopped and display the stop state in the LCD. Write a program that increases the speed of the motor from 0% to 100% by steps of 10% and dynamically display the current speed in an LCD; Finally, use serial communication (using a command from the terminal) to launch this process (increase the speed from 0% to 100% by steps of 10% and dynamically display the current speed in an LCD) from your PC (terminal program)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions