A4988 disabled by default on power up

Hi Everyone!

I decided to ask your opinion on a matter I can't seem to resolve elegantly, because It feels I am missing something obvious.

I would like my A4988 driver to start out of the blue disabled, but I need to enable/disable it later using Arduino code, and unfortunately, we can't have an Arduino pin set to high as you power up, it's only via code, and the enable pin requires a HIGH state for it to be disabled.

During that small time frame when the power is coming and the code is executed, The step motors is picking up noises and as a result buzz around until the code finally disable the drivers. it lasts a very short amount of time, less than a fraction of a seconds, but it doesn't sound nice and doesn't feel safe.

I can only seem to conclude that the only way is to use a NOT gate so that the driver is disabled when the Arduino pin is actually low.

Am I correct?

I guess there should be no noise to begin with right? or noise is part of the initial procedure when you turn on the power supply?

Regardless of the noise issue, I would really like the step motor to be disabled no matter what, as a safety measure basically.

Any insight will be greatly appreciated!

Have a great day!

Bye,

Jean

ps: Just a word on the current state on my project so you understand where I am coming from. I have 8 stepper motors, 6 nema17 using hw-343 and two nema24 using Tb6600. Everything is running perfectly, I am just ironing out the last few issues like this one. This is my first real world project I designed, coded and built from scratch and for sure I must be doing a couple of things the wrong way, but overall very pleased with the result so far.


The quick answer is use a pull up resistor. 4k7 should do.

FYI: GPIO pins are set to INPUT by a reset. That is a high-impedance state, the pin "floats". But the pin is neither driven low nor high. So a NOT gate would not help.

Oh, and nice job on the build!

Not hard to do as @bobcousins indicates it is in a high impedance after state but by adding a pull up resistor your problem should be solved. When doing setup set the output first before setting it as an output to keep from a potential glitch.

Thanks for the information, I think I start to understand where I was not seeing clearly what was this is all about! I am away for a week, will try when I get back!

Hi, ok, will do that, I saw a couple of time this trick to first set the output value before actually so the pin mode, I was not sure why, it make sense. Thanks!

Hi,

Is my understanding correct in the diagram below? I could not find a diagram on a pull-up resistor connected to an Arduino output pin. Not very confident on this matter, I admit.

If I am correct on this diagram, I am tempted to solder directly the resistor at the back of the HW-343. Would be the most direct way to go about this, isn't it?

Thanks :slight_smile:

True
With the pull-up you are treating the symptom and not the cause if indeed it actually works.

To avoid the initial noise, you’re right that using a NOT gate on the enable pin could help. The A4988 requires the enable pin high to disable, and with the NOT gate, it would keep the driver disabled during startup. Noise at startup is common, but adding this should solve your issue.

Hi,

Yeah, I suspected so, but suppressing the noise likely mean a complete overall, and my uneducated guess points me to a bad ground wiring strategy, but that's a guess without any empirical experience or any actual proof.

So right now I need this to work, because I am running out of time and I need this prototype to work asap, so I am indeed aware I am treating a symptom and not the root cause... all in all, as I mentioned I also need for security reason to have motors disabled by default, so this is required anyway with or without any noise issue.

Bye,

Jean

Hi,

I am going to try first with a pull-up resistor and see if it works. It's best If I can avoid excess complexity.

Bye,

Jean

Yes, that looks fine.

I'd try it one module first, it may do nothing

Thanks :slight_smile: Gives me more confidence.

Bye,

Jean

Hi,

Sure. Where would noise come from otherwise? The more I think of this, the more my issue with the -EN could be the source of the noise actually, if it's floating, it could go on and off randomly several times, hence my motors going crazy being powered on and off so many times so fast.

when powered off, and I plug the arduino via usb, hence the program is running and I power up the machine, then I have no noise at all, so there is a chance that it's indeed the enabled default state of the drivers that is the issue. The same is true if I have the emergency button pushed, If I turn on the main power, the arduino starts ( I wired it so the emergency button only cut the motor power, not the logic), and then if I release the emergency button, no noise.

Hopefully this is it. but I do have another small issue with a weight sensor that acts worse with random noise when the motor power is on, but works smooth when only the logic is powered. but that's for another topic on this forum :slight_smile:

Bye,

Jean

On the pololu A4988 it's pulled low with a 100K resistor, which may not be enough to overcome noise issues. However Step and Dir are floating.

If you pull up thest pins you now have the problem of a powered device being connected to an unpowered Arduino

Hi,

And what kind if problem is it if I have a powered driver but an unpowered arduino? you can't have 5V on an arduino pin if arduino is not powered?

Bye,

Jean

Funny and unpredictable things can happen. What happens is that current will flow through the I/O pin protection diode to the positive supply and possibly start to power the Arduino. It may get in a hung state or go off/on or maybe nothing. Depends on a lot of things what will happen

In general, it's not a good idea to have a powered device, even a resistor, connected to an unpowered Arduino.

Hi,

I though Arduino needs at least 7V to start operate?

one other thing is that the 5V from the pull up is the 5V coming out of the Arduino.

Regardless, how one would go about having a disabled A4988 by default the proper way?! it's really odd that's for any kind of machinery to have its motor driver on by default isn't it, it's not safe, first the logic should settle everything and then powering up motors isn't it?

Bye,

Jean

That is OK if the driver is also powered by the 5V from the Arduino.

though Arduino needs at least 7V to start operate?

True if you are powering via Vin or the barrel connector but that volatge is regulated to 5V for the microcontroller

it's really odd that's for any kind of machinery to have its motor driver on by default isn't it,

These devices, including the Arduinos are intended for hobby use.

Regardless, how one would go about having a disabled A4988 by default the proper way?!

Power should not be applied to anything connected to the Arduino until the Arduino has run it's system initialization code to make sure everythig will be in a default state when powered.

Hi Jim,

Thanks for all these great comments! very much appreciated!

Regarding your last comment, I am hesitant of adding a relay to let the Arduino decide when to bring power to the motors ( this is what you imply I assume), would it be the right way forward in all cases, that power has a relay switch turned on by Arduino when everything is good to go?

Having the drivers disabled by default would end up with the same overall result, isn't it?

My task for this project is to make the most cost-effective solution, hence why I start with all of this, I have already upgraded to bigger motor and drivers where needed, Arduino has yet to fail on me during regular operation. If it happens and Arduino or motor drivers shields fails me, I will consider a proper automate, I am open to this evolution. Plus I think Arduino is providing an "industrial serie" isn't it (Arduino Opta WiFi — Arduino Official Store)?

Bye,

Jean