This is my first post in the forum, and my first Arduino project. I am trying to build a focusing tool for my photo lens, to help me focusing at night (on a bright star) without touching the lens.
I would like to use an Arduino with a 28BYJ-48 motor and the ULN20034 shield. The fact is that the motor is always under tension even when not used,and it drains the batteries. Therefore I'm looking for a way to switch the alimentation off when I'm not using the motor. The 28BYJ a enough torque when not powered to keep its position.
My control command has just 4 buttons, 2 for in focus, 2 for out focus, with two speeds.
The idea is to power up the motor as soon a a button is pressed, and to power it down a few seconds after no button is pressed. That does not seem a problem for the coding to me, but it is a problem for the hardware... I'm not really keen in electronics...
What software / library are you using for driving the stepper??
You can probably just write LOW (0) to the 4 motor driver lines to remove power. Probably the next motor step you cause will output the next step OK. The software doesn't KNOW you turned the drive off, and should apply power for the NEXT step in sequence.
Add a OFF button, or even have your software notice that no buttons have been pressed in last 5 or 10 seconds and turn all 4 bits off.
The easiest way I found for controling power is to use IRF520 Mosfet module, it is cheap (0.50$ with free shipping on aliexpress), easy to use (GND, VCC and SIG lines), works with 3.3V as well as 5V and can contol quite some current/draw. I have used those modules for many scenarios, this year mainly to drive 5000lm led (38V/1.5A) for self made highspeed flash for global external shutter capturing (of eg. 109m/s airgun pellet inflight, two times in single frame by multiple exposure, 8.33µs strobe pulses with 3kHz PWM, see bottom). Because the IRF520 can handle only 24V max, I used simply two in series (see yellow mini-breadboard). In your scenario you will use IRF520 module to control connection to VCC and GND pin of ULN20034.
I just ordered some Mosfets to try. I tried Terry's idea, but it does not work well. When I set all pins to LOW, the motor does not start anymore when I reactivate the pins, I have to reset the board...
The solution that switches off the stepper shield external power is nice because it doesn not modify the UNL200034 pins settings.
PS : I was using the 28BYJ-48 with the Arduino's 5V output ... bad idea ... I now need to buy a new board !
fred_76: PS : I was using the 28BYJ-48 with the Arduino's 5V output ... bad idea ... I now need to buy a new board !
I don't know what you did, but I routinely do power 2(!) 28BYJ-48 stepper motors from the two 5V pins of a single USB-powered Arduino Uno -- even when controlling them from a Raspberry. This posting contains a summary of discussion in thread that it is safe to do so. USB-powered Uno provides 450mA (12V powered much less), and a single 28BYJ-48 stepper draws constant 200mA(100mA) in half-(full-)stepping: https://forum.arduino.cc/index.php?topic=648859.msg4377804#msg4377804
Here is an example of two stepper motors powered by a single Uno: https://forum.arduino.cc/index.php?topic=652758.msg4400552#msg4400552
There were long times during the arduino.cc vs the other arduin dispute where you could not buy Arduino Due. During that time I got used to buy them on Aliexpress (for 12$ with free shipping). You do get Uno R3 there for less than 3.50$ wth free shipping. In case of urgency I can get an Uno R3 on German Amazon prime the next day for 11$.