Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views18 pages

Motor and Encoder Lab2

The lab assignment investigates the interaction between DC motors, encoders, and DC tachometers for measuring speed, direction, and position. It includes a detailed methodology for setting up the experiment, analyzing data, and calculating motor speed and direction based on encoder outputs. The findings highlight the importance of understanding potential sources of error and the practical applications of these concepts in motion control systems.

Uploaded by

youssef3wahba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views18 pages

Motor and Encoder Lab2

The lab assignment investigates the interaction between DC motors, encoders, and DC tachometers for measuring speed, direction, and position. It includes a detailed methodology for setting up the experiment, analyzing data, and calculating motor speed and direction based on encoder outputs. The findings highlight the importance of understanding potential sources of error and the practical applications of these concepts in motion control systems.

Uploaded by

youssef3wahba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Faculty of Engineering

Department of Mechanical Engineering


Mechatronics and Robotics Engineering Program
23MTRN06I Measurement and Analysis
Semester 2 2023/2024
Lab Assignment No. 2

Name Youssef Wahba Youssef

ID 221214

Criteria Grade Total


Report quality.

Conceptual understanding.

Programming code quality.

hardware setup proficiency.

Integration of hardware and software.

1. Introduction…………………………………………(2)
2. Methodology………………………………………..(3&4)
3. Analysis …………………………………………….(5&6)
3.1 Data Table………………………………………(5)
3.2 Calculations…………………………………….(6)
4. Flowcharts and Pseudocode………………………(7,8,9)
4.1 Flowchart………………………………………..(7)
4.2 Pseudocode………………………………………(8&9)
5. Results and Discussion………………………..(10,11,12,13)
5.1 Results table…………………………………….(10)
5.2 Graphs…………………………………………..(11)
5.3 Error discussion ………………………………..(12&13)
6. Conclusion………………………………………….(14)
7. References…………………………………………(15)
8. Appendices…………………………………………(15&16)

1-Introduction:
1
Direct current (DC) motors, which transform direct current electrical energy into
mechanical energy, are essential parts of many applications. The Lorentz force, which is
applied to a current-carrying conductor in a magnetic field, powers a DC motor. This
force affects the motor's torque and speed, and for accurate control in engineering
applications, it is essential to comprehend these dynamics.

DC tachometers are essential for tracking and managing motor speed in addition to DC
motors and encoders. An apparatus that transforms rotational speed into an analogue or
digital electrical signal is called a DC tachometer. A DC tachometer provides a direct and
instantaneous measurement of a motor's performance since its voltage output is
proportionate to the motor's speed. This function is very helpful in feedback control
systems when it's necessary to maintain certain speed limits.

You have already learned about encoders, which provide a way to monitor motor position
and speed. They can be either absolute or incremental; absolute encoders give precise
location data, while incremental encoders give relative position information. The
incorporation of an encoder into a DC motor enables accurate regulation of the motor's
operating characteristics, hence augmenting the overall performance of the system.

We may gain an understanding of DC motors, encoders, and DC tachometers by


examining their interactions and importance in motion control and other related domains.
This experiment intends to investigate these correlations by giving participants hands-on
experience measuring and interpreting the speed, direction, and position of a DC motor
using an encoder, as well as examining the function of a DC tachometer in speed
measurement.

2-Methodology:

2
1. Preparing Equipment and Components

The experiment used the following basic components:

-The main module (BSUB/BSPC) acted as the centre unit for power and oscilloscope
connection. It provided the 5Vdc and 12Vdc power sources required to run the DC motor
and encoder
.
-Module (BS 7): This module, which consisted of a DC motor and an encoder, was
critical for studying rotational speed, direction, and positional feedback.
Before beginning the experiment, we reviewed the manuals that came with the
BSUB/BSPC and BS-7 modules to ensure that we were following the proper setup
methods and component specifications.

2. Assembly of the Apparatus.

The assembly process went as follows:

-To ensure the safety of the connections, the main module (BSUB/BSPC) was unplugged
from any power source.
-Connected the BS-7 module's DC motor to the main module's 12Vdc output. Connected
the encoder's output to the oscilloscope input channels for real-time signal monitoring.
-All components were grounded to avoid electrical noise from interfering with encoder
readings.

3. System checks and calibrations:

3
The following calibration and system checks were carried out before measurements were
recorded:

-Set the oscilloscope parameters in accordance with the BSUB/BSPC manual's


instructions to precisely record high-resolution waveforms from the encoder.
-Adjusted the oscilloscope's zero-offset to guarantee that the waveform readings began at
a baseline of zero volts.
- Before running the entire battery of tests, the DC motor was tested at a low power
setting (5Vdc) to ensure operational functionality.

4. BS-7 with all its elements.

3-Analysis:

The objective of this lab was to examine the link between the encoder's output signals

