1 2 Previous Next 17 Replies Latest reply on May 12, 2016 9:57 PM by user_1377889

    analog to digital converter

    alkh5869_1498161

      Hi there

         

      I am using CY8CKIT-042-BLE I want to convert an analog input to digital but I could not find the right component to do so. so my question is there a pin in the kit that take an analog and digital at the same time and I do not need to do any convert or is there a component that I should use to do so.

         

      the idea of the program I am trying to build is to count pulses. a copy of the file has been attached here 

         

      thanks 

         

       

         

      Ali

        • 1. Re: analog to digital converter
          user_1377889

          Welcome in the forum!

             

          You started to use an AD-Converter, what you need is an Analog input pin. Take one from the components, place it left to the ADC and wire (connect) it to the ADC. After building the project a physical pin will have been assigned.

             

           

             

          Bob

          • 2. Re: analog to digital converter
            alkh5869_1498161

            so I got my program to work 

               

            now I want to connect the cypress Bluetooth with a mobile app from app inventor. however I was not able to make the Bluetooth to connect or even to appear in the phone. I check my phone app and is working just fine. but still struggle with turning cypress bluetooth ON. Can you help me with that. I attached my file 

            • 3. Re: analog to digital converter
              user_1377889

              But you are aware that you are here in the PSoC3 forum and not in the PSoC4 BLE. Does your mobile devise support BLE which is something like an extension to standard Bluetooth?

                 

               

                 

              Bob

              • 4. Re: analog to digital converter
                luantdoan_1606826

                I'm working on PSoC 3 design to read voltage rails and display them on the UART Console terminal. I wired up a voltage divider network on the breadboard of the CY8CKIT-001 to have 5.0V, 3.3V, 2.5V, 1.6V, and 0.8V rails. The design consist of analog voltage rails connecting to an AMux which connected to ADC_DelSig single ended. The voltage reading from ADC all rails except 3.3V seem reasonable. The voltage read back for 3.3V is 4.3xxV and I don't really know how to correct this. Below is the ouput displayed on the UART Console:

                   

                Reading Voltage Rails. Please wait...
                P5P0V_Rail: 5025 mV (adc count = 65874)
                P3P3V_Rail: 4349 mV (adc count = 57011)
                P2P5V_Rail: 2657 mV (adc count = 69668)
                P1P6V_Rail: 1666 mV (adc count = 53328)
                P0P8V_Rail:  839 mV (adc count = 53710)

                   

                I am attached my design here for reference. Please help!

                   

                Thanks,

                   

                Luan

                • 5. Re: analog to digital converter
                  user_78878863

                  Are you sure your voltage dividers are correct? And that your calculation of the voltages matches the divider? When all other voltages are OK, there doesn't seem to be a general mistake.

                  • 6. Re: analog to digital converter
                    user_1377889

                    At first sight and looking into your project I would assume you picked the wrong signal from the resistor ladder: the 4.17V instead of the 3.3V. Please triple-check and test by using a multimeter.

                       

                    Bob

                    • 7. Re: analog to digital converter
                      luantdoan_1606826

                      Hi hli, these voltage readings have been verified with a DVM. I measured at the port pin headers on the CY8CKIT-001 Development board.

                      • 8. Re: analog to digital converter
                        luantdoan_1606826

                        Hi Bob, Yes I checked with DVM multiple time by measure at the correct pin of port pin header on CY8CKIT-001. I also connect a wire to the same 3.3V on the bread board, measure and verify 3.3V at the other end of the wire before plug it into different port pin (P2[7]), then add this to a new channel of AMux, complile, program and run again thru Debug and the reading value is the same:

                           

                        Reading Voltage Rails. Please wait...
                        P5P0V_Rail: 5026 mV (adc count = 65881)
                        P3P3V_Rail: 4350 mV (adc count = 57025)
                        P2P5V_Rail: 2657 mV (adc count = 69668)
                        P1P6V_Rail: 1667 mV (adc count = 53347)
                        P0P8V_Rail:  839 mV (adc count = 53733)
                        P3P3V2_Rail: 4351 mV (adc count = 57031)

                        • 9. Re: analog to digital converter
                          user_1377889

                          I question: How to get a count of 69668 out of a 16-bit result?

                             

                          As you can see from the picture in ADC configuration Rail-to-Rail cannot measure 5V, disable the input Buffer for Configuration 1

                             

                           

                             

                          Bob

                          • 10. Re: analog to digital converter
                            luantdoan_1606826

                            The adc count returned by ADC_DelSig_GetResult32() is even higher when I set Buffer Mode to "Bypass Buffer":

                               

                            Reading Voltage Rails. Please wait...
                            P5P0V_Rail: 5544 mV (adc count = 72672)
                            P3P3V_Rail: 4253 mV (adc count = 55750)
                            P2P5V_Rail: 2657 mV (adc count = 69668)
                            P1P6V_Rail: 1666 mV (adc count = 53336)
                            P0P8V_Rail:  839 mV (adc count = 53707)
                            P3P3V2_Rail: 4253 mV (adc count = 55751)

                            • 11. Re: analog to digital converter
                              luantdoan_1606826

                              Hi Bob, my question is why do I need to use different Configuration for each of these voltage rails? I should be able to use CFG1 with Input Range set to "Vssa to Vdda" which is from GND to 5V to get ADC conversion count for each 5V, 3.3V, 2.5V, 1.6V, and 0.8V rail. But it doesn't seem to work this way. The setting for Reference can only be set to "Internal Vdda/4" since I don't have h/w setup for "Internal Vdda/4 Bypassed on P0.3" or "Internal Vdda/4 Bypassed on P3.2". What else can I set to make CFG1 handle all voltage level correctly between Vssa and Vdda (0 to 5V) ?

                                 

                              Thanks,

                                 

                              Luan

                              • 12. Re: analog to digital converter
                                user_1377889

                                ADC_DelSig_GetResult32() is even higher when I set Buffer Mode to "Bypass Buffer": That is what I expected to happen.

                                   

                                Next I would suggest you to change your ADC Start-Wait-Stop-GetResult to a single ADC_Read32() call. See ADC datasheet..

                                   

                                 

                                   

                                Bob

                                • 13. Re: analog to digital converter
                                  luantdoan_1606826

                                  I tried ADC_DelSig_Read32() call and still have the same results!

                                  • 14. Re: analog to digital converter
                                    luantdoan_1606826

                                    Hi Bob,

                                       

                                    I see the value of global variable ADC_DelSig_CountsPerVolt is set to 13107. This is expected for CFG 1 which has Input Range = "Vssa to Vdda", Buffer Gain = 1, Buffer Mode = "Rail to Rail", Reference = "Internal Vdda/4" (Vref = 1.250 Read Only). This count value is correct for a full ADC 16bit resolution in single ended mode. Based on this info, my expected ADC count for 5V, 3.3V, 2.5V, 1.6V, and 0.8V would be about: 65536, 43254, 32768, 20972, and 10486. But I got these instead: 65880, 56986, 42823, 28589, and 14307. I am okay with the adc count of the 5V (knowing it's at saturated range) but why adc count for others rails are so way off?

                                       

                                    Any tips to compensate for these will be appreciated!

                                       

                                    Thanks,

                                       

                                    Luan

                                    1 2 Previous Next