Circuit review/analysis for a stepper motor auto-enabling and time-delay mechanism.

Thread Starter

pidgin

Joined Oct 30, 2020
21
Hi people :)

I would love some help reviewing my little circuit..

I have a stepper motor driver (TB6600) which has an "ENABLE" function.
It has an ENA- that is supposed to be connected to the ground, and a ENA+ where you supply the signal for ENABLING or DISABLING the stepper motor connected to it. That ENA+ pin is active on low, which means that if you don't supply any voltage to it OR you connect it to ground, the stepper motor driver enables the motor (movement or lock). Otherwise, if you supply any voltage to the ENA+ pin, the motor is disengaged and can be turned freely by hand.
So far so good, it all works fine.

Now, I want to be able to reverse this, so that when a voltage is supplied in an "Activate" line, the stepper motor driver (and motor) is Enabled, while if the voltage is very low, the stepper motor driver (and motor) is Disabled.

Furthermore, the enabling of the motor should be based on whether or not there is a "Step" signal provided to the stepper motor driver (the signal is on-off-on-off..., each change is a single step), to turn the motor.
However, I can't connect the step signal directly to the "Engage" line, because it needs to be consistently on, and not going on and off.
So.. I want to create a time delay circuit that will turn the "Engage" on as soon as there is a "Step" signal going high (on), and will keep it on for a bit after it turns low (off), so to make sure that it's disabling the motor just because it went off as part of the regular motion.
(my plan is to always set the "Step" signal to low, when I want to disengage (disable) the motor)

So.... I have come up with the following schematic which works!!

However, I wanted to check with people who know more than me about certain things I'm noticing, as well as ask about possible flaws in the design and design aspects and values which I've set that I'm not sure about.

The design can be accessed here : https://tinyurl.com/yh2fubnw

And here is a screenshot of it:
circuit-20210811-2019.png

My questions are:

1. The transistor I'm using is basically any NPN transistor. In my case an A42.
Is that correct? It doesn't really matter what NPN transistor I use, as long as it can handle the 5V range?

2. R1 is set to 2.2k. I tested this empirically and believe that the importance here is to have in place a resistor that is low enough to not impede the ability of the opto-coupler in the Tb66000 on the ENA+, but high enough to not generate a current too high going into it.
The question is.. Do I even need a resistor there? I get the feeling I do, as otherwise there is no resistance between the 5V source voltage connected to the R1 resistor at the emitter and the ground connected at to the collector
(I did notice that a 50 Ohm resistor works fine as well.. and that a very high resistor, like 500k prevents the motor from ever disengaging)

3. The R3 resistor is just there to limit the current into the Base.
Is it correct that it doesn't really matter what specific value I use as long as it triggers the transistor when there is a base current above a certain value? Or would it be smarter to have a very specific value there?

4. R2 is there to discharge the capacitor. Playing around with the capacity and R2 value changes the time the "Engage" stays on. A capacitor of 220uF with 33K resistor for example allows me to have up to 7-8 seconds of continued engagement once the signal goes to off. Anything over 1 seconds is fine in real life.

5. The diode after the switch is a simple diode (1n4007 in my case) that there to make sure that the capacitor doesn't creep into the "Step" signal of the Tb6600. As that 40Hz signal is actually coming from the "Step" (PUL+) pin of the Tb6600, I didn't want to "confuse" the driver with signal that may come from the capacitor.
Am I correct in it's necessity? Is 1n4007 proper one for my use? (Or an overkill?)

6. The "Step" signal I'm using in the simulation is a 40Hz 0V/5V square wave.
I've observed that as soon as I close the top switch and allow the signal to flow into the circuit, the voltage after the diode jumps first to about 7.5V, and then over a short time drops to about 4.5V. I am not sure if that 7.5V is an issue for me. I know that empirically nothing bad happens when I test the mechanism in the real world.. and I believe that it has something do to with the capacity and the original signal combining, as there are no coils here to cause strange voltage spikes.. But can anyone confirm or explain it?

Thanks a lot in advance.
 

AlbertHall

Joined Jun 4, 2014
11,610
The source of the step signal has to be able to supply a large current to charge the 220uF capacitor. If it only has a small current capability the capacitor loading may mean that the first, of the first few, step signals will be loaded down and so not big enough the actually step the motor. So there will be missed steps.
 

LowQCab

Joined Nov 6, 2012
1,355
Even though your write-up is very well done, it doesn't replace
part-numbers and a proper schematic so that other people can
easily grasp what You are trying to do.

