The parts used in this project are
Stepping motor 28byj-48
Darlington transistor array ULN2003 board (x113647)
74HC595 shift register
74hc393 Binary Ripple Counter
Ds1809-100 dallastat digital potentiometer
74hc241 o tal buffer
3 tactile buttons
5V power supply
Step 2: main components
74HC595 shift register
Move the motor by repeating the following sequence to the four input pins of the unl2003 board:
This will drive the motor in full step mode. Pattern 1100 moves right repeatedly. This recommends the use of shift registers. The working mode of the shift register is that in each clock cycle, the bit in the register moves one bit to the right, and the leftmost bit is replaced with the value of the input pin at that time. Therefore, it should first feed two clock cycles 1 and then two clock cycles 0 to generate a mode for motor diving.
To generate a clock signal, you need an oscillator that generates a stable sequence of pulses, preferably a clean square wave. This will form the basis of the movement mode of the signal to the motor.
A trigger is used to generate two cycles of 1 and then two cycles of 0.
I have a 74HC595 shift register. This is a very popular chip, which is introduced in many instructables and Youtube Videos.
Data sheets can be http://www.ti.com/lit/ds/symlink/sn74hc595.pdf Found on.
A good instruction is 74HC595 shift register - deleted by bweaver6.
The working principle of 74HC595 shift register is that in each clock cycle, the data in its 8-bit register will be shifted to the right, Then move the value of the input pin to the far left. Therefore, it should be provided with two clock cycles 1, and then two clock cycles 0.
Data moves on the rising edge of the clock pulse. The henc trigger should be triggered on the falling edge of the clock, so the 74HC595 will have a stable data input on the rising edge of the clock.
74HC595 in can be wired as follows:
Pins 15 and 1-3 will output the pattern to drive the motor.
Connecting rCLK and srclk ensures that the chip data register is always synchronized with the output register. Grounding pin 13 will make the contents of the output register (q0-q7) immediately visible.
To generate clock pulses, 555 timer chip can be used. This is also a very popular chip, which is more described and discussed than shift register. Wikipedia in https://en.wikipedia.org/wiki/555_ timer_ There is a good article on IC.
The data sheet is here: http://www.ti.com/lit/ds/symlink/ne555 .pdf
Among other things, the chip can also generate square wave clock pulses. External resistors and capacitors are used to control frequency and duty cycle (when on).
When set to repeatedly generate pulses, the 555 chip is said to be in unstable mode. It can be completed by wiring as shown in the above figure. (picture by jjbeard [public domain], via Wikimedia Commons):
Pin 3 is the output
The output of pin 3 will be connected to the 74HC595 shifted input clock pins (pins 11 and 12)
The frequency of the output signal (and the speed of the stepper motor) is determined by the values of resistors R1 and R2 and the value of capacitor C.
The cycle time t will be ln (2) C (R1 2 R2) or approximately 0.7 C (R1 2 R2).
The frequency is 1 / T.
The duty cycle, that is, the signal is part of the high cycle time, is
Duty cycle for
For both R1 and R2, I use 10K , C = 0.1 F.
This gives a frequency of about 480HZ and is close to the maximum frequency, I find
To generate a 1100 shifted repeat mode from the 74HC595, pin 14 (SER) should be held high for two clock cycles and then low for two cycles. That is, the pin should oscillate at half the clock frequency.
74hc393 Dual Binary Ripple Counter
74hc393 counts in binary, which also means that it can be used to divide the pulse frequency by a power of 2,
Its data sheet is here: http://www.ti.com/lit/ds/symlink/sn74hc393.pdf
The 74hc393 is dual channel and has a 4-bit counter on each side.
At the falling edge of the clock pulse, the first output pin is turned on and off. Therefore, output pin 1 will oscillate at half the input clock frequency. On the falling edge of output pin 1, output pin 2 turns on and off. For all four output pins, and so on. Whenever pin n is closed, pin n 1 switches.
The change frequency of pin n 1 is half that of pin n. This is a binary count. Before starting from zero again, the counter can count to 15 (all four bits are 1). If the last output pin of counter 1 is connected to counter 2 as a clock, its count may be 255 (8 bits).
To create a pulse with a frequency of half the input clock frequency, only pin 1 is required for output. That is, count only from zero.
Therefore, if the clock pulse of 555 is counted, the pin on the 74hc393 counter representing bit 2 will oscillate at half the frequency. Clock. Therefore, it can be connected to the ser pin of the 74HC595 shift register to generate the required mode.
The wiring of 74hc393 binary counter shall be:
Step 3: run
If 74HC595 pins 0-3, we can now make the motor run and connect to pins 1-4 of ULN2003 board respectively.
Now replace the 0.1 f capacitor on pin 6 of the 555 timer with 10 F. This will extend the clock cycle a hundred times, and people will be able to see what is happening.
The LED on the ULN2003 board can be used for this purpose. Unplug the motor plug from the ULN2003 board. Connect pins 1 to 4 of the circuit board to the output qa-qd of the 74HC595 (pins 7, 9, 10 and 11). Connect the - and of the ULN2003 board to the ground and 5V. If the power is turned on, you should see the desired pattern on the LED.
If you want to see what happens in the 74hc393 binary counter, connect to pins 3-6 of the counter instead.
If the pattern is correct, turn off the power supply, replace the capacitor with a capacitor of 0.1 f again, connect input pins 1-4 of ULN2003 board to output pin qa-qd of 74HC595, and then insert it
Turn on the motor again.
Step 4: speed control
The speed of the stepping motor is controlled by the output frequency of the 555 timer. This is in turn determined by the values of resistors R1 and R2 and capacitor C1 connected thereto. By connecting a 100k potentiometer in series with R2, the frequency can be between 480HZ and 63Hz. Step pr. The second frequency of the motor will be half the frequency of the 555 timer.
I used the ds1809-100 digital potentiometer, which is used for buttons. The button connecting pin 2 (UC) and pin 7 (DC) to 5V increases / decreases the resistance between the Rh (pin 1) or Rl (pin 4) terminal and tap pin 6 (RW). Press and hold the button for more than one second, and the button will repeat automatically.
The data sheet can be found here: https://datasheets.maximintegrated.com/zh/ds/DS180. .
The wiring is as follows:
Wiring of tactile button 1 pin 1 / 2 - ds1809 pin 2
Wiring of tactile button 2:
Now, you can adjust the speed.
Step 5: start / stop
To start and stop the stepper motor, pin 4 (reset pin) of the 555 timer can be used. If it is pulled low, pin 3 will not output pulses.
Tactile buttons will be used to switch between start and stop. Press the button once to start the motor, and press the button again to stop it. To get this behavior, you need a trigger. However, the existing 74hc393 can also be used. 74hc393 consists of two parts, only half of which is used as a frequency divider for clock pulses.
Since the binary counter is actually just a set of triggers in series, you can use the first trigger of another part. By connecting the tactile button, pin 13 (2clk) is low when the button is pressed, otherwise it is high, and pin 12 will switch on each low level. Connecting pin 12 to pin 4 of 555 will start and stop its output and therefore stop the motor.
Tactile buttons are tricky because they are mechanical buttons. They may "bounce", that is, they may send multiple signals each time they are pressed. Connecting a 0.1 f capacitor above the button helps to avoid this.
Therefore, a tactile button (button 3) was added and the connection to 555 pin 4 was changed.
The following changes were made to 555:
Button 3 should now be used as a start / stop switch.
Note that motors stopped in this way still consume power.
Step 6: direction control
To control the direction of the motor, I need another button, and then another trigger, but I will cheat after the on / off trigger by using the next trigger of 74hc393, and then
When the direction pin (pin 2qa) becomes low, the next pin (pin 2qb) is switched. Therefore, pressing the button repeatedly will cause
Off-on forwards - off - Open backward - off - Open backward, etc
To make the motor run backward, reverse the pattern sent into ULN2003, which can be executed in both directions. I shift the register, but I don't. 74HC595 is not bidirectional.
However, I found that I can use the 74hc241 Octal Buffer. The buffer has two 4-bit parts with independent OE (output enable) Pin. The first OE pin controls the first four output pins, and the second OE controls the last four output pins. When the OE is on, the output pin has the same value as the corresponding input pin, and when the OE is off, the output pin will be in a high impedance state, just like when it is not connected. In addition, one of the OE pins is active at low level and the other pin is active at high level, so When they are connected together, only half of the buffers will be active.
Therefore, for the same input, half of the buffer can drive the motor forward and the other half can drive the motor backward. Which half is active depends on the value of OE pin.
For the data sheet of 74hc241, please visit http://www.ti.com/lit/ds/symlink/sn54hc241.pdf
The wiring may be as follows: