Essentials of motorS and motor driver

advertisement
ESSENTIALS OF MOTORS
AND MOTOR DRIVER
INTERFACING PROXIMITY SENSOR WITH MOTOR
MOTOR : WHAT IS IT?
Electrical Motors are continuous actuators that convert electrical energy into
mechanical energy in the form of a continuous angular rotation that can be
used to rotate pumps, fans, compressors, wheels, etc.
MOTORS EVERYWHERE!
Refrigerator - Two or three in fact: one for the
compressor, one for the fan inside the refrigerator
Tape player in the answering machine
Vacuum cleaner
Electric drill
Fan
Electric toothbrush
Hair dryer
Power seats (up to seven motors per seat)
Windshield wipers
MOTOR : TYPES
If you plan to get involved in robotics, you will need to
familiarize yourself with the many types of motors available.
BRUSHED DC MOTOR
MOTOR : TYPES
GEARED DC MOTOR
DC motors are often coupled with gears
which provide greater torque, but
reducing speed.
MOTOR : TYPES
SERVO MOTOR
BRUSHLESS DC
MOTOR
STEPPER MOTOR
LINEAR DC MOTOR
MOTOR : INPUTS
INPUT AT A
INPUT AT B
OUTPUT
1
0
ROTATES
CLOCKWISE
0
1
ROTATES
ANTICLOCK
WISE
1
1
STOPS
0
0
STOPS
MOTOR DRIVER
A motor driver is an electronic device that acts as an intermediate device
between a microcontroller, a power supply or batteries, and the motors.
Why do we not connect our motor directly to the mcu?
The motor draws very high current much higher than the operating current of
the mcu.
Thus, the microcontroller and the motor driver have to work together in order to
make the motors move appropriately.
Integrated Circuits (IC)

An integrated circuit (also referred to as an IC,
a chip, or a microchip) is a set of electronic
circuits on one small plate or chip of
semiconductor material, normally silicon.
MOTOR DRIVER :
DC Motor Control:
Nominal voltage.: DC motor controllers tend to offer a voltage range. For example, if
your motor operates at 3V nominal, you should not select a motor controller that can only
control a motor between 6V and 9V
Continuous current: You need to find a motor controller that will provide current equal to
or above the motor’s continuous current consumption under load. Should you choose a 5A
motor controller for a 3A motor, the motors will only take as much current as they require.
On the other hand, a 5A motors is likely to burn a 3A motor controller.
WORKING: L293D AN H-BRIDGE
Using H-bridge circuit, you can supply current in two directions.Thats it.
Lets say you have a DC motor, as in the diagram below:
If you
Close both S1 and S2?
Close S3 and S4.
Close switches S1 and S4
Close S3 and S2
Direction of rotation in last two cases?
This is exactly whats needed in most robotics projects using differential drive wheels. But
having physical switches would be very inconvenient.
So an electronically controlled switch: a transistor is used.
PIN DIAGRAM
Vcc1 : logical voltage supply for a 1
Vcc 2 is the actual voltage that needs to
be output
GND represents grounds. These are
needed for the multiple solid state
switches that are burned into the IC.
ENABLE pins enable/disable the
corresponding sides.
HOW TO SET-UP CONNECTIONS
HOW TO MAKE IT WORK
IF you put a logical 1 into INPUT1
Then the chip will simply put Vs volts into OUTPUT1.
Similarly, if you put a logical 0 into INPUT1, the chip will
ground OUTPUT1
.
That is Putting a logical 1 into INPUTx will put Vs volts in
OUTPUTx. And putting a 0 grounds the corresponding pin.
One word of caution though. You can use a maximum of 0.5A
of current over each OUTPUTx pin. Use a bit more and you
risk fusing the chip.
INTRODUCTION TO
MICROCONTROLLERS
ROBOTICS AND MACHINE INTELLIGENCE
NIT TRICHY
What is a Microcontroller?



Mcu is similar to your
home computer.
At the same time, it is
different from your home
computer. how?
The computing power is
much scaled down in your
microcontroller compared
to your laptop.
Microcontroller vs. Microprocessor
Microprocessor(Laptops, Desktops
etc.)