Your write-up needs to be for conveying the reason that You
started this pursuit in the first place, in other words,
what is the initial problem You are trying to solve,
and why You are trying to solve it in a certain particular manner.
Start from the beginning.
There may be 10 different ways to achieve your end goal, and 100 that won't work as expected.
.
.
.
 

Thread Starter

pidgin

Joined Oct 30, 2020
21
The source of the step signal has to be able to supply a large current to charge the 220uF capacitor. If it only has a small current capability the capacitor loading may mean that the first, of the first few, step signals will be loaded down and so not big enough the actually step the motor. So there will be missed steps.
This is a great observation. Thanks Albert.
It is actually OK to miss a couple of steps at the beginning, in my specific use, so I wouldn't really worry if it did. And since the frequency of the steps is quite high usually, is seems that empirically it is not really an issue indeed.
The source is a micro-controller, by the way. And ESP32-S (NodeMCU)

However, thinking about your feedback made me even more cautious, and I've made the following changes:
Instead of a 220uF I move to 10uF. And I've removed R2, so now the capacitor discharges without an additional load.
As it happens to discharge though, I'm assuming the transistor itself is enough to act as the discharging load (correct?)
Testing this setup, it seems that it discharges in more than 250ms.. so I'm good.

What do you think?
Is 10uF a good choice in this case?
And is no R2 a good option? or it is too strange not having a discharging load, even if it is something like 1M?
 

Thread Starter

pidgin

Joined Oct 30, 2020
21
Even though your write-up is very well done, it doesn't replace
part-numbers and a proper schematic so that other people can
easily grasp what You are trying to do.

Your write-up needs to be for conveying the reason that You
started this pursuit in the first place, in other words,
what is the initial problem You are trying to solve,
and why You are trying to solve it in a certain particular manner.
Start from the beginning.
There may be 10 different ways to achieve your end goal, and 100 that won't work as expected.
.
.
.
Hi there.
Sorry if I was missing some details. I was trying not to have a post that is too long to begin with.
I will try to fill in the blanks.

