low current measuring of a microcontroller

Discussion in 'General Electronics Chat' started by kia, Jul 13, 2010.

  1. kia

    Thread Starter New Member

    Jul 13, 2010
    4
    2
    hai everybody,

    My ambition is to measure the current, which is used for specified Instructions of low voltage microcontrollers. With this it would be possible to measure how much energy is need to for each instructions on on a microcontroller.

    The problem is that the measured current rang can be around 1nA - 100 mA and the the microcontroller has a voltage-rang of 0.9 -2.7V. Becaus it is a Microcontroller it can have a clock > 1Mhz.
    This means the OP'amp need a Input voltage rang of 0.9 - 3V,
    max. Input Voltage Offset of ca. 500µV and
    Input Offset Current of max. 500 pA.
    And a bandwide of > 1Mhz.

    I have found a few Currents Sense OP'Amp (MAX9914, LTC2050, LTC6079), which are in this rang, but i'm not sure how to design the circuit.

    Which methode is better High- or Low-Side-Current Sense or another?

    Actually I would prefer a IC's like LTC6102 or MAX9928 where you just need to dimension the Gain, but i didn't found any which are in the rang I mentioned. So do somebody know a IC's which have the right specifications?

    Thanks for the inputs.
     
  2. timrobbins

    Active Member

    Aug 29, 2009
    318
    16
    Is your current measuring 'instrument' an independant piece of equipment, or are you wanting to use the uP itself?

    The simplest situation would be to use a digital CRO to capture the 'current' waveform for the instruction sequence. However your uP will have local caps, so you will be only really able to insert a sense resistor (if that is your technique) in a filtered p/s feed, and so the signal will be a somewhat averaged waveform.

    Your sense resistor may also upset the operation of the uP if the voltage drop is too great, and so you will have a limited resolution on the FS signal level.

    Can you elaborate on what information you want to get out of the measurement.

    Ciao, Tim
     
    kia likes this.
  3. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    First, I think you need a smaller range for current measurement -- you say 100 mA but I think you really need 0.1 uA to 1 mA or 10 mA. See the attached picture for the MSP430F2231 supply current, as an example.

    Second, I think you need to build a potentiostat to measure the current while holding the voltage steady. This is so that you can use a high supply voltage (like 9V or 15V) and use a big current sense resistor. In other words, to measure 1 microAmp, you cannot be using a 0.1 Ohm sense resistor. So you need a feedback-controlled circuit with a higher value resistor for sensing. This is normal for testing purposes. Look up the circuit for a potentiostat on wikipedia.

    Third, I think you want to program the microcontroller to execute the instruction repeatedly. It would be extremely difficult -- maybe impossible -- to find the current required by a single instruction at even 1 MHz. Like previous person said, there will be a lot of capacitance and inductance in the supply that will prevent measuring current at that speed, and also the potentiostat feedback will not be fast enough.

    So, program the uC to execute the instruction 500 times, and then loop back and do 500 times again and again... then the instruction you want to learn about will be executed at 500:1 ratio with only a "jump" or "branch" instruction to loop back.

    Does this help you?

    By the way, what microcontroller, and what instructions?

    What is the purpose of this? I have the feeling that most microcontrollers use about the same power for most instructions, at any given speed and supply voltage, except maybe some special instructions or use of peripherals.
     
    kia likes this.
  4. kia

    Thread Starter New Member

    Jul 13, 2010
    4
    2
    Thanks for the replies,

    to Tim:
    I don't intend to use a uP to measure the current. It should be a independant equipment where i can connect the output to a Oscilloscop and the uP as load. (high-side-current-sense-circuite).

    to sage radachowsky:

    You are right I can't measure the whole rang from 1nA - 100mA with on sense resistor, I thought to change the sense resistor depending on rang to measure like 1nA-1uA, 1uA-1mA, 1mA - 10mA.

    I didn't thought about the capacitve and inductive problems or better I dont know exactly how it happens... Isn't there a countermethod against this problem?

    But your idea is good with the 500 times the same instruction and than repeat.

    The instrument is thought for any low voltage uP and for any instruction that's why the big rang 1nA - 100 mA.

    How about the Potentionstat... do I have to use a three electrod cell or is it possible to design it with OP'amp's, resistor and normal supply etc. ?

    Thank you very much for the replies.
     
    sage.radachowsky likes this.
  5. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Hi kia,

    Glad to help.

    I think that the link to Wikipedia for the Potentiostat was confusing, because that was more for electrochemistry. You need a potentiostat that provides a constant voltage power supply, and allows you to measure current accurately.

    Please see the attached schematic. I drew it up quickly.

    The op amp will hold the voltage that you set with Vset, for the uC supply. But it will do it by changing the voltage on the left side of the resistor, so that you will be able to sense the current by the voltage over the resistor.

    If you don't use this op amp and feedback, then you would be stuck with a very small resistor, and you would not get the correct voltage that you desire.

    Anyway, you can set "Vset" using a voltage divider or any other reference voltage.

    You can vary the size of the resistor for best measurement.

    Choose a good op amp that is unity gain stable, and works with the supply voltage. I think OPA277 is a good choice, but many others will work. Note that most op amps will supply around 30 mA. This should be good for your purpose for most microcontrollers.

    Hope this will help.

    Also note the bypass capacitors -- this is necessary so the op amp can respond quickly to changes in the load current.

    Sage
     
    kia likes this.
  6. kia

    Thread Starter New Member

    Jul 13, 2010
    4
    2
    Hi Sage,

    Great Post. I did a few static simulations with the circuit you posted. It really works very well.
    There is just on problem, if I come to the nA-range. It looks like the feedback takes also 5nA (see on attachmed). I don't why that happens, becaus I changed the Op'Amp input current Ibais to 1pA and also the the input current offset to 1pA.
    Have you got an idea How to reduce the feedback current?
     
    sage.radachowsky likes this.
  7. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Hi Kia,

    That is a great idea to run a simulation on the circuit. What simulator program are you using?

    Maybe others can answer this better than I can. It is true that the input bias current could affect the current measurements, when you're measuring nanoAmps. But if you use an op amp with very low input bias current of low pA, it should not be an issue to measure nA.

    Perhaps your simulation has a problem. Can you run a transient simulation and check if there is any oscillation? Maybe it's the op amp model not correctly setting the input bias current.


    Another topic:

    You may be testing some conditions where the uC is sleeping most of the time, and the current really is nA... then you may find you need to put a smaller resistor in parallel to the sense resistor, to start up the uC and provide enough current, and then when it's running in a loop with the condition you want to measure, then you may pull out the smaller resistor, and the larger resistor alone will provide the current, and allow good resolution.
     
    kia likes this.
  8. kia

    Thread Starter New Member

    Jul 13, 2010
    4
    2
    hallo saga,

    Sorry for the long wait. It took it time til the order compontes arrived...

    Anyway the Simulation Tool I used is called Tina 7.0. I made also a transient simulation but couldn't find any oscillation.

    So I build up the circuit as the simulation and did a few tests with MSP430F2013.
    When i mesured static current the circuit was well. Afterward used a Microcontroller with a radio which send signal. In this case could measure whith a Scope the change in current when the microcontroller is running and when the radio begins to transmit. The only Problem is the the whole signal was oscillating... So I put an capacitor parallel to the Sensresistor and the signal was ok.
    I think in this case I have to change the capacitor depending on the Senseresistor and the load capacity.
    Do you have an better idea then the parallel capacitor to reduce the oscillation?
     
  9. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Hello Kia,

    I didn't notice the response. This time I will subscribe to this thread to receive it by email.

    I think that probably your sense resistor was good for the static current of the microcontroller, but when it was to do a radio transmit, either the op amp feedback speed was too slow, or else perhaps it railed.

    What was the op amp supply voltage, the sense resistor value, and the expected current consumption of the microcontroller when it does a transmit?

    For cases like this, here are strategies:

    1) You must use different sense resistors for different ranges of current consumption. A high resistance is good for measuring in the low microamps. But for 20 mA you should probably use a 10 Ohm or so. Try to measure all the low-power stuff first. I usually use a 100 Ohm sense resistor for this. Then you can switch to a 10 Ohm resistor and measure things that take several mA.

    2) If you want to measure code that does some things at lower power levels, then must do some higher power stuff as well, then you can also use a diode from the voltage clamp's reference input (with a large cap from reference to ground) direct to the test circuit input to make sure that under heavier loads, the circuit will still make it through, without resetting. In other words, suppose you have a reference that provides 3.3V input as the set point for the potentiostat.... make sure you have also a large capacitor from there to ground to buffer pulse currents, and then you can use that through a diode for the "backup" power.

    3) Look for an op amp with fast slew rates if you are having trouble with the response speed of the potentiostat.

    4) You can place the capacitor in parallel with the sense resistor, but this will dilute the resolution of your picture of the power consumption through time on the scope. If you are looking for an *average* power, then this is the perfect idea, and you should use a large capacitor to smooth it out totally. I have sometimes used up to 1F capacitors for average power measurement.
     
    kia likes this.
  10. MMCP

    New Member

    Apr 14, 2011
    4
    0
    Hi,
    first thans a lot for all the informative threads above.

    I have the same problem, I'm trying to measure the current consumption of the MSP430 uP. the current range is 1uA...100mA. The circuit you suggested here returns very accurate results, for higher currents (10mA and higher) but not for currents in uA range :-(

    I went through all current shunt monitors from TI, simulated them with TINA and tried to even test couple of them physically but they return false values, when it comes to currents down to uA...

    Does any body have any suggestion what I can do to achieve my goal?

    Thanks
     
  11. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    With a very high value current sense resistor, one will run into problem even if the simulation works.

    Remember the voltmeter in all simulator has infinite impedance and will not load down the voltage. In practice, most DVM has an input impedance of 10MΩ or lower at mV range. This resistance will be in parallel with the current sensing resistor and the combined value must be taken into account in the calculation.

    [​IMG]
     
    Last edited: Apr 15, 2011
  12. MMCP

    New Member

    Apr 14, 2011
    4
    0
    Yes but in reality, the voltage across the shunt will be forwarded to the input of a current shunt monitor, and I don't need to take care about the impedance of the Voltmeter. Am I right or I misunderstood u?
     
  13. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    If you are going to use a "current shunt monitor" (some kind of buffer amplifier?) to drive the voltmeter, then it is the input impedance of that buffer which would need to be considered. Do you know its value?
     
  14. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Most modern op amps draw picoAmps of bias current, and some are available with femtoAmps input bias current...

    i think in the big picture, the ideal would be a system that selects the appropriate current-sense resistor to measure current levels.. probably microcontroller-based although it could be done in analog. you would have to think a lot about the time resolution of the current sensing, as well as little hiccups it would cause in the voltage of the supply to the circuit that you're monitoring.

    what is the circuit used by good digital multimeters for current sensing?
     
  15. MMCP

    New Member

    Apr 14, 2011
    4
    0
    Hi guys,

    I attached the circuit I though it may work for me. I simulated my uP as a voltage source + resistor, just to have a dynamic load for my simulation.
    The yellow quadrat would be my current sense monitor (TI INA213).

    When I simulated the circuit, without the current shunt monitor, I see that the current through the shunt is correct (1uA...3uA) BUT once i connect the current shunt monitor I get crazy values! Even with a big shunt (1k ohm) the values are still incorrect. For lower currents (1mA and higher) the measured voltage across the shunt is accurate.

    How can we explain this> Is there any way to fix it!

    Thanks!
     
  16. MMCP

    New Member

    Apr 14, 2011
    4
    0
    I don't really know :-(
    I'm doing transient simulations using TINA (PSICE based simulation, a free prog offered by Texas Instruments)... so I'm measuring the voltage drop across the shunt without even using a voltmeter.
    But later of course I will use a scilloscope to measure the voltages... BUT an then end I will add a ADc which converts the voltages to digital values and gives them to a uP to process them...
     
Loading...