How to measure the current ?

A catchall for PSoC Mixed-Signal Array (microcontroller) discussions not captured by the other forums.

Moderator: ericb

How to measure the current ?

Postby duongimi on Thu Feb 22, 2007 8:19 pm

I want to measure the current that Psoc consumes.
I use a cicuit as the picture. The result equals value on Voltmeter divided by 0,3.

I dont know my method is right.
Everyone help me.
Attachments
xxxx.GIF
xxxx.GIF (3.4 KiB) Viewed 2930 times
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Thu Feb 22, 2007 8:53 pm

Yes. This method should work. Also, all the multimeters have a current measurement mode in which the shunt resistor will be inside the multimeter and the measurements would be more accurate. You could use this mode to measure the current as well.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby graaja on Thu Feb 22, 2007 9:21 pm

Yes. This method should work. Also, all the multimeters have a current measurement mode in which the shunt resistor will be inside the multimeter and the measurements would be more accurate.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby duongimi on Thu Feb 22, 2007 9:27 pm

However, when I apply this method to measure the current that Psoc consume between two modes: normal and Sleep. I found that there is no much difference.
I dont know why ?
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Thu Feb 22, 2007 10:15 pm

This means that the PSoC is not going into Sleep. Check if you have enabled any interrupts and the resources generating that interrupt are running when putting the PSoC sleep. You need to stop all the resources that generate interrupt before putting the psoc to sleep.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby duongimi on Fri Feb 23, 2007 12:05 am

I make a simple project to test as following:
Attachments
Duong.rar
(234.48 KiB) Downloaded 266 times
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby Jerson on Fri Feb 23, 2007 9:11 am

Duongimi

In the SleepTimer_ISR, you are decrementing CPU_Sleep. If it underflows, it will go to 0xFF and will take n times longer. You are not checking the 0 condition in the ISR.

Your code should be something like this in the ISR

Code: Select all
     if (CPU_Sleep != 0)  CPU_Sleep = CPU_Sleep-1
Or in asm
     tst [CPU_Sleep],0
     jz  NoDec
     dec [CPU_Sleep]
NoDec:



Another thing, I am not sure if you need the following code
Code: Select all
  and   F,~01h
  or    F,01h               
  and   reg[CPU_SCR0],F7h              ; Set Bit Sleep in reg[CPU_SCR0]
  or    reg[CPU_SCR0],08h
 

I am not sure, since you seem to be using a PSoC Designer version thats very old 4.16.

Otherwise, the M8C_Sleep function should be sufficient.

Jerson
PSoC/8051/PIC/ARM/MSP430 - Embedded Systems Design
http://jerson.co.in
User avatar
Jerson
The Big Cheese
The Big Cheese
 
Posts: 367
Joined: Fri Jan 28, 2005 10:11 pm
Location: Bombay, India

Postby duongimi on Sun Feb 25, 2007 6:21 pm

I use PSoC Designer version 4.3.
I have tried to "tst" instruction but it doesnt work, so I write in ISR
Code: Select all
 cmp [CPU_sleep],0
     jz  NoDec
     dec [CPU_sleep]
NoDec:   


I use a meter with name"HIOKI", current range include: 40uA, uA, mA, 10A.
the current that I measure is 95mA in normal mode and 85mA in sleep mode.[/code]
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Sun Feb 25, 2007 6:30 pm

duongimi wrote:I measure is 95mA in normal mode and 85mA in sleep mode.


That is very high for a psoc consumption. I am sure there is some mistake somewhere. I think you are measuring the complete board current. You should measure the current on the path that feeds only to Vdd of PSoC. My guess is that other components in the board consume about 85mA and PSoC consumes 10mA in active mode and a few microamps in sleep mode.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby duongimi on Sun Feb 25, 2007 6:53 pm

I only use a board include components as following diagram
LCD is HD44780 (20x4)
Attachments
diagram.GIF
diagram.GIF (2.92 KiB) Viewed 2830 times
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Sun Feb 25, 2007 8:10 pm

The supply to LCD may be branching after the ammeter. Check it out again. 85mA is too much a current for a PSoC with the setup you have described.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby duongimi on Sun Feb 25, 2007 8:20 pm

Now, I use a board that has only a PSoC Chip and a empty project. I measure the current is 12,8mA. When I add "M8C_Sleep" instruction into program, the current is 0,5mA.
I dont know why.
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Sun Feb 25, 2007 8:24 pm

That is better. Now you have a sleep current of 500uA. By performing some other operations, you can get a sleep current of a few microamps.

1. Switch off the complete reference section by writing to ARF_CR register
2. Switch off any analog buffers if enabled
3. Make all the pins HighZ Analog before putting PSoC to sleep
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby duongimi on Sun Feb 25, 2007 9:00 pm

Thank you very much !
When I add "mov Reg[ARF_CR],00h" before M8C_Sleep, the current I measure is 4,2uA.
I will modify my previous project to get a lowest current.
User avatar
duongimi
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Sun Nov 26, 2006 6:02 pm
Location: Vietnam

Postby graaja on Sun Feb 25, 2007 9:05 pm

That is great. Glad to hear that you have been successful in reducing the sleep current.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby cpeirs on Wed Jan 30, 2008 1:24 am

graaja wrote:2. Switch off any analog buffers if enabled
3. Make all the pins HighZ Analog before putting PSoC to sleep


Hi,

I would like to pick up this thread as I am experimenting with reducing power consumption.

these are the steps I all ready use:
1. power delivery to all other power consuming IC's on the board is controlled from the PSoC using transistors and LED UM, so i only "turn them on" when I need them
2. I perform a sleep cycle of 1s
3. I switch off power to analog blocks before going into sleep (and switching it back on in my interrupt routines)

now I would like to try the other two things Ganesh suggests, and have some questions about it:

I presume that number 3 (make pins HighZ) can be controlled using the PRTxDMx registers?

Which registers do I have to manipulate to switch off my analog buffers? how can I be sure if I need these buffers anyway?
kind regards,
Christopher Peirs
User avatar
cpeirs
Cheese Wheel
Cheese Wheel
 
Posts: 107
Joined: Fri Nov 09, 2007 5:25 am
Location: De Panne - Belgium

Postby graaja on Wed Jan 30, 2008 7:59 am

Hi Christopher,

The drive mode of the pins have to be modified by using the PRTxDMx registers. The analog buffers may be controlled by the ABF_CR register.

As you are controlling power to other circuits using PSoC, make sure that making these pins HighZ does not create any undefined state for the power to these other circuits. If there is a possibility of this happening, then leave these control pins as they are and make other pins HighZ.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby cpeirs on Wed Jan 30, 2008 8:19 am

Hi Ganesh

Thanx for the info and for the tip about driving the other circuits with HighZ pins, I will surely check this!
kind regards,
Christopher Peirs
User avatar
cpeirs
Cheese Wheel
Cheese Wheel
 
Posts: 107
Joined: Fri Nov 09, 2007 5:25 am
Location: De Panne - Belgium


Return to PSoC1 General

Who is online

Users browsing this forum: No registered users and 0 guests