Circuitos_1

Two circuits will be built today to control Unipolar motors.

A unipolar motor is a type of step motor described as needing only a current source. By contrast, bipolar motors require two current sources to move.

The complexity of this type of motors is that they are powered by DC current sources and require digital circuits so that the energizing sequences are triggered in the right order. Feedback is not always necessary for the control, and this can be guaranteed through the use of encoders that guarantee accuracy. They are motors that are usually used when precision is required in detriment of speed.

Typically Unipolar motors have 5 or 6 wires. When they are 5, the current wire is connected internally to the two coils.

To control the motor we will use an ULN2003A IC which is a darlington array . This can make sink up to 500mA per pin.

A Darlington transistor is a configuration of two bipolar NPN transistors that allow current to be amplified by both transistors. There are even these kind of space-saving transistors. This type of transistor has the name of its inventor Sidney Darlington. The ULN2003A IC in addition to the Darlington transistor configuration has additionally inductive load suppression diode and is prepared to operate with 3.3V or 5V voltages. It is a very interesting integrated for uses where it is necessary to do current sink.

The first circuit that will be built will use 4-pin micro-controller. The second will use only 2 pins.

Tip:

  • It can also be used an alternative IC which is ULN2803A which has 8 Darlington transistors.

4-pin Sequence (Positive Rotation):

TimeP1P2P3P4
11100
20110
30011
41001

2-pin Sequence (Positive Rotation):

TimeP1P2
101
211
310
400

To move the motor in the opposite direction the sequence must be from the end to the beginning.

Schematic

This is the circuit that uses 4-pin from the micro-controller:

Circuitos_3_Schematics

This circuit uses only 2 pins of the microcontroller:

Circuitos_3_Schematics

Bill of materials (BOM)

Circuit 1:

  • 1x IC ULN2003A
  • 2x 470 Ohms Resistor (R1,R2)
  • 1x 5mm Red LED (D1)
  • 1x 5mm Green LED (D2)
  • 1x Unipolar Motor 28BYJ48 DC 5V (M1)

Circuit 2:

  • 1x IC ULN2003A
  • 4x 1K Ohms Resistor (R3-R6)
  • 2x 470 Ohms Resistor (R1,R2)
  • 1x 5mm Red LED (D1)
  • 1x 5mm Green LED (D2)
  • 1x Unipolar Motor 28BYJ48 DC 5V (M1)

The motor used for the experiments was the 28BYJ48 DC 5V
This motor has the particularity of wire 2 and 3 being switched. The sequence being 1,3,2,4.
Motor power is supplied to the IC COM pin.

IC/Components Pin-out

Circuitos_4_Pinout

Code

The sketch should be loaded into an Arduino through its IDE (version 1.6.6 was used).
In the sketchs the Stepper library was used.

The sketch for circuit 1. This works in the 4-pin configuration.

#include <Stepper.h>

const int  motorSteps = (32 * 64);     // 28BYJ48 DC 5V

const int motorPin1 = 12;
const int motorPin2 = 11;
const int motorPin3 = 10;
const int motorPin4 = 9;
const int ledPin = 13;

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4); 

void setup() {
  myStepper.setSpeed(10);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Step forward
  digitalWrite(ledPin, HIGH);
  myStepper.step(motorSteps/2);
  delay(500);

  // Step backward
  digitalWrite(ledPin ,LOW);
  myStepper.step(-motorSteps/2);
  delay(500); 
}
// Sketch uses 2,292 bytes (7%) of program storage space. Maximum is 32,256 bytes.
// Global variables use 35 bytes (1%) of dynamic memory, leaving 2,013 bytes for local variables. Maximum is 2,048 bytes.

The sketch for circuit 1. This works in the 2-pin configuration.

#include <Stepper.h>

const int  motorSteps = (32 * 64);     // 28BYJ48 DC 5V

const int motorPin1 = 12;
const int motorPin2 = 11;
const int ledPin = 13;

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1, motorPin2); 

void setup() {
  myStepper.setSpeed(10);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Step forward
  digitalWrite(ledPin, HIGH);
  myStepper.step(motorSteps/2);
  delay(500);

  // Step backward
  digitalWrite(ledPin ,LOW);
  myStepper.step(-motorSteps/2);
  delay(500); 
}
// Sketch uses 2,232 bytes (6%) of program storage space. Maximum is 32,256 bytes.
// Global variables use 35 bytes (1%) of dynamic memory, leaving 2,013 bytes for local variables. Maximum is 2,048 bytes.