ADC problem

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

cross mob
Anonymous
Not applicable

 Hi to all,

   

              I am  doing work on blood glucose measurement with PSoC 3 , in that a current from test strip taken and converted to voltage and calibration if that interms of glucose.but as a sample i am giving current from IDAC component that is converted to voltage. this voltage i am giving to ADC to display it in volts , here upto PGA i am getting voltage but after giving to ADC i am getting Garbage value output on LCD.i think the problem here is with ADC ,can anyone help me regarding this.

   

thanks

   

PRP

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

To make sure it really is an ADC problem, some debug ideas:

   
        
  • debug your code to see what you get as a result from the ADC (your LCD write code might also be wrong)
  •     
  • use an external value as ADC input to check that it is working correctly
  •     
  • route the connection between IDAC and ADC to an external pin and measure the voltage there
  •    

View solution in original post

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

To make sure it really is an ADC problem, some debug ideas:

   
        
  • debug your code to see what you get as a result from the ADC (your LCD write code might also be wrong)
  •     
  • use an external value as ADC input to check that it is working correctly
  •     
  • route the connection between IDAC and ADC to an external pin and measure the voltage there
  •    
0 Likes
Anonymous
Not applicable

 Hi Sir,

   

          Upto PGA working and ADC also working properly individualy but when i am cascading both,i am not getting anything .

   

Thanks 

   

PRP

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

Route the output of the PGA to a pin to observe it is within the input-range of the ADC, watch it with oscilloscope.

   

 

   

Bob

Anonymous
Not applicable

i Did that i got output from PGA with 4v and my ADC input range is 0 to Vdd which is 5v but still i am facing problem

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

There are some critical settings with ADC, can you post at least the settings of the ADC when not the complete zipped project.

   

 

   

Bob

Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

 i am unable to upload the project what to do ?

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

When I open this project with Creation 2.1, it complains about outdated devices to be used. Do you use a PSoC3 Engineering Silicon? If yes, which one?

   

Can you update to the newest version of creator?

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

One thing to note in your project is that the TIA output can get negative when the IDAC writes to the full values (31.875µA * 40kOhm gives 1.28V which is way larger than the reference voltage).

   

Also, is there a reason why you read the ADC result 4 times, and discard the first 3 readings?

   

Btw: since you don't change the IDAC - what is the result you see on the LCD? When I calculated correctly, it should 1.4V (4*(0.4-1.5µA*40kOhm), and it should be stable.

Anonymous
Not applicable

 Hi hli,

   

          actually i am doing this project on glucose so there first we get transients so we eliminate those . in this uploaded project as a sample i am giving a constant 1.25uA , and the version i am doing is ES2 040 PSoC ,which supports only 2.0

   

thanks

   

PRP

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Basically your TIA output ranges from 400 mV to Vss per your settings.

   

There is a spec missing in TIA datasheet, and also the OpAmp datasheet in the main part

   

spec, and that is common mode ranges for various power level settings of the TIA. So I

   

would start using TIA set to high power for initial debug. Then feed a SW ramp from 0 uA

   

to 10 uA and verify you get a ramp from .4 to Vss out of the TIA. Ramp from PGA should be

   

1.6V to 0 V.

   

 

   

I norticed you typed

   

   

Vin = (float) ADC_DelSig_1_CountsTo_Volts(ADCResult);

   

The cast is un-needed as the function returns a float.

 

Regards, Dana.

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

We still don't know what the problem is: what do you mean by 'garbage values'?

ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

One othjer issue, when you write the ADC inside a fast looping structure, you

   

get a lot of screen jitter due to noise, and display is a little unreadable. Keep

   

in mind LCD has its own controller refreshing the LCD and fast updates to this

   

asynch interface cause visual issues even if no charaxcter is changing.

   

 

   

Two approaches -

   

 

   

1) Delay the loop so screen update not so frequent

   

2) Build a buffer for the display. When you go to write display you check buffer,

   

character for character, what you want to write, and only write those LCD characters

   

that have changed compared to whats in the buffer, updating buffer with the new

   

character after. This makes a very stable display. Prefered method by far.

   

 

   

You will still get jitter, but now only the digits/characters that are changing, not the

   

whole LCD display line.

   

 

   

Regards, Dana.

Anonymous
Not applicable

Have you tried with ADC Continuous mode of operation ?

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

