Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

pidgin

New Member
Hi people :)

I would love some help reviewing my little circuit..

I have a peristaltic pump (based on a NEMA17 stepper motor) connected to a Tb6600 stepper motor driver, that gets it's "step" (PUL) signal from a micro-controller (NodeMCU ESP32-S). To have the pumping action, you need the motor to be Enabled on the stepper motor driver. 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 (ENA) 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 as well as the complexity of the module code, 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).

I use a stepper motor driver (TB6600) which has an "ENABLE" function (ENA+ and ENA-). The ENA- is 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.

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'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.

First, 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)
Second, I want to create an inversion logic, so that this signal, when high, Enables 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/yhdw4wxw

And here is a screenshot of it:
circuit-20210812-1705.png


My details of the circuits, and therefore the doubts/questions I have 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 Tb6600 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 R2 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.A capacitor of 10uF without any direct load on it, supplies me with a bit more than a 0.25 seconds delay of continued engagement once the "Step" signal goes to low. That's enough for my needs, as the actual frequency that the "Step" signal has is always going to be above 100Hz. I don't want a capacitor that is too large in capacity, so that it doesn't take too much (time.. and current from the micro-controller) to charge. there is no direct load over this capacitor (like a resistor connected in parallel to it) and I rely solely on the transistor to discharge it. Is that a safe thing? Empirically, it works fine. But is this a design mistake?

5. The diode after the switch at the top (next to the 40Hz source) 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.
Ron
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top