Hello,
I am making a project and I need to measure the current going from and to a micro motor found in the SG90 servo.
As in reply #5 and #8 in the link, I need to use a shunt and op-amp to amplify the voltage drop across the shunt.
However, because the current can go in both ways (turning the motor CW / CCW), how do I deal with negative voltages?
Can I use a bridge rectifier and then use a diode to detect which way the current is flowing? I guess then amplifying and using a differential configuration would be easy (and maybe uses only one op-amp)?
I've used the EasyEDA simulation to try and do this but I'm not sure if this circuit (partially completed) is good enough. (Note that V1 and V2 on the right are the pins that will go to the op-amp).
Although, if the entire thing could be done with an op-amp or two, that would be much better than over-complicating stuff.
Any explanation/clarification is appreciated!
Thank you!
You could try a 0.1ohm resistor in the ground wire of the servo,
and measure shunt voltage with an analogue pin.
That would only work with proper star grounding, which you should have anyway.
Increase A/D sensitivity by setting Aref to INTERNAL.
Use a 10k resistor between shunt voltage and analogue pin, for pin protection.
Leo..
If you measure the current to the motor driver, you don't have the issue of polarity changing, and one side
of the shunt can be fixed to ground permanently. This is probably what you want.
If you want to measure the current and its polarity you'll need a differential measurement anyway, and
the shunt voltages will swing the fully supply voltage when polarity swaps.
If you want to convert an AC current to DC for measurement with the shunt you must use the
bridge rectifier to steer the current to the shunt, not try to use it after the shunt (so the diode
voltage drops don't pollute the measurement).
I do want to measure the current's direction but since op-amps are totally new to me I have no idea where to start with them, unfortunately. I really did hope this project was possible using a single op-amp and some crazy op-amp logic
Anyways, I've found how to measure current's direction using two diodes here in reply #4
So based on that, I've connected the two diodes like this:
I'm not sure about the 10k resistor, I just felt it was safer?
(Note that the analogReference is no longer set to internal, as seen in one of the pictures before the current doesn't strictly affect the amplitude, but more the length of the voltage change).
And here are the analog readings from the diode (Orange line) when turning CCW. and when turning CW the spikes would be upwards:
I am making a project and I need to measure the current going from and to a micro motor found in the SG90 servo.
As in reply #5 and #8 in the link, I need to use a shunt and op-amp to amplify the voltage drop across the shunt.
However, because the current can go in both ways (turning the motor CW / CCW), how do I deal with negative voltages?
You offset your amplifier output such as Vcc/2 so for example using a single supply rail to rail op-amp with a 5 volt supply the Vout for zero current is 2.5 volts. That allows room for negative and positive swing.
Ron_Blain:
You offset your amplifier output such as Vcc/2 so for example using a single supply rail to rail op-amp with a 5 volt supply the Vout for zero current is 2.5 volts. That allows room for negative and positive swing.
Ron
This makes stuff way easier!
I will try this and tell you how it goes ASAP.
Thanks!
MarkT:
Might I suggest finding an opamp tutorial? Try googling "opamp tutorial". This shouldn't need saying
Perhaps the EEVBlog opamp tutorial video even?
I've seen EEVBlog's video and I have to say it is brilliant! However maybe because this is still new to me I still can't wrap my head around it.
The two motor wires can go to two digital inputs (with 10k protection resistors).
The difference in logic levels will give you direction, the pulse length could give you average current.
If both motor terminals are HIGH or LOW, the motor is not running,
so measuring one motor wire could be a waste of time, depending on the H-bridge design.
Leo..
Ok so I've tried doing the op-amp method, and it uses 3 rail-to-rail op-amps (at least what I came up with does) and I've only tried them in easyeda simulations so I'm not sure if they even work so...
Wawa:
The two motor wires can go to two digital inputs (with 10k protection resistors).
The difference in logic levels will give you direction, the pulse length could give you average current.
Can you please explain how this would work? Can the arduino input handle -5v??
Arduino inputs cannot accept negative voltages. You need to bias the op amp to 2.5V (1/2 VCC) with 0 input using a voltage divider, then a positive voltage would drive the output toward 5V, negative would drive it toward 0, then subtract the bias voltage from the output and multiply by 2. If output = 1V, then 1 - 2.5 * 2 = -3V. There are many op amp tutorials that show that.
MG4mes:
Can you please explain how this would work? Can the arduino input handle -5v??
Do you mean the motor terminals?
If one is 5volt and the other one is 0volt, then the motor turns one way.
If the other one is 5volt and the first one is 0volt, then the motor turns the other way.
No negative voltages involved.
Leo..