14 Replies Latest reply on Nov 15, 2013 3:09 PM by user_14586677

    Battery tester project

    steven.nguyen

      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?

        • 1. Re: Battery tester project
          junichi.hiraoka
                  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   
          • 2. Re: Battery tester project
            junichi.hiraoka
                    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   
            • 3. Re: Battery tester project
              user_78878863
                      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...   
              • 4. Re: Battery tester project
                user_14586677

                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.

                • 5. Re: Battery tester project
                  steven.nguyen

                  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.

                  • 6. Re: Battery tester project
                    user_14586677

                    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.

                    • 7. Re: Battery tester project
                      steven.nguyen

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

                      • 8. Re: Battery tester project
                        user_14586677

                        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.

                        • 9. Re: Battery tester project
                          steven.nguyen

                          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?

                          • 10. Re: Battery tester project
                            user_1377889

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

                               

                             

                               

                            Bob

                            • 11. Re: Battery tester project
                              user_14586677

                              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.

                              • 12. Re: Battery tester project
                                user_14586677

                                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

                                   

                                8) 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.

                                • 13. Re: Battery tester project
                                  steven.nguyen

                                  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?

                                  • 14. Re: Battery tester project
                                    user_14586677

                                    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.