Psoc rangefinder

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

cross mob
Anonymous
Not applicable

Hi guys,

   

ive been going through some sample projects available here, ive downloaded the fantastic psoc range finder app for my ct8c 29466 pxi. its pretty cool and  is neat, very simple circuit which is great. I was thinking of wanting to  modify the code to be used for tank liquid measurement, in a simplistic way rather than a distance display in cm's. I was thinking could it be modified to look at a water level and output 3 levels such as high, medium and low? it doesnt need to have the lcd either as i dont really need it. Ive done similar in college labs a few years ago with the psoc 3 but with temperature measurement, another thing i was thinking of was if the level suddenly drops as in more than an inch per minute to set an output high indictaing a leak?

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

Application to water level is appropriate. You have to consider, if you want

   

absolute accuracy, speed of sound thru water vapor, and maybe use a

   

compensation table for temperature of the velocity correction.

   

 

   

Level alarms nothing more than measurement tests in software.

   

 

   

Effects of water vapor on transducers has to be considered, eg. corrosion....

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

hi dana, 100% accuracy wouldnt be an issue. the sensors would be used inside and i was actaully thinking of measuring oil level in a sealed enclosure so i dont think corrosion would be an issue.

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

If petroleum oil be aware of sulpher component. Very reactive with

   

water vapor, eg. acid as you know.

   

 

   

Regards, Dana.

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

The sulphur in petrol is bound in an organic-sulpur compound which is not easy to crack. That is the reason why they have got a flare on some platforms or at refineries.Those compounds have something in common: they smell really bad (ask a skunk).

   

So there will be no additional risk of corrosion when the petrol is not de-sulphorized.

   

 

   

Bob

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

I also had a chat with an APG Inc engineer, they make ultrasonic transducers

   

for level measurement, and the designs  for oil tanks consider sulphur as a

   

problem. That effects sensor housing materials.

   

 

   

Regards, Dana.

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

Dana, that's dealing with crude oil, I am thinking of the normal petrol you use for heating or for the cars. In crude oil is a lot of H2S which not only is as poisonous as cyanid but also highly agressive. When you look through your examples (links) you'll see that some problems the articles deal with are see-water which needs a V4A-steel when uncoated or from H2S and its compounds from reacting with the oxigen in the air up to sulphoric acid.

   

So I mis-understood the usage of the sensor's medium.

   

 

   

Bob

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

The ASTM link is for processed petroleum producrts, not crude. The others

   

are crude, and not just seawater. Fracing does NOT remove all byproducts.

   

Thats why additives are added to various oils to combat incomplete/imperfect

   

petroleum reduction.

   

 

   

Of course, we are way off the mark at this point, poster is in a water environment.

   

In and of itself that can be highly corrosive.

   

 

   

So the base point here is no open transducers should be considered. Or at the very least

   

the chemistry of the application environment.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I guess you would have the sensors enclosed so no electrical spark would cause fire or explosion.

   

You then need to consider the changes due to the encloser.

0 Likes
Anonymous
Not applicable

hi guys,

   

the sensor would be in an enclosure and it would be measuring kerosene or home heating oil which we tend to use in rural areas in ireland,

0 Likes
Anonymous
Not applicable

but for arguments sake its really only something i want to experiment with not to roll out, im looking over the code which is in assembly language and was wondering if it was possible. but im thinking what if i were to try and use the same code in different depths of tank etc. i have a 4ft deep plastic tank and a 6ft deep plastic tank im just thinking is it scalable or would the low medium and high levels only work for whatever tank i decide on using it on? i also have a tank level which i bought and i was interested in making my own budget one since i came across the fantastic range finder program

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

I may be redundant but this ap note seems to fit your requirements -

   

 

   

      http://www.cypress.com/?docID=37812

   

 

   

This is written in C.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Dana,

   

Thanks for the link submission, Its seems interesting, I will take a look for the application download itself.

   

I was thinking thought with the range finder itself that i could manipulate the data, i mean it finally outputs a value in cm to the lcd. Would it not be possible to set some tolerances for simple levels. i know this i .c but would it be,

   

if (distance is 10cm or less) {

   

 level high

   

}

   

else if (distance is 15-30cm)

   

level is medium

   

}

   

etc

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

You are missing a bracket -

   

 

   

if (distance is 10cm or less) {

   

level high

   

}

   

else if  {                     //(distance is 15-30cm)

   

level is medium

   

} else if {

   

......

   

 

   

Or use a case statement.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

if (distance is 10cm or less) {

   

level high

   

}

   

else if  {                     //(distance is 15-30cm)

   

level is medium

   

} else if {

   

......

   

 

   

}

   

 

   

 

   

 

   

What is between 10cm and 15cm?

0 Likes
Anonymous
Not applicable

hi,

   

between 10-15 is a medium level for example. would that not be

   

else if {

   

distance is greater than or equal to 10 and less than or equal to 15cm level is medium.

   

}

   

i would probably need to use the .asm equivalent though if i plan to modify the code etc

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

Basically look like this -

   

 

   

BYTE cDistance = 0;

   

 

   

if ( cDistance < 10 ) {

   

.......

   

} else if ( ( cDist >= 10 ) & ( cDist < 15 ) ) {

   

.......

   

} else if ( cDist >= 15 ) {

   

.......

   

}

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

hi Dana,

   

Thanks for your reply,

   

I had a look at the app note link you provided, Unfortuantely when I found the actaul program it wasn't  compatible with PSoC 5.2 or 5.3 designer.

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

The ap note is a PSOC 1 ap note, but being written in C

   

should not be too difficult to port. HW portion of the port even

   

easier I would think as Creator and its modules tend to be more

   

capable.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

OK, so I got the program to port over and it works with PSoC designer 5.3 and ive switched to my cy8c27443 24pxi MCU,

   

Ive been reading through the app notes, this ultrasonic based range finder seems to have a more complex circuit as opposed to the other one writter in ASM

0 Likes