Input from an ultrasonic sensor

Danimal

Member
Join Date
May 2013
Location
USA
Posts
11
I am using an ultrasonic sensor to measure distance and the input is not too stable. I know this is the nature of the sensor,ambient conditions and so forth. I am using a Banner U-Gage T30. What I would like to do is take an average of 5 to 10 samples and throw out the hi and low values. I am having a hard time figuring this out without walking on my data and making it unusable. I am using a Horner PLC with 12 bit analog resolution.

I need to control the inflation of a sample and maintain an inflation rate of 22mm/Min. This is per ASTM 5617, multiaxial burst test. I will adjust the I/P based on the inflation rate that I see. Any suggestions?:unsure:
 
I'm not familiar with a Horner PLC, but if it has math instructions you could try a filter.
See text below.
 
Last edited:
The algorithm presented for filtering is OK for a Win7 or MAC computer, but for a 12 bit automation device, it has a pretty bad truncation error and will be remarkably slow.
The original: FilterValue = FV + Con(NewValue – FilterValue) or FV = FV + C(NV-FV) abbreviated.

A similar, but much faster and more accurate filter is the following.

FV = C*FV + (1-C)*NV where C might be .001, or more often 0.05.

An issue with both methods is that if NV is allowed to be a very large number, such as 10^23, the addition can result in delayed chaos. Thus on startup of the PLC, a preset routine should establish a valid value for NV and FV. To be even safer, such as if the input values were known to occasionally be wacked, it should be checked and reset into bounds if needed.
This check and reset into bounds prior to using the value can also accommodate your outliers.
 
start when NV is in between expected values for speed
run filter when the value is within your bounds
in REAL you can use narlin however the calc is 'wrong'
the original is good but the similar one should be
FV= (1-C)FV+C*NV with 0.05 for 20 samples in filter.

when you want it in INT you will have to shift values easier with 16 samples.
 
The Horner PLC and software has the look and feel of a GE 90-30. Horner makes specialty cards for AB and GE and others. I have used the low pass filter that you have shown with the math. I found today that the sensor may have a bad pin in it. If I touch or wiggle the connector in the socket when it is bottomed out I get erroneous feed back and the sensor loses signal, the little red light goes out. When the new sensor arrives I will put your ideas into the expression block and see what comes out. Thank you for the responses.
 
Did you use the teach function to define the upper and lower boundaries? The analog signal will scale linear between the lower and upper bounds. Most ultrasonics that I have used are pretty stable as long as you don't violate the minimum distance.
 
I saw that on my meter at one point and what I did is this: I set the maximum distance 2 inches past my usable target and set the minimum distance at 12 1/2 inches from the sensing head, The dead space is 0 to 11.9 inches on this sensor. I then changed my scaling in code to not use that maximum distance for the maximum. So my meter was showing about 4.7 to 5 ma with my sample in the machine and it would still be bouncing around and giving me a lost signal value of 3.6ma, per Banner's cut sheet on the sensor. The sensor is a T30UINBQ. The sample is 24" diam and is a flat sheet of polyethylene film.
 
Don't worry about the scaling right now, lets just concentrate on the raw values. From what you have stated you should receive a 4ma raw signal at 12.5" from the sensor head and 20ma at 24.4" (11.9+12.5) inches away. You should hear a slight buzzing noise at the end of the sensor when it is working. Try placing a target at approx 18" from the sensor and see if you get approx 12ma.
 
I do hear the buzzing or clicking that you mentioned. I don't think that I explained what I did clearly. Here is what the range is. The sensing range that I need to use is 60". The sensor has a range of 72". I have the sensor mounted 70" from the sample. I put a target at 73.5" from the sensor head and set the sensor's maximum distance, my 4ma. I set the sensors minimum distance at 12.5" from the sensing head, my 20ma. Now having my range set to be 2.5" past what I am going to actually use I thought I would correct the problem of my sample being at the sensing limit. I still get loss of signal on the sensor, the little red signal light flickers. Now after going out to the machine and measuring distances again so I give you the actual numbers I think I see a problem with my set up. My sensing head my be too far from the sample or right on the edge. I think that I will move it down 2" closer to the sample. I don't expect the sample to expand the full distance during testing. This is what I am building, https://www.youtube.com/watch?v=lVILXcfon2M
 
I am using an ultrasonic sensor to measure distance and the input is not too stable. I know this is the nature of the sensor,ambient conditions and so forth. I am using a Banner U-Gage T30. What I would like to do is take an average of 5 to 10 samples and throw out the hi and low values. I am having a hard time figuring this out without walking on my data and making it unusable. I am using a Horner PLC with 12 bit analog resolution.

I need to control the inflation of a sample and maintain an inflation rate of 22mm/Min. This is per ASTM 5617, multiaxial burst test. I will adjust the I/P based on the inflation rate that I see. Any suggestions?:unsure:
I guess I am missing something. If your sensor is unstable, why don't you buy a better sensor (Senix comes to mind), and move on. Seems to me that you're breaking a prime directive, solving a hardware problem with software.
Consider, too, what if the number you 'throw out' is really the number you wanted to have in the first place.
Sounds like a good place for a Designed Experiment, of Gauge Capabiilty study first.
 
You bring up a valid point regarding the hardware. I do have quotes on a couple of other sensors just not the one you mentioned.
 
I am going to call senix and see what we can do there. The PLC is capable of doing serial communication. I have used it before to control VFD's, speed and data only. Thank you for all the help everyone.......
 
I did get a quote from Senix and they were quite helpful in selecting a sensor for the application. Thank you for the suggestion. I also found that my meter lead had a break in it and was causing my erratic signal into the PLC. Imagine that. I had it connected in series with the input so I would watch it. My existing sensor is working now, it appears. I will complete that project and see how it does otherwise I will get the one they suggested from Senix.
 

Similar Topics

Hi, I have a ControlLogix system with 1756-IF16 analogue inputs. I can't scale the inputs at the card as there is a requirement to facilitate...
Replies
14
Views
367
I'm having trouble calming down 2 Tempo Sonics. I'm using Studio 5000 CompactLogix my Raw value is jumping around from 8575.0 to 8755.0 at a...
Replies
30
Views
1,145
I cannot add SLC500 analog input tag (I: 8.3) to EZSeries Touch Panel Editor (V 5.3). I used all the listed tag datatype but it all says "Invalid...
Replies
10
Views
259
Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
119
Omron AD081-V1 Analog Input Card Offset & Gain Adjustment Entering Adjustment Mode 1. Set the input card in adjustment mode (Turn ON Dip SW No-1)...
Replies
0
Views
88
Back
Top Bottom