0% found this document useful (0 votes)
5 views

Module 01 1 - Merged

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Module 01 1 - Merged

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

EE351 Module 01: Game of numbers

Goal of the module: The goal of this module is to learn the use of Arduino UNO pins as digital
output and input pins. In order to start writing codes for Arduino you will first use the Arduino
simulator provided in TinkerCad (Link in [3])). The following objectives need to be implemented on
TinkerCad.
Objective I

1. Simulate a simple LED blinking program in TinkerCAD first to get used to writing codes in
Arduino.
TinkerCad supports Arduino simulation. To start make a students account in TinkerCad.
Steps: Login — Circuits — Create in circuit — Assemble using the components.

Objective II

A. Design a 10 second timer using pins of Arduino UNO as output. While designing autonomous
systems, it is important to use the pins of the processor wisely and economically. Hence, use
a BCD to 7-segment decoder. We will use this timer in objective B. Try to write an efficient
code using loops, if required.

B. Implement a 2-player game in Arduino (with one of the players being the Arduino). The rules
of the game are

(a) The game is between the Arduino board (say Player A) and you (say Player B).
(b) At first Player A will display a random number in the seven segment display (0-9). Say
the number displayed is x. This will be displayed in the 7-segment display for 2 seconds.
After 2 seconds the timer designed in Objective A starts. Player B will have to input the
number one’s complement of x mod 3 with the help of switches connected to the Arduino
board within the 10 seconds being displayed in the timer.
(c) To signal if the answer by Player B is correct or wrong, a buzzer would be used. If Player
B is correct, then the buzzer would beep once. Else the buzzer would give beep thrice
to indicate that the answer is wrong. The three beeps for wrong answer should sound
different.

1
(d) Player B needs to input his/her answer within 10 seconds. The timer designed in Objective
A will be used to display the time.
The timer should count from 0 - 9 and stop at the tenth second. This means that the
timer should display 0 at the end of the count.

Report Guidelines: The report to be submitted must have the following:

1. Objectives of the module.

2. Circuit diagram with proper labelling.

3. Block diagram of the system designed (for Objective 1B).

4. Flowchart of the algorithm.

5. Observations, if any.

6. Answers to the questions below.

Answer the following:

1. How did you achieve a delay of 1 sec for the timer? Explain in details the working principle.

2. What is the input supplied to the piezo-buzzer? Explain the working principle of the piezo-
buzzer based on the input you provided.

3. Is the system developed in Objective B a control system? Justify.

References
[1] https://www.arduino.cc/reference/en/language/functions/digital-io/pinmode/

[2] https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/

[3] https://www.tinkercad.com/

2
OBSERVATION SHEET
This sheet needs to be attached to the report.

1. Demonstrate Objective-I.

TA Signature with Date:

2. Demonstrate Objective-II.

TA Signature with Date:

3
Module-02: Dino can jump

Goal of the module:

1. To design a simple sensor-network to achieve an objective.

2. To learn the use of analog input pins and Analog-to-Digital (ADC) of an Arduino Uno.

3. To learn to interface a servo motor to an Arduino.

4. To learn the notion of calibration.

Pre-lab work (No submission required):

1. Play the dino game which can be accessed using the following link: chrome://dino/. In this
game, a dinosaur (dino) has to jump over incoming obstacles. In general (provided you have
default theme in your OS), the background of the screen is white and the obstacles are grey in
colour when the game starts. The dino jumps when the space-bar of the keyboard is pressed.

2. Watch the objective video (Check file section in MS-Teams).

Module-02 Objectives: The objective is to design LDR-based sensor network to help us automate
Google’s Dino game.

Figure 1: Dino game with white background

After the dino has traversed some distance avoiding the obstacles successfully, the background of
the game changes to black as shown in Figure 2.
This toggling of the background colour keeps
on happening throughout the game. Your objec-
tive for this module is to design a system that
automates playing this game. An example for
the same is shown in the video module (Check
file section in MS-Teams). Note that the set-
up demonstrated in the video module does not
completely automate the game. It automates the
game only when the background of the game is Figure 2: Dino game with black background
white as shown in Figure 1. Your task is to au-
tomate the complete game.

