Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CMP3006 Embedded Systems Programming Lecture 7: Driving Atmega 328, Lecture notes of Embedded Systems Programming

its for cmp3006 and 3010 some of the university notes it will be help

Typology: Lecture notes

2022/2023

Uploaded on 06/17/2023

fahd-2
fahd-2 🇹🇷

6 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMP3006
EMBEDDED
SYSTEMS
PROGRAMMING
LECTURE 7 OUTP UT - DRIVING
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download CMP3006 Embedded Systems Programming Lecture 7: Driving Atmega 328 and more Lecture notes Embedded Systems Programming in PDF only on Docsity!

CMP

EMBEDDED

SYSTEMS

PROGRAMMING

LECTURE 7 OUTPUT - DRIVING

Atmega 328 Pinout

Driving with Transistor

We can switch devices using transistors.

Transistor amplifies signals.

AVR

VCC

LOAD

AVR

VCC

NPN

PNP

ULN

There are 7 Darlington transistors in a ULN2003.

IN OUT

GND

Relay

Relay is an electronic controlled switch.

It isolates two parts of a circuit from each

other.

A small amount of current and voltage causes

to switch a large amount of voltage and

current

Relay DPDT

Maximum output: 250V 8A ~AC

Input: 24

V DC

Relay

Relay has the following parts:

Coil

Contacts

Spring

AVR connection to relay

Micro

Darlington

Relay Lamp

  • 5 V + 12 V

1 16

8

ULN 2003 AVR

106462

2

6

14

8

PB 0

  • 5 V

9

Optoisolator

Opto-isolator isolates two parts of a circuit

from each other.

There is an LED in the input, and a photo-

transistor in the output. When the LED lights

up, the photo-transistor, senses the light and

becomes conductor, and passes the current.

can be used in input or output circuits.

TLP

DC Motor

DC motor

Unidirectional control

Bidirectional control

Reverse current

Current continues after switch is opened

Opening the switch does not immediately stop current in the motor windings

Reverse current

Flyback diode or snubber diode

Adding a diode in parallel with the motor provides a path for dissipation of stored energy

when the switch is opened

Replace the Switch with a

Transistor

A transistor allows on/off control to be automated and it allows switching of more current than

an Arduino digital pin can supply

Spin the DC Motor

int motorPin = 9 ; // Pin 3 has PWM, connected it to the DC

motor

void setup() {

pinMode(motorPin, OUTPUT); // Set motor pin to output mode

void loop() {

analogWrite(motorPin, 150); // Motor at 150/255 of full

speed

delay(1000);

analogWrite(motorPin, 250); // Motor at 250/255 of full

speed

delay(1000);

Stepper motor

A stepper motor or step motor or stepping motor is a brushless DC electric

motor that divides a full rotation into a number of equal steps