Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Can the PSoC device be used to test the strength of a battery and display it using the LCD? I have looked everywhere for info on what I would need to create this project but to no avail. If there is, what user modules would be needed?

0 Likes
14 Replies
Anonymous
Not applicable
        Hi svn_34   
Of course, You can make Battery meter by using PSoC1, 3, 4, 5LP   
Because, "PSoC CAN, MCU CAN'T"   
What kind of battery? Voltage? Capacity?   
You would be use ADC module, PGA, LCD, DAC...   
All available in PSoC1   
0 Likes
Anonymous
Not applicable
        This may help, even if these are Battery Charger Applications.   
   
http://www.cypress.com/?rID=38367   
   
http://www.cypress.com/?rID=2865   
   
http://www.cypress.com/?rID=2736   
   
http://www.cypress.com/?id=4&rID=36425   
0 Likes
HeLi_263931
Honored Contributor II
        As a starting point: I did    something similar recently, even though it doesn't use the PSoC. But you can see the basic principle of how it works, and just need to replace it with PSoC modules (ADC and LCD are not that hard to handle...)   
Maybe I come around to build this with the PSoC too, should not be that hard...   
0 Likes
ETRO_SSN583
Esteemed Contributor

You need to specifiy what you are trying to accomplish, what the

   

test goals are.

   

 

   

Batteries cannot be tested just by looking at voltage, one needs to do load

   

test as well if you are trying to measure their remaining capacity, And that

   

is highly dependent on battery chemistry being evaluated, PbSOx, NiCd,

   

LiPo.......

   

 

   

Do you want to measure remaining capacity, amp hours remaining, by data

   

logging capacity usage ?

   

 

   

Then the forum can better assist you.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I want to design a battery tester that can test normal everyday use batteries such as AA, AAA, 9V, and a watch battery. I would like to indicate the remaining capacity in terms of percentage on the LCD display and have the bargraph on the LCD display to go up or down corresponding to the remaining capacity. Also, I wanted to have 3 external LEDs: 1 green, 1 yellow, and 1 red to also act as indicators. The green would indicate almost full capacity, yellow would indicate medium capacity, and red would indicate almost out.

   

Sorry I wasn't clear in my first post.

   

I want to know which user modules to use and what supplies I would need to actually read in the battery. Also if there are any helpful references out there that I can use.

   

Thanks.

0 Likes
ETRO_SSN583
Esteemed Contributor

I want to design a battery tester that can test normal everyday use batteries such as AA, AAA, 9V, and a watch battery. I would like to indicate the remaining capacity in terms of percentage on the LCD display and have the bargraph on the LCD display to go up or down corresponding to the remaining capacity. Also, I wanted to have 3 external LEDs: 1 green, 1 yellow, and 1 red to also act as indicators. The green would indicate almost full capacity, yellow would indicate medium capacity, and red would indicate almost out.

   

Sorry I wasn't clear in my first post.

   

I want to know which user modules to use and what supplies I would need to actually read in the battery. Also if there are any helpful references out there that I can use.

   

Thanks.

   

 

   

There is on starting page of PSOC Designer a number of examples projects you can open using various

   

modules, and to copy code from. This is under " Design Catalog".There is an ap note attached to each as

   

well that explains the project. Easy way is to open two sessions of Designer, one your project, the other

   

example projects, and cut and paste example into your project. Open windows side by side.

   

 

   

The modules you most likely will use are -

   

 

   

1)  EzADC

   

2) AMUX4/8 if you have more than one voltage to measure

   

3) LED

   

4) LCD

   

 

   

For your LEDs you could always use a single RGB led and control its color mixing.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Would you know of any specific functions I would need in my main.c or specific libraries?

0 Likes
ETRO_SSN583
Esteemed Contributor

Each module has a datasheet, and the f()'s description in them.

   

 

   

So for ADC, a start f(), a read f(), and a busy f(), to hold up reading until done.

   

The AMUX4 a start f(), and a channel select f(). The LED a start f(), and a

   

f() to tunr it on or off.

   

 

   

LCD has a start f(), and several prining functions.

   

 

   

Again, the example projects show what f()'s are normally used and what they do.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Okay so I know what all those UMs do but what function would I need or how would I get PSoC to read in a battery continuously?( Also, what would I use to actually read in the battery? Two wires from a port pin?

0 Likes
Bob_Marlowe
Expert II

Well, what do you expect to get when you "read" a battery?

   

 

   

Bob

0 Likes
ETRO_SSN583
Esteemed Contributor

The battery connection would be negative terminal to ground,

   

positive to a pin that is used as an input to mux, the mux output to

   

ADC. Then, for the A/D version you decide to use, in its datasheet

   

is example code to read tyhe ADC, which is reading the battery.

   

 

   

If battery > Vdd of PSOC, you will need to use a voltage divider so that

   

the worst case max Vin meets the allowed range for the ADC you choose.

   

 

   

Again there are example projects for the ADC, or the example code in the

   

UM datasheet, great help.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

Summary -

   

 

   

1) Start AMUX, A/D, LCD

   

2) Clear LCD

   

3) Write label to LCD by function to position cursor, then write label string

   

4) Select channel (which is pin you want to measure)

   

5) Loop while A/D busy flag is busy

   

6) Read ADC

   

7) Convert ADC reading to volts

   

😎 Convert volts reading to a string, using itoa() or ltoa() or sprinf()

   

9) Position cursor on LCD

   

10) Write string to LCD

   

11) Goto 4 above for next channel

   

 

   

All these f()'s are in UM datasheet and compiler manual

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Okay, so I have gotten the PSoC to read voltages but for some reason when I read in the battery it doesn't display the correct voltage value. I designed a voltage divider that divides that voltage by 3 so that a 9 V battery could be tested. I tested a new AAA battery with a Voltmeter and it is about 1.5 V but when I tested it in PSoC without the voltage divider it displayed 2.4 V. The voltage should have been 4.5 V because the code I wrote multiplies the displayed voltage by 3 to account for the voltage divider. Do you know what my problem is here?

0 Likes
ETRO_SSN583
Esteemed Contributor

Depends on what reference you are using and signed or unsigned result

   

from A/D.

   

 

   

Example, if ref is Vdd/2 +/- Vdd2, and result is signed, 12 bit, then result from

   

A/D ranges from -2048 - 0 - +2047. So you basically -

   

 

   

Vx = 2.5 + ( 2.5 * Natod ) / 2048

   

 

   

Regards, Dana.

0 Likes