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.

Read current (voltage drop across resistor) in two directions

Status
Not open for further replies.

Odysseas

Member
Hello everyone,

I am faced with a fairly unusual problem... I want to read some current flow, and for this, I use a 0.1Ohms resistor and read the voltage drop across it. I use an Atmega16 and it's integrated ADC to read the voltage drop.

The Problem is: Current across the resistor can flow in both directions... I have a couple of relays that can change the polarity of the voltage (12V) being applied to the external load (12V Motors, to be precise) and subsequent current-sensing resistor... I have attached a rough schematic to illustrate. I'm afraid that the wiring of the motors is already fixed, I cannot change it.

When current is flowing in one direction, the voltage drop across the resistor is well within the sensing range of the ADC (<5V). But when it is flowing in the other direction, I of course read 12V minus the minor voltage drop across the resistor, that is, slightly less than 12V... But that's way to much to sense for the ADC...

Is there any way I can overcome this problem?
 

Attachments

  • motor wiring.gif
    motor wiring.gif
    14.3 KB · Views: 272
is it important that you know the direction of current flow?

**broken link removed**
**broken link removed**

You could use a full wave precision rectifier but you'll need a dual power supply which can be made using a 555 timer or is even simpler if you're running this from a transformer.
 
You can use an IC amplifier in differential mode to sense the current in both direction. Looks at the following link and a snapshot from the same webpage in the link.

**broken link removed**
 

Attachments

  • highside.gif
    highside.gif
    5.5 KB · Views: 242
I already know the polarity by which relays I activate, so that's no problem.

Thanks for those two tips already, I'll have a thorough look at either one, and post here again :)
 
Why can't you just put the current sense before the change over relay?
 
hi,

Edited your drawing, attached, to clarify the problem.

One solution would a instrumentation amplifiers, with its inputs across the sensing resistors.
You would require a inst amp that could tolerate a CM voltage of 12V, powered by say +/-15V
 
Last edited:
@ericgibbs: Yes, that's the problem, however, the four motors (which are for the electric windows in a car, btw.) have four wires to them, and one common wire to return to the control unit. That of course means that all motors can only run in one direction at a time, but that is a restriction I can live with.

In fact, I think what I need is an amplifier with a gain < 1, so that the input voltage is actually reduced, so that +12 - Vs will give me approx. 5V (or let's say, +14.4 Volts, since this is the highest voltage I can get in a car.) I have tried a simple voltage divider for this purpose, but that just doesn't seem to work... I always read +12V - Vs at the mid tap, where I should actually read much less than that.

@Hero: I need to know each individual current drain from every motor. If I would put the sensing resistor before the relays, I could only know how much all motors drain together, but not for every single one.
 
Odysseas said:
@ericgibbs: Yes, that's the problem, however, the four motors (which are for the electric windows in a car, btw.) have four wires to them, and one common wire to return to the control unit. That of course means that all motors can only run in one direction at a time, but that is a restriction I can live with.

In fact, I think what I need is an amplifier with a gain < 1, so that the input voltage is actually reduced, so that +12 - Vs will give me approx. 5V (or let's say, +14.4 Volts, since this is the highest voltage I can get in a car.) I have tried a simple voltage divider for this purpose, but that just doesn't seem to work... I always read +12V - Vs at the mid tap, where I should actually read much less than that.

@Hero: I need to know each individual current drain from every motor. If I would put the sensing resistor before the relays, I could only know how much all motors drain together, but not for every single one.

hi,
Get the datasheet for the AD623 instrumentation amp. www.datasheetarchive.com
This type of amplifier will only amplify the voltage across the sense resistor and cancel the common mode voltage. I am not sure if the AD623 can tolerate a common mode input voltage of +12V, but it will give you an idea for a solution.

EDIT: the maximum supply voltage for the AD623 type is only +/-6V, but its easy to build a inst amp using standard op amps.
 
Last edited:
Odysseas said:
@Hero: I need to know each individual current drain from every motor. If I would put the sensing resistor before the relays, I could only know how much all motors drain together, but not for every single one.
Can't you put the resistor before the contancts in control of each motor?
 
@Hero: Where? Could you please illustrate that in the schematic, I can't quite seem to get what you mean... :)

@eric: Am I right in thinking that if I would connect the inputs of the AD623 to right before and right after my sensing resistor, it would amplify the voltage drop there, no matter in which direction the current is flowing? If so, I don't think I'll get a single polarity output signal, right?
 
Last edited:
I'd do it like this, if you want to sense on the negative side then it's possible but you need to rearrange the whole circuit,
 

Attachments

  • motor current sense.gif
    motor current sense.gif
    25.4 KB · Views: 889
But that way I would read 12V - Vr across a motor, and that's too much for the ADC of the Atmega.
 
Then swap the + and 0V terminals so the sense resistor is on the low side.
 
What? I just don't get it. Swapping + and GND wouldn't make a difference... The current can flow through the resistor in both directions, that's what the relays are for. If I would put the resistor right before GND, I could only sense the current when it flows through there, but it doesn't, when the relays change the polarity on the motors... Then the current would flow from +12V to every individual motor towards common GND (the left relay provides that).
 
I don't think you understand me.

Look at my modified version of your schematic:
motor-current-sense-gif.14940


Now swap the +V and 0V connections to it.

+V becomes 0V and 0V becomes +V, the voltage on the resistors will be directionally proportional to the current flowing through them.
 
Alright, now I think I understand what you mean. But that would still only allow me to sense the current for all motors (at least when they're running in in one certain direction), not for each individual motor.

Let's say two motors run forward (the first relay provides GND to the common wire, and two of the other relays provide +12Volts), then all the current would flow through the left relay, meaning I can only read the current drawn by both motors. If the motors run backwards (the left relay provides +12Volts, the other two provide GND), then I can read every individual current drain, but that's only 50% of the proper solution...

Please correct me if I still don't get it.
 
hi,
This is an option, ref attachment.
 
Last edited:
You once said that I could also build an instrumentation amp from simple OP Amps. How do I do that? Because the plain inst amps are fairly expensive, especially considering that I would need four of them...
 
Odysseas said:
You once said that I could also build an instrumentation amp from simple OP Amps. How do I do that? Because the plain inst amps are fairly expensive, especially considering that I would need four of them...

Hi,
Example, ref gif
 
Last edited:
The 6134 op-amps are kinda pricey, but the ones I have go rail-to-rail very nicely. It seems like you will need a rail-to-rail amp, as the input on one end of the resistor will be either 12V or 0V. So not using a r-r op-amp will possibly give you some offset from 0 or 12V. Some op-amps will give enough offset to really screw up the final output to the uC. They usually go for around $4 per package of dual amps. So they are not too bad. But Someone else may know of another r-r that is cheaper.

Is r-r needed here? Am I totally off?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top