Initial motivation:
I have a peristaltic pump (based on a Nema17 stepper motor) connected to a Tb6600 stepper motor driver, that gets it's step signal from a micro-controller (NodeNCU ESP32-S). To have the pumping action, you need the motor to be enabled. However, when the pump doesn't need to pump anything, it's a waste to keep the motor enabled, as it keeps drawing current, getting hot, and shortening the motor's life-span. therefore, I need to control the ENABLE action of the motor driver. To do this, I could use another pin-out on the micro-controller, BUT since the design aims to minimize the I/O ports needed, I came up with the idea of automatically enabling the motor when there are "step" signals sent, and turning it off quickly after the "step" signals stop coming (given that the signal always end with "low", so that it's not in a constant state of charging the capacitor and basically locking the ENABLE state at active).
And as I said in the original post, since the ENA+ pin on the motor driver is active at low, I also needed to inverse that action.
So, I've decided to create a circuit that does both. Using a time delay for detecting ON state in the "Step" signal, as well as reversing the Active-low logic.

As for parts, I hope I mentioned all. Let's see, especially now with the additional details of the source of the signal..
Source: NodeMCU ESP32S micro-controller.
Motor driver: Tb6600 (connected to Nema17 motor, although that part is not really important as it is isolated from the circuit)
Resistors: Standard resistors.. values are in the schematics as well
Diode: 1n4007
Transistor: A42 (NPN)
Capacitor: Regular 220uF (or 10uF with the latest change) polarized capacitor

That's about it. Am I missing something?
Best,
Ron
 

LowQCab

Joined Nov 6, 2012
1,355
This doesn't make any sense.
The additional Circuitry required far out-weighs simply
using a more capable Microprocessor.
More Board-Space, and more complexity.
I don't get it.
.
.
.
 

Thread Starter

pidgin

Joined Oct 30, 2020
21
This doesn't make any sense.
The additional Circuitry required far out-weighs simply
using a more capable Microprocessor.
More Board-Space, and more complexity.
I don't get it.
.
.
.
I appreciate your point of view. However, this makes sense to me, especially after spending many weeks thinking of the different aspects contributing to the decision. The complexity is not only in the micro-processor. It is also in the modular system coding, and in the wiring.
I would love to focus the review and criticism to circuit itself.
Thanks in advance,
Ron
 

LowQCab

Joined Nov 6, 2012
1,355
You have no signal that You can use that is present "right-before" the
Pump is to be actuated.

The operation and start-up status created when the Enable-Inputs are activated
needs to be verified.

Will the Pump "jerk-backwards" when the Driver is enabled or disabled ?

What feedback mechanism actually "proves" that the Pump has actually
moved any Fluid or not ?

How much average Time is there between Pump-Pulses ?

Do You intend to simply "skip" the first commanded Pulse
and then add a Pulse to the end of the sequence ?,
using the first commanded Pulse to turn-on the Motor-Driver ?

Will the Motor-Driver deliver a Pulse while in the process of being enabled ?

Your Motor Driver has a "Reduced-Holding-Power' feature,
is this feature not adequate ?
.
.
.
 

Thread Starter

pidgin

Joined Oct 30, 2020
21
You have no signal that You can use that is present "right-before" the pump is to be actuated.
The operation and start-up status created when the Enable-Inputs are activated needs to be verified.
There is no such signal, unless I send over another wire, and dedicate another port for each of the pumps (which there can be many.. that's why I rather avoid it, as well as avoid coding the need to control an Enable port for each pump).
I 'could' keep the driver always enabled, but that's not very healthy. It uses energy, as well as shortens the lifespan of the motor.
There really isn't a need to verify the activation, as long as it is actually getting activated alongside the beginning of the pumping action. This is for two reasons: 1) for most pumps, there is a mechanism that makes sure that the right volume has been pumped, by checking the weight of the volume pumped. 2) as long as the mechanism is trustworthy, it is not a problem if the process misses few steps. Each step is actually VERY small, and in terms of pumping volume, probably represents less than 0.0005ml, which is insignificant in terms of accuracy.

Will the Pump "jerk-backwards" when the Driver is enabled or disabled ?
There is enough friction to prevent such a movement. Also, a movement backward is actually not really a concern, even if it did happen, especially given the negligible volume such a movement will cause, and especially since the direction will be backward in that case.

What feedback mechanism actually "proves" that the Pump has actually moved any Fluid or not ?
As I wrote above, a weight/volume based mechanism is responsible for exact control of volumes.
While stepper motor based peristaltic pumps are, in theory, very good at exact volume control, in practice there are many tings that contribute to increased inaccuracies over time. Few examples are: tube wall degradation, tube deformation, phase of the pressing wheels, possible air in pipes..

How much average Time is there between Pump-Pulses?
Pulse frequency depends on desired volume rate. However, it is usually between 25 and 500 micro-seconds. so, it is VERY fast pulse. However, actual empirical test with a 10uF, shows that the engagement of the driver happens already after the first pulse. Even if that was to happen only on the 1000th pulse, that would have been acceptable, as it represents a delay of 0.03 seconds. Given that it happens long before, this is a very adequate response time.

Do You intend to simply "skip" the first commanded Pulse
and then add a Pulse to the end of the sequence ?,
using the first commanded Pulse to turn-on the Motor-Driver ?
As each pulse is negligible in terms of moved fluid, skipping a pulse is not something to worry about.
Also, given that there is a mechanism for confirming the desired pumped volume, that issue becomes even less important.
Lastly, given that the accuracy needed for the process is far from one that is measured in few pulses, the issue of skipped pulses at the beginning is basically non-existent.

Will the Motor-Driver deliver a Pulse while in the process of being enabled ?
the motor driver drives the motor while the ENA+ is set to enable the motor, and with every change of the "step" value change.
If a pulse is set while the process is not yet enabled, the motor doesn't turn.
NOTE that the motor doesn't turn if ENA+ is set to enable the motor, while there is no "step" pulses sent. However, the driver does supply current to the motor, to "lock it in place". That is why the motor uses electricity and gets (very) hot, even (and especially) while not turning.

Your Motor Driver has a "Reduced-Holding-Power' feature,
is this feature not adequate ?
I do not know of such feature.
regardless though, I need to make sure the driver is disabled while not turning.
That is an important design aspect which is exactly what the circuit above was designed to achieve.


My current concern is the specific design aspects.
For example, the idea of reducing the capacity from 220uF to 10uF and getting rid of the resistor. This was a good feedback that both addressed an important issue as well as simplified the design by removing the R2 resistor. (less components = better, in that case).
I am wondering about the other parts.
- Is there anything in the design that is flawed? or could be made better?
- Is the A42 transistor a good choice? is there a better choice?
- Why is the voltage in the simulation spikes to 7.5V?
- Should I use different R1 and R3 resistors?
- Is the Diode a good idea and serves well its purpose? Is 1n4007 a good choice?
- Can I assume the lifespan of the components, and the overall circuit is basically "forever"? or am I likely to encounter a burnt transistor after a year or so, or breached capacitor, etc..?

That's what I am hoping to learn :)

Thanks for the attention. it is much appreciated.
 
Top