1
1. While desigining a sensor based system, it is essential to check the specifications of sensors
carefully. In some cases you might need to subject the sensor to different environmental condi-
tions to get different readings from them. For example, for a photoresistor you might need to
measure the resistance at different lighting conditions. On the other hand, for a temperature
sensor you might have to check the output voltage corresponding to different temperatures.
Although in most cases the datasheets of the sensors have these values documented, it is a
good practice to cross-check those values during practical implementation. In this module you
have access to three LDRs.
2. Another important facet of sensor based system design is sensor placement. Notice the place-
ment of the two LDRs in the video module. The sensors are placed such that they capture
the obstacles. Wrong placement of sensor can lead to failure of the system. Hence, sensor
placement is critical in sensor based system design. Keeping this in view, you will need to show
the placement of the sensors in the report (a picture of the set-up will do).
Since the photoresistors have different specifications and your code will change depending on
the location of the sensors, do not forget to label the sensors using the names given above
(LDR-01, LDR-02, LDR-03).
3. The action of the servomotor pressing the spacebar needs to be simulated by moving the
servomotor from xo to y o and back again to xo . The value of x and y depends on your setup.
The values for your setup needs to be clearly stated in the report.
4. While playing the game you will realize that the speed of the obstacles approaching dino keeps
on increasing. This means that the dino needs to jump faster as you move ahead in the game.
You will have to calibrate your set-up for this.
Report Guidelines: The report to be submitted must have the following:
1. Objectives of the module.
2. Circuit diagram with proper labelling.
3. Flowchart of the algorithm.
4. Observations, if any.
5. Answers to the questions below.
Answer the following:
1. Is the designed system an open-loop system or a closed-loop system? Depending on your answer
map the components of your system to the different building blocks of an open-loop/closed-loop
system as shown in Figure 3 and Figure 4 (modify the blocks if required).

Figure 3: Open-loop system


Figure 4: Closed-loop system

2. On executing the command servo.write(30) in Arduino Uno, a servomotor connected to the


suitable pin of the Arduino rotates 30o . How does the servomotor rotate to the designated
angle? (Explain the internal working principle)

2
3. Explain how ADC is used to take input from the LDR.

4. How did you calibrate the dino jump?

5. What are the shortcomings of your design? Why cannot you completely automate the system.

6. Take a screenshot of the final score you could achieve before your design fails.

3
OBSERVATION SHEET
This sheet needs to be attached to the report.

1. Show the interfacing of servo-motor with Arduino. Rotate the motor to a particular angle and
back to original position.

TA Signature with Date:

2. Show using serial monitor that the LDR has been successfully interfaced with the Arduino.

TA Signature with Date:

3. Demonstrate that all objectives have been fulfilled. (The set-up should work well even after
background change.)

TA Signature with Date:

4
Module-03: Keep your distance

Obstacle detection and avoidance are crucial aspects of designing autonomous vehicles,
space rovers, and similar systems. Various sensors, such as ultrasonic sensors and cameras,
are employed to detect obstacles, with the choice of sensors depending on the application and
environment. In windmills, motors are used to rotate the blades. However, birds flying in the
path of the windmill can be at risk of colliding with the rotating blades, potentially leading
to fatal incidents. A simple sensor network using ultrasonic sensors can be implemented to
halt the rotation when birds are detected. Therefore, an ON-OFF controller for the DC motor
is needed. This module aims to develop a basic ON-OFF controller for a DC motor. The
objectives of this module are as follows:

Objectives: Design an autonomous obstacle detection system using an ultrasonic sensor to


stop the windmill when an obstacle (bird) is detected.

Report Guidelines:
1. Objectives of the module.

2. Circuit diagram with proper labelling.

3. Block diagram of the system designed.

4. Flowchart of the algorithm.

5. Observations, if any.

6. Answers to the questions below.


Answer the following:
1. Draw the block diagram of the system you have implemented in this module. Is it a
closed loop system?

2. How do you compute distance from the data obtained from the ultra-sonic sensor?

3. Why did not you connect the motor to the Arduino pins and switched them on and off?

4. Could we have used 2N2222 or BC547 transistor to drive motor1 M1?

5. Could we have used the L293D module to drive the motor?

6. Explain the working of the circuits driving the motor.

7. How did you eliminate chattering effect? If you are given the freedom of using some other
controller other than ON-OFF controllers, which would you choose such that the effect
of chattering is reduced? Justify your answer.
1
Specifications of M1: Operating Voltage: 2.5 - 6V, Operating Current: 130 - 220mA, Flow Rate: 80 - 120
L/H, Maximum Lift: 40 - 110 mm.

1
OBSERVATION SHEET
This sheet needs to be attached to the report.

