Stepper motor Driver Works fine when no motor

I have built this

and to make the clock turn you use the included code, a ULN2003 stepper motor and a 28BYJ48 stepper.
I have flashed the code to an uno and plugged the stepper driver in and it works fine.
I have then tried a nano with the same driver and motor and the motor does not spin in the correct way.
Originally I thought this might have been to underpower as the driver was being powered by the 5V pin on the nano and the nano was plugged into to my computer still, (however the Uno worked fine in this configuration), so tried powering the nano from a 9V souce via the Vin plug and used the same 9V source to power the stepper but I had the same result.
When I unplug the motor, the driver's LED light up as expected. I have tried different drivers and motors and I get the same result.
I have also tried using a simpler code using the accelstepper libary and that gives similar results. Motor plugged in weird behaviour, pull the motor out of the stepper and it works fine.
Any suggestions?

The Arduino is not a power supply. Power the motor separately, making sure that the power supply is rated for more than the required motor current, and don't forget to connect the grounds.

9V block batteries are for extremely low power devices like smoke alarms, and are totally unsuitable for Arduinos and motors.

2 Likes

It's powered via a power supply not a battery and the code, board and PSU work fine with the Uno but not a nano.Grounds a linked on the nano as the board functions fine without the motor.

How do you know that?

If I unplug the motor the LEDs on the ULN2003 flash correctly, like they do on the uno.

Measure the motor voltages (supply, phases...).

I've attached a scope to the motor driver, no motor plugged in getting nice square waves of around 1.6V when supplied with a 5V in, add the motor and the signals go all over the place.

Have screenshots?

First is with no motor,

Second is with the motor

It looks acceptable for an inductive load (motor) with a too weak power supply. You see the ripple in the high state? At least add capacitors to the driver. Also consider that the Darlington drivers drop 1V or more in ON state.

If the waveform looks different with the Uno then you have a problem with your cables.

Where would I add the capacitors?

Close to the driver (chip).

Is the low voltage around 1V and the high close to 5V.
If not, something is wrong with the driver, or something is not wired correctly, or your 5V supply is bad.

Peak voltage is around 2.70V
Minimum voltage is 0.5V when powered by USB

Ive attached an external power supply of 9V to power the nano via the Vin port
Now I get 8.16V maximum and 0.6V minimum

Both without the motor plugged in
On USB maximum is 3.69V and the minimum is 0.6V
With the 9V supply, the maximum voltage is 8.99V and the minimum is 0.9V.

Also this is a different driver board and motor combo.

I've also scoped the uno running the same code and these are the traces for that

Uno off USB with motor


Vmax is about 5V
Vmin is about 0.9V.

Uno off USB with no motor, and it looks the same when the Uno is supplied by the barrel jack


Vmax is 3.75, Vmin 0.6

USB off barrel jack with motor looks the same as off USB and has similar voltages
There is a capacitor on the driver board across the Vin and gnd pins

Also show the driver supply voltage. Do you have a dual channel scope?

Yes, here's the dual channel, the first is the uno, the second image is the nano.
The nano was running the code for a few loops and then froze.


What do you measure, scaled how? How can the motor (phase) voltage in OFF state become so much lower than the driver supply voltage on the Nano?

Both are two volts per div.
I'm not sur what you mean about the off voltage

If the driver is OFF then the phase is only connected to the driver supply and should show about that voltage. Any deviation indicates a weak supply or stray current from wrong wiring.

I don't think that the entire coil is meant, only one phase. Otherwise the voltage of 5V applied to the coil will reduce to 2.5V per phase.

A motor driver always has to be powered by its own PSU.