Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 1 > Psoc rangefinder

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Psoc rangefinder
Moderator:
ARVI

Post Reply
Follow this topic



Psoc rangefinder

Cf_corp posted on 12 Nov 2012 7:54 AM PST
Top Contributor
74 Forum Posts

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?




Re: Psoc rangefinder

danaaknight posted on 12 Nov 2012 08:28 AM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

Cf_corp posted on 12 Nov 2012 08:34 AM PST
Top Contributor
74 Forum Posts

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.



Re: Psoc rangefinder

danaaknight posted on 12 Nov 2012 09:33 AM PST
Top Contributor
1773 Forum Posts

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

water vapor, eg. acid as you know.

 

Regards, Dana.



Re: Psoc rangefinder

Bob Marlowe posted on 12 Nov 2012 10:10 AM PST
Top Contributor
1768 Forum Posts

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



Re: Psoc rangefinder

danaaknight posted on 12 Nov 2012 11:37 AM PST
Top Contributor
1773 Forum Posts

Looks to me to be a big problem.


http://www.classnk.or.jp/hp/pdf/publications/Publications_image/classnk_magazine_no63.pdf

http://202.114.89.60/resource/pdf/1919.pdf

http://www.astm.org/Standards/D664.htm

http://www.vurup.sk/sites/vurup.sk/archivedsite/www.vurup.sk/pc/vol52_2010/issue1/pdf/pc_1_2010_stratiev_051.pdf


Regards, Dana.



Re: Psoc rangefinder

danaaknight posted on 12 Nov 2012 11:51 AM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

Bob Marlowe posted on 12 Nov 2012 01:03 PM PST
Top Contributor
1768 Forum Posts

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



Re: Psoc rangefinder

danaaknight posted on 12 Nov 2012 02:11 PM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

H L posted on 12 Nov 2012 03:30 PM PST
Top Contributor
679 Forum Posts

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.



Re: Psoc rangefinder

Cf_corp posted on 13 Nov 2012 01:23 AM PST
Top Contributor
74 Forum Posts

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,



Re: Psoc rangefinder

Cf_corp posted on 13 Nov 2012 01:43 AM PST
Top Contributor
74 Forum Posts

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



Re: Psoc rangefinder

danaaknight posted on 13 Nov 2012 04:00 AM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

Cf_corp posted on 14 Nov 2012 01:45 AM PST
Top Contributor
74 Forum Posts

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

 



Re: Psoc rangefinder

danaaknight posted on 14 Nov 2012 03:56 AM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

H L posted on 14 Nov 2012 04:34 AM PST
Top Contributor
679 Forum Posts

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?

 

 



Re: Psoc rangefinder

Cf_corp posted on 14 Nov 2012 06:09 AM PST
Top Contributor
74 Forum Posts

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

 



Re: Psoc rangefinder

danaaknight posted on 14 Nov 2012 07:42 AM PST
Top Contributor
1773 Forum Posts

Basically look like this -

 

BYTE cDistance = 0;

 

if ( cDistance < 10 ) {

.......

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

.......

} else if ( cDist >= 15 ) {

.......

}

 

Regards, Dana.



Re: Psoc rangefinder

Cf_corp posted on 19 Nov 2012 07:42 AM PST
Top Contributor
74 Forum Posts

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.



Re: Psoc rangefinder

danaaknight posted on 19 Nov 2012 08:01 AM PST
Top Contributor
1773 Forum Posts

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.



Re: Psoc rangefinder

Cf_corp posted on 20 Nov 2012 02:52 AM PST
Top Contributor
74 Forum Posts

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






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20