Académique Documents
Professionnel Documents
Culture Documents
Microcontroller/Microprocessor
Presentation
Bilal Sarwar
Ali Rafay
By:
B-17707
Motor
(Direction
Can
How Fast?
60 Steps per Second
rpm
Steps per Re volution
2 types:
Comparison
Unipolar
Bipolar
Construction
Modes of Operation
Single
Note that until the next coil is switched on, the stator remains in its position only
And as we can control when to switch on a particular coil thru software, we can
rotate it by exactly the angle we wish.. Compare this with DC motor where the
shaft keeps on rotating as soon as the current is switched on
Comparison
Single
coil
Low torque
Double
coil
High torque
Consume double
energy
Note: The advantage of hybrid mode is that the step angle gets
Settling time is less
halved.. So we can control the rotation
with double precision
-Continued
Implementation of H
bridge
Male-Female D-Type
Connectors
Hardware
Implementation Using
Arduino Nano
Components
list:
H-Bridge
IR Reciever
IR Remote
Microcontroller
Stepper motor
L293D
Tsop4838
NEC Protocol
Atmega328p
ST3518
Circuit Diagram
Arduino Code
#include <IRremote.h> /
int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
#include <Stepper.h>
int dir;
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); //arduino pins to h-bridge inputs
void setup() {
myStepper.setSpeed(60);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
// myStepper.step(encoderPos);
if (irrecv.decode(&results)) {
Serial.println(results.value);
irrecv.resume(); // Receive the next value
if (results.value == 1320358637)
{
myStepper.step(+1);
dir = 1;
}
else if (results.value == 4294967295 && dir == 1)
{
myStepper.step(+1);
}
else if (results.value == 1320368327)
-Continued
{
myStepper.step(-1);
dir = -1;
}
else if (results.value ==
4294967295 && dir == -1)
{
myStepper.step(-1);
}
else if (results.value ==
1320392807)
{
myStepper.step(+100);
dir = 100;
}
else if (results.value ==
4294967295 && dir == 100)
{
myStepper.step(+100);
}
else if (results.value ==
1320360167)
{
myStepper.step(-100);
dir = -100;
}
else if (results.value ==
4294967295 && dir == -100)
{
myStepper.step(-100);
}
else if (results.value == 1320401477)
{
myStepper.step(+1000);
dir = 1000;
}
else if (results.value == 4294967295 && dir == 1000)
{
myStepper.step(+1000);
}
else if (results.value == 1320417287)
{
myStepper.step(-1000);
dir = -1000;
}
else if (results.value == 4294967259 && dir == -1000)
{
myStepper.step(-1000);
}
else dir = 0;
}
delay(5);
}