Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers

Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th October 2007, 02:31 PM
Experienced Member
Odysseas is on a distinguished road
 
 

Default Read current (voltage drop across resistor) in two directions

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?
Attached Images
File Type: gif motor wiring.gif (14.3 KB, 23 views)
__________________
Seize the time, and seize it now!
Odysseas is offline   Reply With Quote
Old 14th October 2007, 02:48 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

is it important that you know the direction of current flow?


http://www.edn.com/archives/1996/031496/06di1.htm

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.
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 14th October 2007, 04:19 PM
Experienced Member
eblc1388 is just really niceeblc1388 is just really niceeblc1388 is just really nice
 
 
Default

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.

bidirectional high-side current monitor
Attached Images
File Type: gif highside.gif (5.5 KB, 8 views)
__________________
L.Chung
eblc1388 is offline   Reply With Quote
Old 14th October 2007, 04:29 PM
Experienced Member
Odysseas is on a distinguished road
 
 
Default

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
__________________
Seize the time, and seize it now!
Odysseas is offline   Reply With Quote
Old 14th October 2007, 04:39 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

Why can't you just put the current sense before the change over relay?
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 14th October 2007, 04:55 PM
Experienced Member
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
 
 
Default

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
Attached Images
File Type: gif mtradc1.gif (12.9 KB, 13 views)
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/
ericgibbs is online now   Reply With Quote
Old 14th October 2007, 05:04 PM
Experienced Member
Odysseas is on a distinguished road
 
 
Default

@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.
__________________
Seize the time, and seize it now!
Odysseas is offline   Reply With Quote
Old 14th October 2007, 05:11 PM
Experienced Member
ericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to beholdericgibbs is a splendid one to behold
 
 
Default

Quote:
Originally Posted by Odysseas
@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.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Nigel's site: http://www.winpicprog.co.uk/
Gramo's site: http://www.digital-diy.net/

Last edited by ericgibbs : 14th October 2007 at 05:22 PM.
ericgibbs is online now   Reply With Quote
Old 14th October 2007, 05:19 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

Quote:
Originally Posted by Odysseas
@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?
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 14th October 2007, 05:33 PM
Experienced Member
Odysseas is on a distinguished road
 
 
Default

@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?
__________________
Seize the time, and seize it now!

Last edited by Odysseas : 14th October 2007 at 06:18 PM.
Odysseas is offline   Reply With Quote
Old 14th October 2007, 07:09 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

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,
Attached Images
File Type: gif motor current sense.gif (25.4 KB, 86 views)
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 14th October 2007, 07:25 PM
Experienced Member
Odysseas is on a distinguished road
 
 
Default

But that way I would read 12V - Vr across a motor, and that's too much for the ADC of the Atmega.
__________________
Seize the time, and seize it now!
Odysseas is offline   Reply With Quote
Old 14th October 2007, 07:41 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

Then swap the + and 0V terminals so the sense resistor is on the low side.
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 14th October 2007, 08:04 PM
Experienced Member
Odysseas is on a distinguished road
 
 
Default

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).
__________________
Seize the time, and seize it now!
Odysseas is offline   Reply With Quote
Old 14th October 2007, 09:42 PM
Experienced Member
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
 
 
Default

I don't think you understand me.

Look at my modified version of your schematic:


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.
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Latest
Stabilised Power Supply with Current Limiting mechie Electronic Projects 36 11th March 2008 07:16 PM
Battery Charger with auto shut-off feature hardcore misery Electronic Projects Design/Ideas/Reviews 134 12th February 2008 08:20 PM
Voltage ElectroMaster Electronic Theory 44 8th August 2007 05:35 PM
Need some help with a code provided by ATMEL ikalogic Micro Controllers 1 23rd January 2007 02:46 PM
imulate a small Voltage Drop Out with MOSFET vs. parasitic capacitances dirkdiggler2oo2 Electronic Projects Design/Ideas/Reviews 6 22nd December 2006 02:30 PM


All times are GMT. The time now is 01:53 PM.




Electronic Circuits  |  Radio Controlled
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0