LAB 2 Embedded

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

PAN AFRICAN UNIVERSITY JOMO KENYATTA UNIVERSITY

OF AGRICULTURE AND
INSTITUTE FOR BASIC
TECHNOLOGY
SCIENCES, TECHNOLOGY
AND INNOVATION(PAUISTI) (JKUAT)

l d

Advanced Embedded Systems Design


(PUE 3130) LAB2 REPORT

Name Leonel GAMVOU TAKLAI


Identification EE300-0006/2022-2023
Program Computer Engineering
Department Electrical Engineering
Code PUE 3140
Date 10 Jully 2023

Under the coordination of


Dr. MUCHUKA Manguu

Academic year 2022-2023


Table of Contents
ABSTRACT ..................................................................................................................... 3
AIM .................................................................................................................................. 4
INTRODUCTION ............................................................................................................. 5
I. MATERIALS AND METHODS .................................................................................. 6
I.1. Practical task 1 ...................................................................................................... 6
I.1.1. Materials used for doing task 1 ....................................................................... 6
I.1.2. Method used to realize task 1 ....................................................................... 11
I.2. Practical task 2 .................................................................................................... 13
I.2.1. Requirements ................................................................................................ 13
I.2.2. Approach used for task 2 .............................................................................. 15
II. RESULTS .............................................................................................................. 17
II.1. Result task 1 ....................................................................................................... 17
II.2. Result task 2 ....................................................................................................... 18
CONCLUSION .............................................................................................................. 19
REFERENCES .............................................................................................................. 20

Page 1 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 1: ZYTD520 12V DC 30RPM Redüktörlü Motor - 37mm ...................................... 7
Figure 2: IRF740 N-channel Mosfet 400V-10A ............................................................... 7
Figure 3: Songle SRD-05DC-SL relay ............................................................................. 8
Figure 4: 4N35 optocoupler ............................................................................................. 8
Figure 5:Breadboard prototyping ..................................................................................... 9
Figure 6: Jumper wires .................................................................................................... 9
Figure 7: The MSP430FR5969 ..................................................................................... 10
Figure 8: Resistors ........................................................................................................ 11
Figure 9: Circuit of DC motor using MOSFET ............................................................... 12
Figure 10: Fotek SSR-50DAa........................................................................................ 14
Figure 11: AC load ........................................................................................................ 14
Figure 12: power supply for driving AC load .................................................................. 15
Figure 13: Circuit diagram of relay and AC load ............................................................ 15
Figure 14: Assembly program for running DC motor using MOSFET .......................... 16
Figure 15: result of turning DC motor using MOSFET ................................................... 17
Figure 16: Result turning Coil using MOSFET .............................................................. 18
Figure 17: Lab work result of AC load ........................................................................... 18

Page 2 of 21
Directed by Leonel GAMVOU TAKLAI
ABSTRACT
This lab work aimed to design and implement interface circuits for controlling a DC
motor and an AC load using MOSFET, relay, and optocoupler. The circuits were tested
using MSP430 Assembly code. The DC motor was controlled using both MOSFET and
relay-based circuits, while the AC load was driven using a solid-state relay module. The
developed circuits demonstrated successful control of the motor and load, and the
MSP430 Assembly code verified their functionality. This work provides a foundation for
the development of more complex control systems using microcontrollers and electronic
components.

Keywords: Design, implement, test, DCmotor, AC load, MOSFET, optocoupler,


MSP430, microcontrollers.

Page 3 of 21
Directed by Leonel GAMVOU TAKLAI
AIM
The aim of this lab work is to design and test interface circuits for controlling a DC
motor and an AC load, using MOSFET, relay, and optocoupler, with MSP430 Assembly
code. The circuits will be implemented, and successful control of the motor and load will
be demonstrated.

Page 4 of 21
Directed by Leonel GAMVOU TAKLAI
INTRODUCTION
The control of electric motors and loads is essential in many applications, including
robotics, automation, and energy management. In this lab work, we aim to design and
implement interface circuits for controlling a DC motor and an AC load using MOSFET,
relay, and optocoupler. The circuits will be tested using MSP430 Assembly code, and
their functionality will be verified. The developed circuits will demonstrate successful
control of the motor and load, and provide a foundation for the development of more
complex control systems using microcontrollers and electronic components. However, In
the rest of our work, we will first show you the materials and the method used to carry out
each task, then the result obtained and the discussion. We will end with a conclusion.

Page 5 of 21
Directed by Leonel GAMVOU TAKLAI
I. MATERIALS AND METHODS
In this part, we are going to see the materials and methods employed to achieve
respectively the task 1 and task 2.

I.1. Practical task 1


Regarding the design and implementation of an interface circuit to turn on and off
a DC motor using MOSFET in our task 1, we need first to give the rule and characteristics
for each material used, and after the circuit that we are going to implement.