1. Demonstrate the interfacing of the ultrasonic sensor with the Arduino UNO. You should
display the distance to an object, as measured by the ultrasonic sensor, on the serial
monitor.

TA Signature with Date:

2. Demonstrate that the DC motor has been successfully interfaced with the Arduino UNO.

TA Signature with Date:

3. Demonstrate that all objectives have been fulfilled.

TA Signature with Date:

4. Show that chattering effect has been eliminated in your design.

TA Signature with Date:

2
Module-04: Speed control of DC Motor

Sluice gates are important structures used in various water management and control sys-
tems for a variety of purposes such as Water Flow Control, Flood Control, Irrigation, Water
Reservoir Management, Navigation and Transportation, Hydropower Generation etc. In order
to operate the gates, motors are used. The speed at which the gates are to be opened or closed
are important in many applications. In this module, we want to control the speed at which the
sluice gate will operate. We will use a DC motor with encoder to replicate a motor used in sluice
gate. Note that the speed of rotation of motors is directly related to the input voltage. The
higher the input voltage, the higher will be the rotational speed of the motor. Of course, the
input voltage should not be more than the recommended operating voltage of the motor. Thus,
in order to control the speed of a DC motor, we will need to provide a variable voltage to the DC
motor. Usually, a pulse width modulation technique is used to generate a variable DC voltage
from constant DC voltage source. For more on this check: https://microcontrollerslab.com/dc-
motor-l293d-motor-driver-ic-arduino-tutorial/

Objectives:

1. Use a motor with encoder to measure the speed of the motor.

2. Use a LCD module to display the rpm measured.

3. Assuming that the maximum rpm of the motor is r at maximum rated voltage, we provide
the desired speed for motor using a DIP switch. As indicated in the table below, 4 different
reference speeds can be given using the DIP switch:

State Reference speed


0 90% of r
1 80% of r
2 70% of r
3 60% of r

Display the desired rpm on the LCD, as well. The format to display the rpm is as follows:

Des: ...... and Cur: ......

The maximum rated voltage of the motor will be provided by the TA.

4. Design a PID controller to attain the desired rpm. While tuning the controller gains first
start with only proportional controller, i.e, keep KI = 0 and Kd = 0. Increase Kp and
check the output using serial port plotter of the IDE. Based on your requirement, whether
you want steady state or transient performance improvement change KI and Kd value.

