steppernxt
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
steppernxt [2017/08/04 18:23] – rebeccacao | steppernxt [2017/08/15 20:11] (current) – [Circuit Schematics] rebeccacao | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How To Control an Unipolar Stepper Motor with LEGO NXT Using Only Transistors | + | ====== How To Control an Unipolar Stepper Motor with LEGO NXT Using ULN2003A |
**Author:** Xinke (Rebecca) Cao | **Author:** Xinke (Rebecca) Cao | ||
Line 11: | Line 11: | ||
===== Motivation and Audience ===== | ===== Motivation and Audience ===== | ||
- | \\ | ||
- | |||
In many instances in engineering, | In many instances in engineering, | ||
\\ | \\ | ||
The stepper motors resembles the dynamixels used in Darwin-OP; therefore, learning to operate the stepper motors allows more possibilities on the types of mechanisms can be built that can be controlled by the LEGO NXT Brick. Furthermore, | The stepper motors resembles the dynamixels used in Darwin-OP; therefore, learning to operate the stepper motors allows more possibilities on the types of mechanisms can be built that can be controlled by the LEGO NXT Brick. Furthermore, | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
\\ | \\ | ||
==== Parts List and Sources ==== | ==== Parts List and Sources ==== | ||
Line 21: | Line 22: | ||
* (1) 9V battery snaps | * (1) 9V battery snaps | ||
* (1) 28BYJ-48 5V unipolar stepper motor | * (1) 28BYJ-48 5V unipolar stepper motor | ||
- | * (4) IRF510 | + | * (1) ULN2003A |
- | * (4) 100k Ohms resistors | + | * (4) 3.3k Ohms resistors |
* (1) PCF8574A | * (1) PCF8574A | ||
* (1) NXT to breadboard adaptor | * (1) NXT to breadboard adaptor | ||
* (1) NXT Brick | * (1) NXT Brick | ||
* (various quantities) gauge wires | * (various quantities) gauge wires | ||
+ | Here is the [[https:// | ||
\\ | \\ | ||
- | Here is the [[https://youtu.be/VVnshFiYg2U | + | All the codes can be found [[https://github.com/XKRC/ |
- | \\ | + | |
- | + | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
==== Circuit Schematics ==== | ==== Circuit Schematics ==== | ||
// | // | ||
Line 40: | Line 42: | ||
{{ : | {{ : | ||
- | \\ | ||
D0 controls blue. | D0 controls blue. | ||
\\ | \\ | ||
Line 49: | Line 50: | ||
D3 controls orange. | D3 controls orange. | ||
\\ | \\ | ||
- | ==== Construction ==== | + | The integrated circuit that is connected to the PCF8574A is the ULN2003A. The ULN2003A is an array of seven Darlington transistors that amplifies current from the PCF8574A and outputs the voltage supplied to its common port to drive the stepper motor. This is similar to how the IRF510 amplifies the current and acts as a switch to allow specific wires on the stepper motor to obtain enough voltage and current. However, when you input a LOW signal to the ULN2003A, it will output a HIGH signal. Therefore, in the code, we need to adjust the bit values output by the PCF8574A to account for this change. |
\\ | \\ | ||
\\ | \\ | ||
+ | \\ | ||
+ | ==== Construction ==== | ||
**Step 1** | **Step 1** | ||
\\ | \\ | ||
Line 58: | Line 60: | ||
Insert a PCF8574A. | Insert a PCF8574A. | ||
\\ | \\ | ||
- | {{:xinke:img_7476.jpg?300|}} | + | {{:xinke:img_7496.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
Insert the clock line from PCF8574A to the NXT adaptor. | Insert the clock line from PCF8574A to the NXT adaptor. | ||
\\ | \\ | ||
- | {{:xinke:img_7475.jpg?300|}} | + | {{:xinke:img_7495.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
Insert the data line. | Insert the data line. | ||
\\ | \\ | ||
- | {{:xinke:img_7474.jpg?300|}} | + | {{:xinke:img_7494.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
Insert the voltage source to the PCF8574A. | Insert the voltage source to the PCF8574A. | ||
\\ | \\ | ||
- | {{:xinke:img_7473.jpg?300|}} | + | {{:xinke:img_7493.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
- | Insert the ground lines, which will also be the ground | + | Insert the ground lines to the NXT Brick. |
\\ | \\ | ||
- | {{:xinke:img_7472.jpg?300|}} | + | {{:xinke:img_7492.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
- | **Step 2** | + | Ground the pins on PCF8574A. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | Insert four IRF510 resistors. | ||
\\ | \\ | ||
- | {{: | + | **Step 2** |
\\ | \\ | ||
\\ | \\ | ||
- | **Step 3** | + | Insert a ULN2003A. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | Gather an NXT adaptor. | ||
\\ | \\ | ||
- | {{: | + | Add the ground to the ULN2003A and the 9V source to the ULN2003A. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | Insert the NXT adaptor. | ||
\\ | \\ | ||
- | {{: | ||
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | **Step 4** | ||
\\ | \\ | ||
+ | Add the data lines from the PCF8574A to the ULN2003A' | ||
\\ | \\ | ||
- | Gather four 100k Ohms resistors. | + | {{: |
\\ | \\ | ||
- | {{: | ||
\\ | \\ | ||
+ | Add resistors to the digital output pins of PCF8574A that are in use to provide enough currents. | ||
\\ | \\ | ||
- | Connect the resistors to the " | + | {{: |
\\ | \\ | ||
- | {{: | ||
\\ | \\ | ||
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | {{: | ||
\\ | \\ | ||
+ | **Step 3** | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{: | + | Insert the NXT adaptor. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
- | **Step 5** | ||
\\ | \\ | ||
\\ | \\ | ||
- | Connect the source of all transistors to the ground. | + | {{: |
\\ | \\ | ||
- | {{: | ||
\\ | \\ | ||
+ | **Step 4** | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{: | + | Insert the stepper motor to the output pins of the ULN2003A. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{: | + | Connect the red wire from the stepper motor to a 9V voltage source. |
\\ | \\ | ||
+ | {{: | ||
\\ | \\ | ||
\\ | \\ | ||
- | {{:xinke:img_7460.jpg?300|}} | + | \\ |
+ | {{:xinke:img_7480.jpg?300|}} | ||
\\ | \\ | ||
\\ | \\ | ||
**Step 6** | **Step 6** | ||
- | \\ | ||
- | \\ | ||
- | Insert data lines from the correct output pins from the PCF8574A to the corresponding transistor' | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | **Step 7** | ||
- | \\ | ||
- | \\ | ||
- | Connect the center line (red) of the stepper motor to a 9V source and the other four lines to the corresponding " | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | **Step 8** | ||
- | \\ | ||
\\ | \\ | ||
Connect the battery. | Connect the battery. | ||
\\ | \\ | ||
- | {{:xinke:img_7454.jpg?300|}} | + | {{:xinke:img_74800.jpg?300|}} |
\\ | \\ | ||
\\ | \\ | ||
Line 210: | Line 190: | ||
Wait(10); | Wait(10); | ||
- | // | + | \\ |
- | + | To reverse the direction that the stepper motor is turning, the sequence can be reversed. | |
- | // | + | \\ |
- | // | + | \\ |
- | // | + | \\ |
==== Final Words ==== | ==== Final Words ==== | ||
+ | The purpose of this tutorial is to allow the users of the NXT Brick learn how to control a stepper motor through an NXT interface. | ||
+ | \\ | ||
+ | Building from this tutorial, one can control the speed of the stepper motor and the direction of the stepper motor by altering the wait time between each signal and the sequence of the signal. | ||
+ | \\ | ||
+ | If you have any questions, please email me at caox1@unlv.nevada.edu. | ||
Line 223: | Line 208: | ||
- | |||
- | **Circuit Schematics** | ||
- | |||
- | |||
- | **Basic: Coding** | ||
- | To simplify what I'm doing, I will put it in layman terms. Basically, in order to drive the unipolar stepper motor that we have, we send currents to the stepper motor in a correct sequence in order to turn the stepper motor, say in clockwise direction. This means, to drive the stepper motor in the opposite direction, we reverse the sequence. | ||
- | |||
- | |||
- | **Sample Video** | ||
- | // | ||
- | |||
- | // | ||
steppernxt.1501896231.txt.gz · Last modified: 2017/08/04 18:23 by rebeccacao