Used to execute big and
generic applications
Very high processor speeds of
the order of GHz (many times
faster)
It is a stand alone device.
RAM, ROM, I/O peripherals
and Timers have to be
interfaced separately
Suited for applications where
time and accuracy are critical
(Personal Computers)
Microcontroller(Atmega8)




Used to execute a single task
with one application
Much lower processing speeds
ranging from as low as 4kHz to
a few MHz
The CPU, RAM, ROM, I/O
Peripherals and Timers are all
on the same chip
Suited for applications where
cost, power and space are
critical (Embedded Systems)
Features of a Microcontroller
Block Diagram











Architecture : Harvard or Von
Neumann; RISC or CISC
Speeds of up to 16 MIPS
ISP Flash Memory, EEPROM, SRAM
General Purpose I/O Registers
(GPIO)
Internal Calibrated Oscillator and
external clocking options
8 bit and 16 bit Timer/Counters
ADC and PWM Features
External and Internal Interrupt
sources
Programmable Watchdog Timers
USART, SPI and I2C Interfaces
PDIP, TQFP or QFN Packaging
Microcontroller Families

Examples of the different series of microcontrollers are:

8051(At89s52)
AVR (Atmega8/16)
PIC (PIC10F)
ARM (LPC2148)
MSP (MSP430)

WHY AVR?










Advanced RISC Architecture
In System Programmability (ISP) Mode
Inbuilt 10 bit ADC
Very low cost microcontrollers are available
Supported by the GNU Compiler Collection (GCC)
Three sub families : TinyAVR, MegaAVR, XMegaAVR
ATMEGA 8 Pin Diagram
Features of an ATMEGA 8







Up to 16MIPS Throughput at 16MHz
8Kbytes of In-System Self-programmable Flash
program memory
Data retention: 20 years at 85°C/100 years at 25°C
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
3 I/O Ports
Comes in a 28 pin package.
Description of each pin
Pin 1 (Reset):



When this pin is pulled low microcontroller get reset.
Reset means code start executing from the beginning.
In normal mode of execution it should have at least 2.7V. Thus it is connected to
+5 volts through 10k ohm resistance to make sure voltage on reset pin should
be above 2.7 for proper execution of code.
Pin 7 and 20 (Vcc):

Pin 7 and 20 are connected to Power supply. (2.7 to 5.5 volt)
Pin 8 and 22 (Ground):

Pin 8 and 22 are connected to Ground. Ground must be common to for the
entire circuit.
Input and Output Ports

In ATmega8 we have three I/O (input/output) ports, Port B, Port C, Port D.

Any pin can be configured as input or output pin by software.
I/O in AVR

Input/output happens through the specified pins in
AVR. A group (generally consisting of 8 pins) is
called a PORT. Each port has associated registers
with it that help in acquiring/transmitting the data
from/to the pins and also configuring them.
Headers and registers for I/O





The header “avr/io.h” is the library in which all the
I/O commands are defined.
Syntax: #include<avr/io.h>
Every port in AVR (which 8 bit and hence has 8
pins) will have three I/O registers associated with
it:
DDRx – Data Direction Register
PORTx – Output Operation
PINx – Input Operation
Configuring I/O pins


The value of DDR that is set by the programmer is
what decides whether the particular pin in the MCU
will behave as an input or as an output pin.
If a specific bit of the DDRx is set to 1 then it
behaves as an output pin while the value 0 makes it
behave as an input pin. For example:
DDRD = 0b00001111;
The above line configures the lower nibble of
PORTD to output and the higher nibble to input.
Taking inputs – The PINx Register




PINx (Port IN) is used to read data from port pins.
In order to read the data from port pin, first you have to change
port’s data direction to input.
If port is made output, then reading PINx register will give you
data that has been output on port pins.
This register cannot be used to output data on to the pins
To read data from port A.
DDRA = 0x00; //Set port a as input
x = PINA; //Read contents of port a
The above code will store the input value into the variable ‘x’.
The PORTx register


It is mainly used to output data.
To output 0xFF data on port B:
DDRB = 0b11111111; //set as output
PORTB = 0b11111111; //write data on port


It is also used to activate/deactivate the pull up
resistors when port is configured as input.
The value 1 actiavtes the pull up resistors while 0
will deactivate them.
Download