Maker Pro
Maker Pro

Motor Servo Controller

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
Hello all. This is the second circuit I've designed so I thought i would get some feedback. I have a pretty solid understanding of motor controllers and my first circuit i made was an emitter follower so i decided to work on a signal source for the motor controller first.

This circuit changes the behavior of a motor to a servo by using potentiometer as a position sensor to provide the signal for switching directions. I used a sine wave generator in the circuit to simulate the signal that is generated by the potentiometer. Obviously the actual signal will be different because the voltage on the signal will change when the motor switches directions. The reason there is a separate voltage source for the motor controller is because this source will be provided by a signal from a sensor to control the slew rate on the motor.

Notes:
Q7 should almost always switch on first.

Q1-Q4 behave like a nand latch

Q5 & Q6 determine when the latch flips ((Voltage > 4.9) || (Voltage < 1.5))

The resistors are are all stock values accept R2 & R4 which are a combination of stock values.

Edit:
Already fixed something. I added a 200Ohm resistor above the Q6 emitter to lower the current on Q2's base.

Is there anything I should do to make the operation of this more stable? Are there ways I could simplify this? Is there anything I am missing? Is this fine as it is?

Any feedback will be appreciated!servo-signal.png plot.png
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
It strikes me that a comparator driving an H Bridge would be a better option, and dual comparators with a small window even better.

What do Q7 and Q8 control?
 

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
A dual comparator would be great. The LM339 looks like it would be perfect for what I'm doing.

Q7 and Q8 are controlling the PWM signal to a full bridge MOSFET driver.
 

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
Well, now that I've sat down and tried the circuit with the comparator I'm realizing that it might not be as simple as i had hoped. Were you thinking that the comparators would use the signal provided by Q5 and Q6 and just replace Q1-Q4? Otherwise it looks like i would need to invert the signal to one of the comparators to get rid of Q5 & Q6. Of course i might be approaching this thing wrong...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
You need to google "window comparator". This circuit will allow you to have one output active when the position of the pot is one side of your desired point and another active when it is the other side. The "window" part comes in because there is a small and adjustable region around the set point where neither output is active.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Note that in many (most) window comparator circuits the outputs of the two comparators are connected together. You will need to keep them separate. Note that comparators need a pull-up resistor on their outputs.
 

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
It turns out that I was pretty much setting up a window comparator unbeknownst to me. I'll have to play around with the circuit using your advice, but here's what i have:
window-comp.png

Right now I'm struggling with latching the outputs. Every configuration i've played with has caused some erratic behavior. I'm hoping that if I split the outputs like you said, I'll be able to work out a configuration that will achieve what i'm looking for. I really need this circuit to behave like a nand latch. Here's an example of what I mean. Where the outputs overlap, the first high output should keep the other output low until the first output is pulled low, and this pattern should repeat. Here you can see the output for the circuit above, and i've highlighted how the output needs to be changed:
window-plot.png

So you can see that for the operation of the motor, if 0.5 Volts = 0 Degrees and 4 Volts = 90 Degrees. The output for V1 is high for 0.5V and up, and the output for V2 is high for 4V on down. So V1 drives the motor from 90 to 0 degrees and V2 drives the motor from 0 to 90 degrees. Of course in reality the operation is nowhere near that exact and the plot above doesn't exactly match my description, but I'm not worried about precision. Anyway, you can see that both outputs can be high roughly in the 0.5-4V range and outside this range the output switches and then holds. I hope that clarifies what i'm trying to do.

Of course I do have this feeling that I'm over complicating this...
 

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
Ok, I just realized that when both outputs are high on a nand latch, the output is metastable. That's why i was getting the "erratic" behavior. I'm not sure how or why my first circuit avoids metastability. The only logic combinations i know that allow both inputs to be high do not match my output requirements. Given the fact that DC servos have a built in microcontroller, I don't think there is a simple solution to this problem.
 

Vangaurd

Mar 13, 2015
6
Joined
Mar 13, 2015
Messages
6
After taking some time away from this I think I came up with the solution:

servo-signal2.png

It produces fairly neat output:
signal-plot.png

I think I could accomplish this with the LM339, but I'm not positive. Do you see any improvements I could make or have a better suggestion for a comparator I should use?
 
Top