So I’m having issues with controlling the motor with this ic.
I have got it to work when it was unipolar with the uln2003.
I slit the red wire so there are only 4,two windings. Measured ohms across coils.
Pin 1 ic – 5v pos
Pin2 ic – gpio 27
Pin3 ic – yellow motor wire
Pin 4 ic – ground
Pin 5 ic – ground
Pin 6 ic – Blue motor wire
Pin 7 ic – gpio 22
Pin 8 ic – 5v pos
Pin 9 ic – 3v3 pi
Pin 10 ic – gpio 9
Pin 11 ic – pink motor wire
Pin 12 ic – ground
Pin 13 ic – ground
Pin 14 ic – orange motor wire
Pin 15 ic – gpio 10
Pin 16 ic – 5v pos
When I run:
import RPi. GPIO as GPIO import time GPIO. setmode(GPIO. BCM) ControlPins = [27,22,10,9] for pin in ControlPins: GPIO. setup(pin, GPIO. OUT) GPIO. output(pin, 0) seq = [[1,0,0,0],[1,1,0,0],[0,1,0,0],[0,1,1,0],[0,0,1,0],[0,0,1,1],[0,0,0,1],[1,0,0,1]] def rotate90(direction): if direction == 'CW': for i in range (128): for halfstep in range(4): GPIO. ouput(ControlPins[pin], seq[halfstep] [pin]) rotate90('CW') GPIO.cleanup()
The data sheets do not have a truth table(seq) as far as I can see. They also say to use diodes and caps(I’m assuming that’s for efficiency).
The 28byj is making sounds, but isn’t rotating. I think this is because of my truth table. What should it be?
Sorry for the messy question. I’m on my phone.
Stepper 28byj48 unipolar OK with uln2003
Slit the red wire so there are only two windings
Measured ohms across coils. Pin 1 ic – 5v pos … (OMG, 16 connection pairs!!!)
I did the same thing a long while ago. I vaguely remember I performed the following operation converting the stepper from unipolar to bipolar.
- Open the casing
- Cut away the red wire, so that the two windings do not electrically connected to each other.
Now I am googling something to read, and jot down some pictures, …
Now the schematic for L293D driving a bipolar stepping motor.
I have found a L293D module in my junk box.
Now I have shrinked and merged 4 big pictures into one big picture for my small eyes to look at.
The problem is we don’t know the colour code of the wiring scheme. For example, what colour is for 1a, 1b, 2a, 3b etc. If we could not find the colour code, we may need to use the multimeter and a 6 battery to find by trial and error manually.
Anyway, now I have removed the casing of the 5 wire unipolar motor. Next step is find out which trace to cut to separate the two coils sticking together at the red wire, to make it a 4 wire, two non connecting coils, red wire don’t care bipolar motor.
Now I am also thinking of testing my old stepper and compare how more powerful is, comparing to the small guy. The old guy costed me US$2 (a couple of years ago). The wires were badly torn, but I know there is no contact brushes to wear, so found it good and quite. A new one costed US$25. I thought it was very good money for a hobbyist to play with and learn something. As a newbie, I needed to google hard before I know how to use a battery, a multimeter, and a 1 pole, 12 throw to figure out which wire goes with which other wire, …
A stronger stepping motor to replace 28BYJ48, should be strong enough to turn Rubik cube
/ to continue, …
Appendix A – Why we need a dual bridge motor driver (L293D or L298N)?
We need to use two H-bridge circuits (dual H-bridge) to drive both coils of a bipolar stepper motor.
How does a H-bridge circuit work?
The field effect transistors (FET) Q1 to Q4 act like switches. The diodes D1 to D4 act like freewheeling diodes to channel back-electromagnetic force (back-EMF) of the motor coils. When the ‘switches’ Q1 and Q4 are closed (and Q2 and Q3 are open) a conducting path is created and current will flow from +9Vdc to Q1 to the coil to Q4 to GND. By opening Q1 and Q4 switches and closing Q2 and Q3 switches, a different conducting path is generated from +9Vdc to Q2 to the coil to Q3 to GND. If you pay close attention you will notice the current flowing through the coil in the opposite direction, allowing reverse operation of the motor.
Note however the switches Q1 and Q2 should never be closed at the same time, as this would cause a short circuit. The same applies to the switches Q3 and Q4. This is why we cannot simply use Arduino [or Rpi] HIGH and LOW outputs to reverse the polarity; a H-bridge circuit is essential.