1
Pre-lab work:
1. Read about controlling speed of a DC motor using PWM and L293D module.
(see https://microcontrollerslab.com/dc-motor-l293d-motor-driver-ic-arduino-tutorial/).

2. Read about interfacing LCD to Arduino Uno.


(see https://www.arduino.cc/en/Tutorial/LibraryExamples/HelloWorld)

3. Read about serial port monitoring and plotting.


(see https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-serial-plotter)
Report Guidelines: The report to be submitted must have the following:
1. Objectives of the module.

2. Circuit diagram with proper labelling.

3. Block diagram of the system designed.

4. Flowchart of the algorithm.

5. Observations, if any.

ˆ Snap shots of the serial monitor needs to be submitted with your observations. You
have to show how is the performance of the system effected for different values of
Kp , KI , and Kd .
– With KI = Kd = 0 and increasing Kp .
– With Kp = Kd = 0 and increasing KI .
– With Kp = KI = 0 and increasing Kd .
– Finally, with the tuned Kp , KI and Kd value.
ˆ Plot of the output from the encoder with and without the filter.

6. Answers to the questions below.


Answer the following:
1. Draw the block diagram of the closed-loop system you implemented in this module. What
is the set point for your system?

2. Why did you choose a closed-loop system for speed control? Could an open-loop system,
which involves simply providing the required PWM input to the motor to achieve the
desired RPM, be sufficient?

3. What is the value of r for the motor provided, and what is its maximum rated voltage?

4. How did you tune the controller gains? Did you use the Ziegler-Nichols Method? Provide
a justification for your approach.

5. What is the expected root locus for the system?

6. What happens when you increase the value of Kp while keeping KI and Kd at zero?
Relate your observations to the root locus diagram you created earlier.

7. What type of filter did you use to clean the recorded data (e.g., high pass, low pass)?
Based on the encoder output plot, explain how the filter helped improve data quality.

2
OBSERVATION SHEET
This sheet needs to be attached to the report (print on both sides)

1. Demonstrate the interfacing of the motor and the LCD to the Arduino UNO. You should
be able to display the desired and current rpm on the LCD in the format provided.

TA Signature with Date:

2. Show the TA how the data from the encoder is cleaned using a filter. Provide screenshots
of the data before and after applying the filter to demonstrate the effect.

TA Signature with Date:

3. Demonstrate to the TA how did you find the value of r.

TA Signature with Date:

4. Demonstrate the effect of increasing Kp keeping KI and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of Kp .

TA Signature with Date:

3
5. Demonstrate the effect of increasing KI keeping Kp and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of KI .

TA Signature with Date:

6. Demonstrate the effect of increasing Kd keeping Kp and KI zero. Show the TA that you
have taken screenshots of the plot for various values of Kd .

TA Signature with Date:

7. Demonstrate the tuned system to the TA, ensuring that the desired RPM matches the
actual speed after tuning. Note that once the controller is tuned, you cannot adjust the
controller gains. The TA will verify all four desired speeds and ensure that the system
reaches at least 95% of each desired speed. Additionally, the observation sheet should
include the settling band for the tuned system.

TA Signature with Date:

4
Module-05: Position control of DC Motor

In modern communication systems, an Antenna Positioning System is crucial for applica-


tions that require precise and stable alignment with a target signal source, such as satellite
communications, radar, and wireless networks. Since many signals are highly directional, even
minor deviations in antenna orientation can result in significant losses in signal strength or
data integrity. A reliable positioning system ensures accurate tracking and alignment, com-
pensating for the movement of targets like satellites or aircraft. This improves signal quality,
increases data throughput, and guarantees reliable communication in dynamic or challenging
environments.
To achieve this precision, PID controllers are commonly used in antenna positioning systems.
These controllers ensure that the antenna can adjust its orientation in real-time to accurately
track or align with a moving target. In this experiment, you will design and implement a pro-
totype antenna positioning system using a DC motor as the antenna’s shaft. A potentiometer
will act as the input device to indicate the desired position (angle) for the motor. When the
potentiometer is rotated to a specific angle, the motor shaft should rotate precisely to match
that angle, simulating the behavior of an antenna tracking system.
Objectives: By the end of this experiment, you should be able to:

1. Use a potentiometer to provide the desired position (angle in degrees) for the antenna.

2. Implement an LCD module to display the desired angle.

3. Utilize a motor with an encoder to measure the actual position of the motor.

4. Design and implement a PID controller to ensure the motor accurately rotates to the
desired angle, achieving precise positioning of the antenna.

Report Guidelines: The report to be submitted must have the following:

1. Objectives of the module.

2. Circuit diagram with proper labelling.

3. Block diagram of the system designed.

4. Flowchart of the algorithm.

5. Observations, if any.

ˆ Snap shots of the serial monitor needs to be submitted with your observations. You
have to show how is the performance of the system effected for different values of
Kp , KI , and Kd .

1
– With KI = Kd = 0 and increasing Kp .
– With Kp = Kd = 0 and increasing KI .
– Kp = KI = 0 and increasing Kd .
– Finally, with the tuned Kp , KI , and Kd value.

6. Answers to the questions below.

Answer the following:

1. Draw the block diagram of the closed loop system you have implemented in this module.

2. Why did you use a closed loop system to implement position control? Could an open loop
control, i.e., provide the required PWM at the input of the motor and get the desired
position of the motor be used?

3. How did you tune the controller gains? Did you use the Zieglar-Nichols Method? Provide
a justification for your approach.

4. What is the expected root locus of the system?

5. What is your observation when the value of Kp is increased keeping KI and Kd zero? Can
you relate your observation to the root locus you have drawn in the previous question?

2
OBSERVATION SHEET
This sheet needs to be attached to the report (print on both sides)

1. Demonstrate the interfacing of the potentiometer to the Arduino UNO. You should be
able to display the desired angle on the LCD.

TA Signature with Date:

2. Demonstrate the effect of increasing Kp keeping KI and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of Kp .

TA Signature with Date:

3. Demonstrate the effect of increasing KI keeping Kp and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of KI .

TA Signature with Date:

4. Demonstrate the effect of increasing Kd keeping Kp and KI zero. Show the TA that you
have taken screenshots of the plot for various values of Kd .

TA Signature with Date:

3
5. Demonstrate the tuned system to the TA, ensuring that the desired angle matches the
actual angle after tuning. Note that once the controller is tuned, you cannot adjust the
controller gains. The TA will verify for different positions of the potentiometer that the
system reaches at least 95% of each desired angle. Additionally, the observation sheet
should include the settling band for the tuned system.

TA Signature with Date:

You might also like