4
and the voltage that was applied to the DC motor. As the motor shaft rotates, the encoder
generates pulses, and the frequency of these pulses indicates the motor's speed. We can
get the motor speed in revolutions per minute (RPM) using a known PPR of 2000. The
number of pulses the encoder emits throughout a full rotation of the motor shaft is
measured by the PPR.

3.1. Data Table:

no Motor Input Wave Time *10^-4 End


Voltge (start)
1 3.047 2.2 3.8

2 4.009 1 2

3 5.027 1 1.65

4 6.017 1 1.55

5 6.534 2 2.47

6 7.086 2.8 3.22

7 8.011 2 2.34

8 9.098 4 4.36

9 10.094 3 3.3

10 10.897 4 4.24

3.2 Calculations:

1. Frequency Calculation:

5
The oscilloscope may be used to measure the time interval (T) between pulses, which is
used to determine the frequency of the pulses. The reciprocal of the period (T), or the
duration of a single pulse cycle, is the frequency (f):

f = 1/T
Where:

f is the frequency in hertz (Hz),


T is the time period in seconds (s) between two consecutive pulses.

2. Speed Calculation(RPM):

RPM = (f/500)*60

Where:
RPM is the revolutions per minute,
f is the frequency in hertz (Hz),
60 converts from revolutions per second to revolutions per minute,
500 number of cycles.

3. Direction Determination:
We examine the phase connection between the pulses coming from the encoder's Channel
A and Channel B in order to ascertain the motor's direction. The motor is rotating in a
forward direction if Channel A leads Channel B, and in a backward direction if Channel
B leads Channel A.

4-Flowcharts and Pseudocode:

6
Flowchart:
A typical flowchart for reading encoder pulses might include the following steps:

1.Start
2.Initialize Variables (motor_speed, position, direction, previous_A, previous_B)
3.Read Input from Channel A and B
4.Determine Direction
4.1. If A leads B, direction is forward
4.2. If B leads A, direction is backward
5.Calculate Position
5.1. Increment or decrement based on direction
6.Calculate Motor Speed
6.1.Use the difference in position over time and PPR
7.Output Results (motor_speed, direction, position)
8.Repeat (Typically in a loop for continuous reading)
9.Stop

Pseudocode:
// Initialize variables
position = 0
previous_position = 0

7
motor_speed = 0
direction = "Unknown"
previous_A = 0
previous_B = 0
PPR = 2000 // Pulses per revolution
time_interval = 0.1 // Time interval for speed calculation in seconds

// Main loop for reading encoder pulses


while true do
current_A = read_encoder_channel_A() // Read current state from encoder channel A
current_B = read_encoder_channel_B() // Read current state from encoder channel B

// Determine direction
if current_A == 1 and previous_B == 0 and current_B == 1 then
direction = "Forward"
else if current_B == 1 and previous_A == 0 and current_A == 1 then
direction = "Backward"
endif

// Calculate position change based on direction


if direction == "Forward" then
position = position + 1
else if direction == "Backward" then
position = position - 1
endif

// Calculate motor speed (RPM)


if elapsed_time >= time_interval then
motor_speed = ((position - previous_position) / PPR) * (60 / time_interval)
previous_position = position // Reset position for the next speed calculation
reset_elapsed_time() // Reset the elapsed time for the next calculation
endif

8
// Output the results
output(motor_speed, direction, position)

// Store previous states


previous_A = current_A
previous_B = current_B

// Delay for stability, this will depend on your system


delay(0.01)
endwhile

5-Results and Discussion:


5.1 Results table
Since T= end time – start time ,

9
F = 1/T ,
RPM = (f/500)*60.
no Motor Input Channel (A) Channel (B) Motor Speed
Voltge Frequency Frequency (RPM)

1 3.047 6250 6250 750

2 4.009 10000 10000 1200

3 5.027 15384.6 15384.6 1846.152

4 6.017 18181.8 18181.8 2181.816

5 6.534 21276.7 21276.7 2553.204

6 7.086 23809.5 23809.5 2857.14

7 8.011 26315.8 26315.8 3157.896

8 9.098 27777.8 27777.8 3333.336

9 10.094 33333.3 33333.3 3999.996

10 10.897 41666.7 41666.7 5000

The direction is clockwise since signal A comes before signal B

5.2 Graphs

10
5.3 Error discussion
11
Electrical interference and noise:

Source of Error: Inaccurate speed or direction readings might result from electrical
noise distorting the encoder outputs.

Solution: Keep signal wires away from power lines and other sources of electromagnetic
interference, and use shielded cables for all connections. Putting low-pass filters in place
can also aid in reducing high-frequency noise.

2. Mechanical Misalignment:

Source of Error: The accuracy of speed and position readings may be impacted if the
encoder is not precisely aligned with the motor shaft. This can lead to abnormalities in
the pulse output.

Solution: is to make sure the encoder is positioned on the motor shaft precisely and
firmly. Maintain and verify the alignment on a regular basis as part of the experimental
setup.

3. Variable Power Source:

