We begin by motor 28BYJ-48 and its datasheet . The motor is already equipped with connector for connection. It is a unipolar stepper motor with 4096 steps for a rotation of 360 degrees. Its pivot is not rotated easily, even without power supply. So you can save energy when not feeding the windings must remain stationary. So it will heat up much less.
We see the instructions of the control module that uses the integrated ULN2003A with itsdatasheet . On my concerns about these modules and how to control the stepper motor I have already spoken here. Back to us, looking in pdf find some useful information:
- What are the phases of the motor and the color of the wires of the phases;
- How you have to activate the various phases to make it run properly.
The Blue wire must be connected to pin11, pin10 to the Red, the 'Orange to Pin 9 and at Green Pin8.
Obviously the pins can be changed but you have to edit the sketch.
After downloading the sketch is in charge 'Arduino IDE and programming Arduino UNO R3.
Given the educational purposes only see certain parts of the sketch. In previous there are signs of such Pin output will want to use, this is the place to change them.
The function Ignition Delay allows to have an initial delay of 5 seconds before to start the rotation of the motor. 'A good idea, before operating mechanisms, provide a brief pause to allow the operator to move away from the machine before it starts working.
If you take a look at the PDF form will discover that to rotate the stepping motor 28BYJ-48, just power phases following a precise order. Well this sequence is made by this piece of code. I chose to move the motor with eight sequences. If you prefer to do it with four sequences here's the part you have to change.
Scketch: Initialization of the Board Arduino Uno R3 - Paul Luongo |
This is the usual initialization block: note the delay function on power.
This is only the first part of the control program. And 'the part that deals with the rotation.The motor rotates 90 degrees, pause for half a second then rotates, pause ... to make a 360 degree rotation. Note that to rotate the engine 90 Degrees serve 1024 pulses.
Sketch: Part of the main control program - Paul Luongo |
Post a Comment