I think the TextLCD is not asynchronous. All write commands wait until the LCD is ready. This means that it will slow down the loop to accomodate the LCD speed. But writing so fast means you cannot really ready anything on it...

ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I should have been more explicit on what is asynch and what is not.

   

 

   

The 44780 Controller has a busy flag which is the basis of handshake for writes/reads of commands or data. Hence that is a synch interface.

   

 

   

What is asynch is the relationship of what is written and when it gets to actual LCD segments, due to an internal controller that is not synced to MPU clock in any fashion. It is possible to write at a rate where one or more internal ram buffer characters does not always get displayed one for one. That is the display self refreshes at its own frame rate, not knowledgeable about how often the data in any given ram location has changed. In other words the controller is dumb, it has no knowledge of what, when, data has changed in the frame buffer. It just simply regurgitates it mindlessly to the segment lines, this then is asynch behavior to the output.

   

 

   

Regards, Dana.
 

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

here i am uploading complete work , in which the final output is display of voltage which corresponds to particular glucose level.

   

test strip interface to psoc:

   

1) pin 1 refers to working electrode

   

2) pin 4 refers to reference  electrode

   

3) pin 3 refers to central electrode

   

here the default output i am getting is 3.17v but after applying blood to the test strip output voltage going to 0.18v which should not happen.

   

where i am going wrong , how to correct it can anybody help me in this regard.

   

thanks

   

prp

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If no test strip is attachedPin_1 floating, you should have

   

 

   

1) 400 mV at output of TIA

   

2) 3.2 V at output of PGA

   

 

   

This should also be true if you attach test stip with no solution ? I am not an expert

   

on test strip parameterics.

   

 

   

If test strip goes to .18 V Then TIA out should be 22.5 mV, Vout = 22.5 mV = Vref - 40 x Intia,

   

so Intia (uA) = ( 400 mV - 22.5 ) / 40 =~ 9.4 uA

   

 

   

Is this the current you think you should have ?

   

 

   

This shows for 100 mV ref time response of current, does this jive with your time response scaled

   

by your ref voltage ?

   

 

   

      http://electrochem.cwru.edu/encycl/art-g01-glucose.htm

   

 

   

Regards, Dana.

lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some reference material -

   

 

   

Regards, Dana.

Anonymous
Not applicable

this might help you out in designing of blood glucose meter

   

http://www.cypress.com/?rid=43661

ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I do not see in your code the drop trigger so that you can generate

   

the v(t) response as shown ?

   

 

   

file:///C:/Users/Dana/Documents/1%20Cypress/Ap%20Notes/Blood%20Glucose/Electrochemistry%20Encycloped...

   

 

   

 

   

 

   

Regards, Dana.

Anonymous
Not applicable

 i didnt understand what is drop trigger?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you look at the reference material you see a time response

   

of the drop coming into contact with the sensor, as shown in

   

this graph. Then an exponential decay as the chemistry of the

   

reaction proceeds. This reference discusses timing of when to

   

take your measurement. So you have to time your A/D measure-

   

ment after you detect the contact of the drop. Discussed in the

   

various ref material I have sent you.

   

 

   

      http://electrochem.cwru.edu/encycl/art-g01-glucose.htm

   

 

   

 

   

Regards, Dana.

ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You can always consider a peak detector to capture the max

   

value of the response, then digitizing its output, then resetting

   

it for the next use.

   

 

   

Regards, Dana.

Anonymous
Not applicable

 here if using peak detector, voltage levels are scaling down i.e if the input to peak detector is 0 to 4 to 0 . the output should be 4v but the output of peak detector is scaling down to millivolts which is not true.how to over this problem?

   

Thanks

   

PRP

0 Likes
Anonymous
Not applicable

 here using peak detector, voltage levels are scaling down i.e if the input to peak detector is 0 to 4 to 0 . the output should be 4v but the output of peak detector is scaling down to millivolts which is not true.how to over this problem?

   

Thanks

   

PRP

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you look at response time to peak all peaks oocur ~ 1 sec, your A/D is running

   

much faster than that, so easiest method is running the A/D continuously and do the

   

peak detection in software.

   

If you use an analog peak detection method thats basically stored charge on

   

a capacitor subject to discharge via leakage currents. You can calculate droop

   

on a capacitor Q = C x V, I = C dV/dT, dV = ( I x dT ) / C

   

     www.cypress.com/?docID=38360

   


Regards, Dana.