Source of Error: Variations in the measurements may be caused by fluctuations in the


power supply to the encoder or motor.

Solution: To guarantee constant voltage levels, use a controlled power source for the
encoder and the motor. Use a voltmeter to keep an eye on the power supply and correct
any variations.

12
4. Limitation on Encoder Resolution:

Source of Error: The encoder's resolution (PPR value) restricts how precisely positions
and speeds can be measured.

Solution: Although the encoder's resolution is a fixed feature, it is crucial to comprehend


how it affects measurement accuracy. Use an encoder with a higher PPR value for
applications that demand more precision.

5. Environmental Factors:

Source of Error: Variations in temperature, humidity, or dust might impact the


functionality of the parts, particularly the optical parts of the encoder.

Solution: Try to maintain environmental control throughout the trial. Enclosures can
shield delicate parts from moisture and dust while preventing large temperature swings
throughout the experiment.

6. Human Error

Source of Error: Inaccurate setup, inaccurate data entry, or erroneous result


interpretation can all result in errors.

Solution: Adhere to a uniform setup and data recording process. Verify consistency by
cross-checking recorded data and computations and making sure several readings are
obtained for every measurement.

6- Conclusion:

13
In order to measure speed, direction, and position, the experiment sought to examine the
functional properties of a DC motor interfaced with an incremental encoder. Our
approach, which involved using a main module for signal processing and a DC motor
connected to an encoder (BS-7 module) for the practical setup, allowed us to successfully
collect and analyse data from the encoder.

The theoretical concepts guiding DC motor operations are supported by our findings,
which show a clear correlation between the motor's speed and input voltage. With a PPR
(Pulses Per Revolution) of 2000, the encoder produced high-resolution data that made it
possible to determine direction and speed with accuracy. The precise calculation of motor
speed and direction was made possible by the examination of encoder output signals,
especially those from channels A and B. This highlights the encoder's crucial function in
motion control systems.

The experiment also demonstrated how important it is to comprehend and deal with
possible mistake causes, such as electrical noise, mechanical misalignment, and
inaccurate signal decoding. Our experimental findings were far more reliable after
recognising and reducing these mistakes.

Moreover, the process of converting physical events into computable logic through the
development of a flowchart and pseudocode for deciphering the encoder signals
reinforced the multidisciplinary aspect of engineering problem-solving.

In summary, our experiment strengthened theoretical understanding of DC motors and


encoders while also illuminating the practical aspects of their interaction and the
challenges associated with gathering and analysing data in the real world. For the design
and implementation of complex motion control systems in a variety of technical
applications, this kind of expertise is essential.

14
7-References:

British University in Egypt. (March 2011). PRACTICAL EXERCISES MANUAL BS-7.


Retrieved from edibon . https://learn1.bue.edu.eg/mod/resource/view.php?id=240830 .

Pennsylvania State University. (2018). DC Motor - ME Hardware Kit.


Retrieved from
https://sites.psu.edu/mehardwarekit/home-page/getstarted/setup-
circuit/dc-motor/.

8- appendices:

Flowchart:
A typical flowchart for reading encoder pulses might include the following steps:

1.Start
2.Initialize Variables (motor_speed, position, direction, previous_A, previous_B)
3.Read Input from Channel A and B
4.Determine Direction
4.1. If A leads B, direction is forward
4.2. If B leads A, direction is backward
5.Calculate Position
5.1. Increment or decrement based on direction
6.Calculate Motor Speed
6.1.Use the difference in position over time and PPR
7.Output Results (motor_speed, direction, position)
8.Repeat (Typically in a loop for continuous reading)
9.Stop

15
Pseudocode:
// Initialize variables
position = 0
previous_position = 0
motor_speed = 0
direction = "Unknown"
previous_A = 0
previous_B = 0
PPR = 2000 // Pulses per revolution
time_interval = 0.1 // Time interval for speed calculation in seconds

// Main loop for reading encoder pulses


while true do
current_A = read_encoder_channel_A() // Read current state from encoder channel A
current_B = read_encoder_channel_B() // Read current state from encoder channel B

// Determine direction
if current_A == 1 and previous_B == 0 and current_B == 1 then
direction = "Forward"
else if current_B == 1 and previous_A == 0 and current_A == 1 then
direction = "Backward"
endif

// Calculate position change based on direction


if direction == "Forward" then
position = position + 1

16
else if direction == "Backward" then
position = position - 1
endif

// Calculate motor speed (RPM)


if elapsed_time >= time_interval then
motor_speed = ((position - previous_position) / PPR) * (60 / time_interval)
previous_position = position // Reset position for the next speed calculation
reset_elapsed_time() // Reset the elapsed time for the next calculation
endif

// Output the results


output(motor_speed, direction, position)

// Store previous states


previous_A = current_A
previous_B = current_B

// Delay for stability, this will depend on your system


delay(0.01)
endwhile

17

You might also like