cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor II

Dear All:

I'm in the process of creating a "pressure monitor" using PSoC 5 LP-059.

Currently there is a problem.
When the power is turned on, the display of 7SEGMENT will drift.

It will converge after about 5 minutes.

The hardware solution was to insert an LPF into the AD input of PSoC 5 LP-059.

It is a combination of 10KΩ and 4.7μF.

Please advise if there is a good way to prevent this drift of the amplifier.

Software measures are also welcome.

0 Likes
Reply
10 Replies
Honored Contributor II

suto,

Please help us to help you better: describe plsensor part number, show connection schematic and post you project for review if permitted: (1) Build->Clean, (2) File->Create Worspace Bundle->Minimal. (3) In created Archive you may delete a folder Generated_source to reduce the size.

If you have pressure drift data over time, add it also.

Finding solution for slow drift may be quite involved sometimes.

/odissey1

0 Likes
Reply
New Contributor II

Dear Odyssey 1

The output from the Instrumentation Amplifier is PSOC P3.3 to the port, the other is input to the 4-20mA communication driver.

The gain of the Instrumentation Amplifier is about 500.

The deceased, the leader of this project, was initially developing on the PIC16F73, and we heard that the output drift of the Instrumentation Amplifier was suppressed by averaging the program 128 times, but we do not know whether this is true.

0 Likes
Reply
Esteemed Contributor

Hi,

From your description, it is not easy for us to understand where the problem is taking place.

In the block diagram below from which point do you observe the drift?

For example if the "Value_output" is stable, but 7SEG is showing drift,

the 7 SEG may be broken, although this is unlikely the case.

So would you let us know

if the drift is taking place at "Sensor_Output" point

or

if the "Sensor_Output" is stable but "ADC_output" is drifting

000-ADC-7SEG-Block.JPG

Since you wrote "hardware solution", it sounds like "Sensor_Output" is drifting.

moto

0 Likes
Reply
New Contributor II

Hi Tanaka-san

The noise can be checked is Sensor_Output in the drawing that Mr. Tanaka presented.

Although I checked with the oscilloscope, the noise of about 1.5V comes in.

It converges in about 5 minutes or so.

A 100KΩ resistor was mounted on the pulldown, or a 4.7 µF capacitor was implemented, but it was not effective.

The deceased technician used the PIC16F73 to handle this amplifier drift with the software.

It seems that it is an averaging program, and it seems to perform 128 operations, but whether this is true or not, it is currently being verified.

0 Likes
Reply
Esteemed Contributor

Dear Suzuki-san,

If the noise/drift can be observed at the "Sensor_output" point, at least it's not the fault of ADC nor Value_Converter, etc.

Meantime, yes, accumulating the value and get the average usually take care of higher frequency noise.

(1) I'm just curious but can you change the ADC to differential mode

     and connect ground output of the sensor to the minus-input

     and connect output of the sensor to the plus-output?

(2) May be, try average something like below

// note: you will get very low

========================

// in the global area of the program

#define NUM_AVERAGE 128

int16_t raw_value[NUM_AVERAGE] ;

// in the measuring function

static uint8_t initialFlag = 1 ;

static int  adc_avg_index = 0 ;

int32_t adc_sum = 0 ;

int16_t avg_value = 0 ;

int i ;

raw_value[ adc_avg_index ] = ADC_GetResult16() ; /* name of ADC may be different */

if (initialFlag) { // raw_value[] is not full, use direct value for the time being

    avg_value = raw_value[ adc_avg_index ] ;

} else { // we have raw_value[] full of data now

   adc_sum = 0 ;

   for (i = 0 ; i < NUM_AVERAGE ; i++ ) {

        adc_sum += raw_value ;

    }

   avg_value = adc_sum / NUM_AVERAGE ;

}

adc_avg_index++ ;

if (adc_avg_index >= NUM_AVERAGE) {

    adc_avg_index = 0 ;

    initialFlag = 0 ;

}

// From here use avg_value as the normal return value of ADC

...

========================

Best Regards,

16-Jul-2019

Motoo Tanaka

0 Likes
Reply
New Contributor II

Dear Tanaka-san

This is the schematic to be attached.

I tried to rewrite as you say, but then the negative input to the sensor is not connected?

Where can I put additional C sources in mainc?

0 Likes
Reply
Esteemed Contributor

Dear Suzuki-san,

If the sensor does not have differential output, please try connecting minus-input to the sensor's ground (or frame ground).

And if it does not help, or the ground is already connected to the ground/vss of PSoC probably it was not needed.

Then please forget about (1) and return the system as before.

Best Regards,

16-Jul-2019

Motoo Tanaka

0 Likes
Reply
New Contributor II

Dear Tanaka-san

I have added your C-source in main.c at the last, but when I build it, 8 errors come out and I’m in trouble.

The amplifier drift measures that the predecessor wrote for the PIC16F73,

seems to have cleared the problem with the adoption of the averaging program.

Then the Instrumentation Amplifier is the AD8223BRZ.

This is not a differential amplifier.

Best Regards,

Tossiy

0 Likes
Reply
Esteemed Contributor

Dear Suzuki-san,

> I have added your C-source in main.c at the last,

> but when I build it, 8 errors come out and I’m in trouble.

I'm afraid that it is your responsibility to understand the algorithm

and adjust the source so that it will work with your project.

I wrote

>> May be, try average something like below

I showed only the "idea" with my hope that it can be useful.

This means that without total control of the project,

providing "error free" source is very difficult.

Having said that, if you can show the error messages

and the "measure" function in which you tried to insert my source here,

I may be able to adjust my code to be compatible.

But I can not guarantee if it can be done

nor if it will work the way you expected.

Best Regards,

18-Jul-2019

Motoo Tanaka

0 Likes
Reply
Moderator
Moderator

Dear author,

this thread has not been updated for long time.

So, it will be locked at this time.

If you need further support, please kindly post the new thread.

it would be appreciated, if you comprehend for this.

thank you.

0 Likes
Reply