I.1.1. Materials used for doing task 1


To achieve our aim, we employed the following materials:

 ZYTD520 DC motor,
 IRF740 MOSFET,
 Songle SRD-05DC-SL relay,
 4N33 or 4N35 optocoupler,
 Breadboard,
 Jumper wires,
 MSP430 microcontroller,
 MSP430 LaunchPad development board,
 Resistors (220 ohms, 10k ohms),
 Power supply (12V).
a. ZYTD520 DC motor

The ZYTD520 is a brushed DC motor that operates at 12 volts and has a maximum
speed of 5000 revolutions per minute. It is a commonly used DC motor due to its low cost
and relatively high power output.

Page 6 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 1: ZYTD520 12V DC 30RPM Redüktörlü Motor - 37mm

b. IRF740 MOSFET

The IRF740 is a power MOSFET transistor that is used to switch the DC motor on
and off. It is designed to handle high currents and voltages and can be controlled using
a low-voltage signal from a microcontroller. It connect by connecting the source (S)
pin to ground, gate (G) pin to control signal, and drain (D) pin to load.

Figure 2: IRF740 N-channel Mosfet 400V-10A

Page 7 of 21
Directed by Leonel GAMVOU TAKLAI
c. Songle SRD-05DC-SL relay

The Songle SRD-05DC-SL is a 5V relay that can be used to control the DC motor.
When a voltage is applied to its coil, it switches the motor on or off. It is commonly used
for switching high-power loads in electronic circuits.

Figure 3: Songle SRD-05DC-SL relay

d. 4N35 optocoupler

The 4N35 optocoupler is an electronic component used to isolate the microcontroller


from the high voltage circuits of the DC motor and relay. This allows the microcontroller
to control the motor and relay without being affected by the high voltages and currents.

Figure 4: 4N35 optocoupler

Page 8 of 21
Directed by Leonel GAMVOU TAKLAI
e. Breadboard

A breadboard is a construction base used to prototype electronic circuits. It consists


of a plastic board with a grid of holes, into which electronic components can be inserted
and connected using jumper wires.

Figure 5:Breadboard prototyping

f. Jumper wires

Jumper wires are wires used to connect the components on the breadboard. They are
typically made of copper or aluminum and have a plastic insulation coating.

Figure 6: Jumper wires

Page 9 of 21
Directed by Leonel GAMVOU TAKLAI
g. MSP430 microcontroller:

The MSP430 is a low-power microcontroller from Texas Instruments that is commonly


used in embedded systems. It features a 16-bit RISC CPU, flash memory, and a variety
of peripherals, including analog-to-digital converters, timers, and communication
interfaces.

Figure 7: The MSP430FR5969

h. Resistors

Resistors are electronic components used to limit the current and protect the
components from overvoltage. The 220-ohm resistor is typically used to protect the LED
of the optocoupler, while the 10k-ohm resistor is used to limit the current through the base
of the MOSFET.

Page 10 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 8: Resistors

i. Power supply

The power supply is used to provide the circuits and the DC motor with a 12-volt DC
voltage. The voltage and current rating of the power supply should be chosen to match
the requirements of the circuits and the DC motor.

I.1.2. Method used to realize task 1


There are several methods that can be used for the lab work mentioned in Task 1.
In this case we started by implemented the circuit and after connecting device, and we
ended by running the assembly code.

a. Circuit to implemented

For doing this circuit we needed livewire software, this circuit contain DC motor
having two terminals, and then we have one MOSFET having three terminals describe in
the materials parts.

Page 11 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 9: Circuit of DC motor using MOSFET

b. Connection of all devices

There are several methods that can be used for the lab work, however we used
the following method to connect each of two (02) parts.

Using a Breadboard and Jumper Wires:


o Gather the necessary components: DC motor (ZYTD520), MOSFET
(IRF740), breadboard, jumper wires, power supply (12V), and a
microcontroller.
o Connect the MOSFET to the breadboard, making sure to connect the
drain pin to the negative rail and the source pin to the motor's negative
terminal.
o Connect the gate pin of the MOSFET to a digital output pin of the
microcontroller using a jumper wire.
o Connect the motor's positive terminal to the positive rail of the
breadboard.
o Connect the power supply to the positive and negative rails of the
breadboard.

Page 12 of 21
Directed by Leonel GAMVOU TAKLAI
o Write a program for the microcontroller to set the MOSFET gate pin to
high to turn on the motor, and low to turn it off.

Using relay and optocoupler:


o Gather the necessary components: DC motor (ZYTD520), relay
(Songle SRD-05DC-SL), optocoupler (4N33 or 4N35), power supply
(12V), and a microcontroller (e.g. MSP430).
o Connect the motor's positive terminal to one of the relay's normally
open (NO) terminals, and connect the other NO terminal to the power
supply's positive terminal.
o Connect the motor's negative terminal to the power supply's negative
terminal.
o Connect the relay's coil terminals to the optocoupler's input pins, and
connect the optocoupler's output pins to a digital output pin of the
microcontroller.
o Write a program for the microcontroller to set the optocoupler output pin
to high to turn on the relay and the motor, and low to turn them off.

I.2. Practical task 2


In the material and method section of Task 2, we will discuss the process of
designing and implementing an interface circuit to drive an AC load using a Fotek SSR-
50DA solid-state relay module. We will also outline the necessary components and safety
considerations for this project. Finally, we will provide an example MSP430 assembly
code for testing the design.

I.2.1. Requirements
Include certain materials used to do task 1, we also use Fotek SSR-50DA, AC
load, and power supply.

Page 13 of 21
Directed by Leonel GAMVOU TAKLAI
a. Module relais statique Fotek SSR-50DAa

The Fotek SSR-50DA is a solid-state relay module that can switch high voltage AC
loads using a low voltage DC input signal. It is designed for safe and reliable operation,
and can handle loads up to 50A without the need for a heat sink.

Figure 10: Fotek SSR-50DAa

b. AC load
An AC load in our context refers to incandescent lamps that can use an alternating
current (AC) power supply.

Figure 11: AC load

c. Appropriate power supply

Here we are using a lab socket which can provide 110v as a power supply, let’s see
it as a picture.

Page 14 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 12: power supply for driving AC load

I.2.2. Approach used for task 2


The following section outlines the methods and procedures used to accomplish the
tasks described in the previous section.

a. Circuit diagram

The circuit was designed to provide a safe and reliable interface between the
microcontroller and the load, ensuring that the switching device is operated within its safe
operating parameters. Our circuit contain input terminal of the relay connected to the
output pin of the microcontroller, then the output terminal of the relay connected to AC
source in series with AC load.

Figure 13: Circuit diagram of relay and AC load

Page 15 of 21
Directed by Leonel GAMVOU TAKLAI
b. Connecting devices

Here, it is the step that we follow to connecting devices for the task 2. Therefore the
method is the next:

 Gather the necessary components: Fotek SSR-50DA solid-state relay module,


AC load, power supply (AC), microcontroller and a few jumper wires.
 Connect the AC load to the Fotek SSR-50DA module, following the module's
datasheet for wiring and load specifications.
 Connect the microcontroller to the Fotek SSR-50DA module using a jumper
wire to control the relay module's input.
 Connect the power supply to the AC load and to the Fotek SSR-50DA module.
 Write a program for the microcontroller to send a signal to the Fotek SSR-50DA
module to turn on and off the AC load.

After doing all these works, we executed the assembly code to bling the LED. That
code was used for turning DC motor and driving the AC load.

Figure 14: Assembly program for running DC motor using MOSFET

Page 16 of 21
Directed by Leonel GAMVOU TAKLAI
II. RESULTS
This section presents the results obtained from the implementation and testing of the
interface circuits designed in Tasks 1 and 2, using the specified components and
microcontroller programming.

II.1. Result task 1

Figure 15: result of turning DC motor using MOSFET

Page 17 of 21
Directed by Leonel GAMVOU TAKLAI
Figure 16: Result turning Coil using MOSFET

II.2. Result task 2

Figure 17: Lab work result of AC load

Page 18 of 21
Directed by Leonel GAMVOU TAKLAI
CONCLUSION
In conclusion, we have successfully designed and implemented interface circuits
to control a DC motor and an AC load using various switching devices such as MOSFET,
relay, and solid-state relay module. The circuits were tested using an MSP430
microcontroller and the corresponding assembly code. The results showed that the
circuits operated safely and reliably within the specified parameters. Overall, this lab work
provided valuable hands-on experience in circuit design and programming, and
demonstrated the importance of careful component selection and safety considerations.

Page 19 of 21
Directed by Leonel GAMVOU TAKLAI
REFERENCES
Document references:
Mazidi, Muhammad Ali, and Rolin D. McKinlay. The MSP430 Microcontroller and
Embedded Systems: Using Assembly and C for MSP430. Pearson, 2015.
Razavi, Behzad. Design of Analog CMOS Integrated Circuits. McGraw-Hill Education,
2017.
Website reference:
"Solid-State Relays," Omega Engineering, accessed July 10, 2023,
https://www.omega.com/en-us/resources/solid-state-relays

Texas Instruments. "MSP430™ Ultra-Low-Power MCUs," Texas Instruments, accessed


July 10, 2023, https://www.ti.com/microcontrollers/msp430-ultra-low-power-
mcus/overview.html

Page 20 of 21
Directed by Leonel GAMVOU TAKLAI

You might also like