analog to digital converter

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

View solution in original post

0 Likes
17 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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.

0 Likes
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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)

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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)

0 Likes
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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

0 Likes
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I would suggest you to create a support case to get an answer from a Cypress engineer.

   

At top of this page select "Design Support -> Create a Support Case" and describe your problem.

   


Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Bob,

   

I did open a case but found a solution from a Cypress Knowledge Base Article:

   

ADC Errors and Techniques to Compensate these Errors:

   

Gain Calibration: To compensate for gain error, apply a known voltage to the ADC.  Measure the ADC counts.  Calculate the ratio of Input Voltage / ADC Counts.  Store this value as the scale factor.  During normal measurement, multiply the ADC Counts by the scale factor to get the gain compensated value.

   

What I did is to get an adc count of known good 3.3V rail and calculate for the ratio of this Input Voltage/ADC Count and use this as the scaling factor to compute for mV from the ADC Count. I don't want to deal with floating point hence these:

   

scale = (3300mV / adc_cnt) * 1000

   

mV read = (adc_cnt * scale) / 1000

   

The scale factor for my case is 58

   

This scale factor works for all the voltage rails:

   

Reading Voltage Rails. Please wait...
P5P0V_Rail: 5026 mV (adc count = 65880)
P3P3V_Rail: 3305 mV (adc count = 56994)
P2P5V_Rail: 2483 mV (adc count = 42825)
P1P6V_Rail: 1658 mV (adc count = 28594)
P0P8V_Rail:  830 mV (adc count = 14311)
PS_VR_Rail: 1008 mV (adc count = 17380)

   

I am posting my project file here for reference just in case anyone get into this same issue.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I knew about that method, but I found the discrepancy in your case unusually large.

   

 

   

Bob

0 Likes