I'm taking a basic Mechatronics class with a professor that allows us to use Arduinos but refuses to offer any help since he doesn't know anything about them. I don't know much about electronics, but I'm comfortable with computer programming.
I'm trying to get stepper motor 28BYJ-48 with Darlington array chip ULN2803A to rotate clockwise and counterclockwise depending on the position of a switch. This should be stupidly easy, but I've been working on it for over three hours now, Googling Web and Images several pages deep. Currently I'm just trying to get it to rotate in one direction (the opposite direction will then be easy).
My relevant code (not including code for the switch, which works fine) is:
#include <Stepper.h>
const int stepsPerMotorRevolution = 32;
const int stepsPerOutputRevolution = 2048;
Stepper myStepper(stepsPerMotorRevolution,8,6,7,5);
The only thing that happens is that "Here" is outputted about every ten seconds.
I suspect that it's my wiring that's incorrect- I've tried dozens of combinations- but there isn't a single image of how to connect everything with a ULN2803A- everything is for a ULN2003. I'm attaching my best shot at a circuit diagram. I'm not including the switch because that seems to work just fine (and worked for the previous assignment). I appreciate any help you guys can give me for something that seems so basic.
You have a short circuit from 5V to pin 8, that will burn out pin 8 if it goes low.
And where did that program come from? Why didn't you use one of the library examples?
Here's some datasheet links that might help, good luck.
Thank you for taking the time to try to help. I removed the short (a clumsy addition born of desperation after several rewirings), but I'm afraid it still doesn't work. I can feel the motor vibrating.
That program was an extension of a previous program that worked, with the previous code omitted (all it did was read a potentiometer and display a pattern of blinking LEDs). I used library examples as a basis, as well as several online examples that were very similar. I haven't been able to connect a single combination that works.
I read through both of the links that you gave me- the TI link had details that were over my head and beyond the scope of the course that I'm taking. The details that I did understand unfortunately didn't result in a rotating motor.
If you'd like to take a second crack at what I'm doing wrong, I'd greatly appreciate it, but I understand if you don't. Thanks again.
Thanks for the link. Unfortunately, having read all 12 pages and visited several links provided in them, I still cannot get my motor to move. I only feel it vibrating. I'm only interested in getting it to work with the Stepper.h library for now. I suspect that if I can't get that to work, then I've got some sort of wiring/voltage/current issue that wouldn't allow the more detailed sequences of turning pins ON and OFF to work either.
LarryD:
It is very important the coil wires are connected in the right order.
Also, use a DVM and check there are not any open coils.
I feel like I've tried almost every one of the 24 permutations of four wires by this point, but in my research I've found that 8 of them should work, since you only have to get the right pairs (though it may not go in the right direction). I've since paired up pin 1 with pins 2, 3 and 4, and all of them result in vibration. I have a DVM and I got an A in my Intro to Circuits class 2 years ago, but I'm really not sure what to test with respect to the wires, although I've only spent about 15 minutes researching that (ongoing).
LarryD:
BTW
If you are trying to power the motor with the Arduino, don't!
You need an external 5 voltage power supply fo the motor.
I thought that using an Arduino to power a little 28BYJ-48 with no load attached to it would be ok. If not, that's just one more reason that my professor is awful since a power supply wasn't in our equipment list. He did have us buy 9V battery strap, but I'm a little hesitant to just directly connect a 9V battery to my motor.
wex52:
. He did have us buy 9V battery strap, but I'm a little hesitant to just directly connect a 9V battery to my motor.
If this is a pp3 its probably usless for this.
Supply should be connected to the chip not the motor.
EDIT.
Apologies its connected to the motor not the chip.
That chip has open collector outputs so your diagram is correct with the short removed.
Even if you have the motor connections wrong you should not damage it using a pp3 though although you may flatten your battery rather quickly.
wex52:
I thought that using an Arduino to power a little 28BYJ-48 with no load attached to it would be ok.
Do not be fooled by physical size, read the data sheet.
I have a matchbox sized BLDC motor rated at 800 watts (over 1HP ) continuously if cooled.
Learn by doing makes things stick in your brain, but can be a real pain in the butt.
Oh, I know. But I'm a 16-year veteran teacher myself, and the way this guy runs the class is inexcusable. 8-line rant deleted
Anyway, I'm looking through my equipment list, and I've got an LM7805CT voltage regulator which I can attach to a 9V battery with the 9V battery strap. A friend of mine who knows a little about electronics tried to guide me to create a circuit that I could use as a power source for the 28BYJ-48 motor. He says I don't need the datasheet-recommended capacitors because it's okay if the signal isn't "clean" for my purposes. But, he stuck on four 1-Ohm resistors in parallel to control the amperage. I'm getting 4V (instead of 5V) out of it, but the motor doesn't even vibrate. When I switch the power from the regulator to the Arduino, it starts vibrating again. When I reconnect to the regulator but remove the resistors, the motor will vibrate. Still can't get it to move though. I have tried all 3 possible wirings for 2 pairs of 4 wires for the motor.
I'm going to look into how to test if my motor is just flat-out busted or if an external power supply is just flat-out necessary. I kind of doubt the latter because a very detailed entry at arduino-info.wikispaces indicated that the Arduino would be sufficient for a one-motor demonstration.
I'm about to give up and join my classmates in figuring out how to do all of these assignments on a PICkit 3 instead of an Arduino. Learning is one thing, but I have to pass this class.
wex52:
Anyway, I'm looking through my equipment list, and I've got an LM7805CT voltage regulator which I can attach to
Can you post your equipment list.
Also ask prof if he knows if a pp3 will drive that motor.
delay(500) is in the loop so step isonly executed every 1/2 sec so it is possible it is working but the gearing means you do not notice it.
wex52:
He did have us buy 9V battery strap, but I'm a little hesitant to just directly connect a 9V battery to my motor.
This sounds as though he knows the arduino does not supply enough current.
However it will not last long so if you spend 3 hours debugging it could be flat, test it with a meter as larry suggested.