I have 2 DC stepper motors (28byj-48) from a 12V power rail (With their own driver modules ULN2003A), they are selected via 2N2222A NPN each.
The NPNs, Arduino, CD4051 are all powered by another 5V source. All circuitry share a common GND.
I simply cannot get the NPNs to switch properly.... If I power everything with 5V (including the motors), the transistors switch properly, i.e. CMOS Vouts are OK, but obviously motors don't turn because of the lower voltage..
I'm not sure if I have my Rb is off. But I tried anywhere between 1k - 5k ohms, depending on assumption of motor as resistive load, Hfe etc..
I tried to power CMOS with 12V (so I eliminate transistors, Channel outs power motor instead) but then it needs 9V from Arduino for a "H".. so I am using a combo for 5V+12V with CMOS+NPN to select the motors. I only need 1 motor ON at a time, and I will have 10+ motors hence why I can't use all the GPIOs... and I'm trying this approach. I know relays, cascaded shields with shift registers can be another approach. but really trying to learn where am I off?
With the original setup desribed (12V motors, 5V logic, the CMOS channel outs are only 1V when connected to NPNs, so .... no idea how to prevent this)..
Very, very poor diagram attached.. GNDs poorly shown, and some EN/VSS etc.. not shown... pls ignore.
Welcome to the forum.
Your description is very confusing, and your diagram even more.
Please read
and follow the advices. Draw a diagram which shows all of your connections and show your sketch.
A DC motor is something very different compared to a stepper motor. From the type I suppose it's a stepper. How Do you plan to select them with a NPN transistor? The motor coils should be connected to the driver output.
Please tell a bit more about your project. Maybe there are other solutions.
Edit: You know that steppers don't turn by themselves?
It's a 5 volt motor so likely You have burned down things.
Thanks for the schematics!
According to the datasheet that stepper has 6 terminals. You only show 3.......
Your drawing seems to show two DC motors (NOT stepper motors). It's not clear why you mention 28byj-48 steppers and ULN2003A drivers. Are you trying to save pins by sharing one ULN2003A driver over multiple 28byj-48 steppers? That won't work because the common terminal on the 28byj-48 stepper is the positive voltage supply and the "ground" pin on the ULN2003A is just there for the snubbing diodes. There is no place for a singe NPN transistor to turn the motor ON or OFF. You would need four NPN transistors per motor (between the motor and ULN2003A) and turn them all ON to select a motor.
They are steppers, correct... Yes I am not showing the motor coils connection either... I am driving them with the nano.. sorry I tried to make it not too busy... Tried using fritz but its very, very frustrating...
Basically the nano digital pins select the motor via NPN transistor, to complete the circuit to ground... and the 4 outputs (from Nano) required to drive the motor coils are daisy chained to all the motors...
My rational, I only need to control 1 motor at a time, so let the Nano Douts go to all the driver modules/motors, the motor to turn will be have the NPN ground it. Is this even possible? Don't see why not..
Just to be clear, if I bypass the demux, everything works fine....
As @johnwasser already pointed out that will not work. If at all you need a high side switch to switch the 12V.
Or you use 4 multiplexer to switch the inputs of the ULNs?
Aha.... OK... this simply is a flawed design... Thank you @MicroBahner and @johnwasser , back to the drawing board then.. btw, each motor has its own ULN2003A... FWIW
Anyone can suggest a more succinct way to control several steppers with a nano + demux or shift register, i.e. not to chew up pins? Would a PNP driving volts to the motors instead work, i.e. current sourcing?
+1
For ten 12volt 28BYJ-48 motors you should move to TPIC6B595 chips instead of the ULN drivers.
Then a single Nano has no problems driving 100 of them.
Leo..
Thank you all for the valuable feedback. I attach the original setup for final clarity.
So @johnwasser was kind enough to explain the GNDs here are N/A which makes a lot of sense now, why LEDs worked but not steppers, I suppose DC motors would have worked too. Side Question: do I need to worry about emf and use of capacitors / flywheel diodes in this setup or because i have a ULN2003A, it essentially fulfills that role?
The group consensus is to use high-current shift registers (TPIC6B595). This probably also means I can drive several motors at the same time, is it correct (assuming my PS can handle the draw)? I read the spec sheet, it says they are current sinking, so it means the logic is inverted, correct? I know It doesn't matter for a motor as the coil alternates through the states, but I am only asking to understand fundamentals vs. driving a ULN2003A directly instead.
Final question, If I want to keep my original setup and flip to PNPs to turn ON/OFF motors as needed, would this work? I know I would need an NPN as well to prevent saturation.
Correct. Full control over all motors, including single coil drive dual coil drive and power off.
Just like 10 not matrixed ULN chips.
Yep, same as the ULN2003.
Your setup could work, but the transistors need current limiting resistors in the base.
Because CD4051 switch current is 10mA absolute max.
Which is not much for the 2N2222, that is switching full motor current.
What else are you doing with the Nano (why the CD4051).
Because the Nano has enough pins for 10 motors.
Leo..
Your setup could work, but the transistors need current limiting resistors in the base.
Because CD4051 switch current is 10mA absolute max.
Which is not much for the 2N2222, that is switching full motor current.
Yes, I'm aware of Rb, but we know now NPNs won't work.. but for sake of discussion i.e. if it was a DC motor, Ib max is 5mA and 2N2222A has gain of >100++, so I don't see a design issue, can you clarify what you meant for sake of education?
What else are you doing with the Nano (why the CD4051).
Because the Nano has enough pins for 10 motors.
Can you elaborate a bit more what you're thinking. We reserve a total of 4 pins for stepper since we are driving only 1 at a time, but then we need 1 pin per motor to select unless we use a shift register or demux etc.. so 4 + 10 = 14... In this case 5V Dout is not strong enough either for motors neither supply current..
Initially I wanted to do away with the transistors and just select motors with the CD4051 directly, but it needs 12V Vcc so that outputs drive the motors, and then channel selectors need 9V which the Arduino doesn't output... I suppose I could add opamps to boost Dout from 5V to 12V, feed into CD4051 channel selector... maybe?
I don't see any PNP transistors in your schematic. You still switch GND, and that will not work. I don't understand your last sentence. You should not prevent saturation.
You need the NPN transistor to switch your highside PNP transistor. The PNP switches the 12V for your motor.
But I would prefer the solution with shift registers.
Gain is irrelevant when a transistor is used as a (saturated) switch.
Look at the Ib/Ic saturation graph in the 2N2222 datasheet.
Pin 2-11 for the transistors, and A0-A3 for the ULN inputs.
Analogue pins are just digital pins, with the added functionality of analogue-in.
digitalWrite(A0, HIGH); // is valid
digitalWrite(14, HIGH); // does the same on a Nano
Motor power (ULN board 5-12V pin) comes from a separate 12volt (or 9volt) supply.
Leo..
If you use TPIC6B595 (or shift registers and a ULN2003A per motor) you don't need a 'selector' to pick which motor you are controlling. Just turn off all four pins on any motor you want to 'turn off'.