1 2 3 Previous Next 43 Replies Latest reply on Apr 28, 2012 2:37 PM by udayanu_

    integrating accelerometer with Psoc development kit

      hi all,

      i am relatively new to Psoc development pardon my ignorance.
      i am currently working on integrating accelerometer with the development kit.

      i found an article on

      after consulting an expert, he noted to me that the application note i had referred is for connecting an Accelerometer to PSoC1 devices which have SAR and ADCINC incremental ADCs. PSoC3 does not have a SAR8 user module. Instead i can use the ideas proposed in the application note but substitute the ADC with the Deltasigma ADC from PSoC.

      my doubts was the figure 3 of the block diagram of accelerometer with PSoC. the control software block does it co response to PSoC3's control register? same goes to the I2C block can it be replace by the component using the PSoC creator IDE?
      as there is not a direct info on how i can edit the value of the blocks, i hope to get some kind expertise's advice on how about i can cont to work on this article.

      any help will be greatly appreciated.

        • 1. Re: integrating accelerometer with Psoc development kit

          I think you need an example on using the ADC on PSoC 3. There are a few around that you can run on the development board...

          Simple ADC Example - http://www.cypress.com/?rID=38629

          ADC Channel Scan with Software - http://www.cypress.com/?rID=38799

          Also, although I do not think you have the hardware, you could look at the projects that come with the FirstTouch kit. That kit has a Kionix accelerometer on-board and several of the kit examples use it extensively.

          CY8CKIT-003 PSoC® 3 FirstTouchtm Starter Kit - http://www.cypress.com/?rID=38235

          -- mgs

          • 2. Re: integrating accelerometer with Psoc development kit

            Hi yfs,

            thanks for the information.
            i did notice that PSoC 3 FirstTouch Starter Kit has an accelerometer on it, however i had already bought the PSoC development kit, thus have no choice but to use the kit.

            i am having quite a problem as i do not understand the differences in of the two.
            is there some reference i can look into to so call "convert" the methodology use in the article (http://www.cypress.com/?docID=19786) to used in the PSoC creator and PSoC development kit?


            • 3. Re: integrating accelerometer with Psoc development kit
                      Here is an example project that runs on the first touch kit that measures the X axis from the accelerometer. You can easily modify the project to scan all the X, Y and Z axes.   
              • 4. Re: integrating accelerometer with Psoc development kit
                        Hi Ganesh,   
                is really nice of you to post this example project.   
                is there any documentation of this project i can refer to?   
                however it is using the on board accelerometer of first touch kit, which for me i may need to purchase a separate accelerometer and mount onto the breadboard of PSoC development kit?   
                by the way, i am still quite stuck to the article on my first post, as is really had to "convert" over to PsoC creator software.   
                furthermore i have been trying to tes out the ADC to LCD sample project that comes with the Creator software, it seems that my component bar is giving me problem,previous i could not find "ports and pins folder" thus i went to give an update to Creator 1.0.4beta, but certain components are gone again from the list after the update. i clearly remember the previous list was 84 components, now left with 64. now i am able to find "ports and pins folder" but the "digital port" under "system" is no longer there.   
                please advise.   
                thanks in advance for the help..   
                • 5. Re: integrating accelerometer with Psoc development kit
                          Yes. You will have to get an accelerometer, assemble it on a SMD to DIP convertor or General Purpose PCB and fix it to the bred board area of the CY8CKIT-001. Also, the Application note is for PSoC1 family and hence cannot be directly ported to PSoC3. Instead, you will have to take the concept and use the components available in PSoC3 to create the project.   
                  You can find the documentation for the attached project in the PSoC First Touch user guide available from the below link.   
                  There have been some upgrades to components in the latest version of PSoC Creator. The digital port component is now replaced by the Digital Output Pin and Digital Input pin components. Also, you can view older components by enabling the "Show Hidden Components" option in the Tools >> Options menu, Design Entry >> Component Catalog option.   
                  • 6. Re: integrating accelerometer with Psoc development kit
                            Just wanted to confirm that Ganesh is right about nothing going away. We just hid the ports component because Pins are more flexible and what we will be maintaining going forward. I strongly recommend moving to Pins and apologize that you got a little caught by our "beta" status!   
                    The board you have is much more flexible that the FirstTouch kit. One option you have is to get a Kionix SC-7 eval board and plug it straight into the DVK bread board area. All you then to do is wire up the digital control lines and analog accelerometer input to the PSoC pins. Then take the FirstTouch examples (which use the Kionix part), move the pins to the ones you have chosen, and rebuild.   
                    -- mgs   
                    • 7. Re: integrating accelerometer with Psoc development kit
                              thanks ganesh and yfs for the great info.   
                      i am purchasing a similar accelerometer(    http://sgbotic.com/index.php?t...ts&product_id=440) to integrate on the PSoC development board.   
                      Pardon my ignorance of the software knowledge, i was wondering from the concept of the article and the bubblelevel example,   
                      1)since now the accelerometer i am using is 3axis should i follow the concept of the article, by using a mux? or sholud i use 3 individual ADC to read from each x,y and z?   
                      as the x,y,z value from the accelerometer will be available for the ADC to read at the same time.   
                      this lead to next question   
                      2) if i was to use a mUX,there is two mux available in the creator software, i was thinking of using the AMUXSeq, as i need to differential x,y and z value.   
                      is this a better choice out of the two?   
                      3) since PSoC development board had its own LCD, from the article, i can remove the concept of I2C to display on the external device right?   
                      however can the LCD display simultaneously 3 values by writing at the appropriate position of the LCD(ie i send to print string of x,y and z value at different position of the LCD)?   
                      as the LCD is only one port, can it take in 3 functions to write at the same time?   
                      or should i set the values of x,y,z in some buffer and display at one time?   
                      4)can i also remove the concept of the control unit in the article?   
                      as i will always on the accelerometer.   
                      any help will be greatly appreciated.   
                      thanks alot.   
                      • 8. Re: integrating accelerometer with Psoc development kit

                        You can have only one ADC in PSoC3. You will have to use a mux to multiplex the X,Y and Z axes. The following example project (as yfs pointed out) shows how to measure multiple ADC inputs.

                        ADC Channel Scan with Software - http://www.cypress.com/?rID=38799

                        You can use the LCD_Position function to place the LCD cursor at any location and print the string you desire. You can convert the hex value from the ADC to decimal using the sprintf function and store the ascii string to a char array. Then use the LCD_PrintString function to print the ascii value at the desired location. You could set LCD Position to (0,0) and print X, (0,8) and print Y and (1,0) and print Z.

                        I have shown the code to print the decimal value using sprintf and LCD_PrintString in my below video.


                        • 9. Re: integrating accelerometer with Psoc development kit
                                  Hi Ganesh,   
                          thanks for the wonderful piece of reference.   
                          i will test it out and share the result with all.   
                          • 10. Re: integrating accelerometer with Psoc development kit

                            Hi all,
                            i tested with the adxl335 accelerometer.

                            i make use of the example program which ganesh had provided for me.
                            i remove the two VDC8 module and replace them with analog pins.
                            i remove the 2 switches modules.

                            i edited the codes as i do not required the 2 switch interrupts.
                            i set channel 1 as P0_1, channel 2 as P0_2 and channel 3 as P0_3.
                            i connected my accelerometer at the respective x,y,z to P0_3,P02,P0_1.
                            i connect all the ground together inclusive of the accelerometer's ground, in order to make a common ground.
                            i set the VCC of the accelerometer to connect to the development's board's 3.3V pin.

                            however, there is no value being display on the LCD.
                            it display all 00 for the value of x,y and z.

                            uint8 iAdcValue[3];     
                            void main()     
                            uint8 iChannel=0;     
                            LCD_PrintString("Z Y X");     
                            any advise will be greatly appreciated.     
                            thanks in advance.    

                            • 11. Re: integrating accelerometer with Psoc development kit

                              The example project reads the ADC result and changes the channel inside the ADC's ISR (see ADC_Delsig_1_IRQ.c file, ADC_DelSig_1_IRQ_Interrupt function.

                              In your project, you are not enabling the ADC interrupt and there is no code to change the channels or read the results in the foreground process. So, the result will always be zero. Do the following:

                              1. Remove the StartConvert function call from the for(; loop.
                              2. Enable the ADC ISR
                              3. Make sure that the code to stop ADC, read ADC result, change channel and StartConvert is inside the ADC's ISR.
                              4. When the channel switching is done inside the ADC's ISR, you need to only update the LCD display in the for(; loop.

                              My suggestion would be use the ADC channel scan project as it is and only remove the DACs and connect the analog pins to the Mux. You can also remove the code that starts the DACs and isr_1 and isr_2 in main.c.

                              • 12. Re: integrating accelerometer with Psoc development kit
                                        Hi ganesh, it works.   
                                really thanks for the all help and information.   
                                what i did was to follow your instructions, remove the DACs and connect the analog pins to the Mux and also remove the code that starts the DACs and isr_1 and isr_2 in main.c.   
                                and it works perfectly.   
                                thanks alot.   
                                • 13. Re: integrating accelerometer with Psoc development kit
                                          Hi ganesh, i was reading through the codes of the ADC scanning project.   
                                  thus i was trying to reverse engineer it as i like to learn how is it coded to scan through the ports of the MUX.   
                                  however i realize that only after i built the project then the ADC_DelSig_1_INT.c plus the rest of the files are created. is that the way to generate the files?   
                                  can i say that the files which i need to pay attention to beside the main.c,   
                                  ADC_DelSig_1_INT.c ==> as ADC_DelSig_1.c and ADC_DelSig_1.h are normal generated module files   
                                  ADC_DelSig_1_IRQ.c ==> as ADC_DelSig_1_IRQ.h is normal generated module files   
                                  is these the files which are modified to read in proper scanning of the mux?   
                                  once again thanks in advance for any help.   
                                  • 14. Re: integrating accelerometer with Psoc development kit
                                            Yes. The library files for the components are generated by the Creator. You will have to first do a build to get these files generated. Write your interrupt code in between the "#START..." and "#END" lines inside the ADC_Delsig_1_IRQ_Interrupt function in the ADC_Delsig_1_IRQ.c file. During successive builds, when the library files are generated, the code that you write within the "START" and "END" markers will be preserved.   
                                    1 2 3 Previous Next