CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Suggestion for Ultra Sonic measurement
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

Suggestion for Ultra Sonic measurement
PostPosted: Fri Jan 18, 2019 12:35 pm     Reply with quote

Suggestion for Ultra Sonic measurement

To understand my thoughts you need to use some imagination.

The Transducer is a 200Khz Transceiver with RxTx in one unit.

First idea is to generate the ping with a PWM from a PIC for some ms, this is Tx mode.
Then stop and goto Rx mode, listen for the echo (ping)

Sound speed is 340mm/mS same as about 3uS->1mm

In Tx the ping hit the wall 1 meter away in (3ms) and reflect back, so it is double distance. From a Tx ping to a Rx ping, distance is double (time to do things...)

In simple way i hope for this: Sending a ping from the PIC, when the ping is over start a timer, feed the op-amp signal to the comparator in the PIC and wait for the Rx ping to give an interrupt?

What to expect for Rx level? I think to use a op-amp, but if we are talking uV then it won't work?

Is the idea dead, if it is then why?
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Jan 18, 2019 1:47 pm     Reply with quote

Prototype something first using a signal generator, two of your chosen transducer, and an oscilloscope.

Place the transducers maybe 1m apart, facing each other. Feed a sine wave set to the resonant peak of the transducer into one, and use the oscilloscope to have a look at the received signal generated by the other. Vary the separation distance of the transducers and note the received signal level.

This will give you an idea of the sensitivity of the transducers under ideal conditions. This will guide your efforts to prototype a proper receive amplifier, perhaps with tuned filter as well. The required gain will probably be quite high, and the frequencies involved will probably negate using "simple" techniques such as op-amps. You're probably going to need to build several "from scratch" tuned transistor amplifier stages. Not impossible, and probably quite readily prototyped on standard solderless breadboards. Build, test, revise, repeat.

Once you get something which works with a pair of transceivers, switch to a single transmit/receive transducer. Naturally the gain of the receiver will need to at least double to account for the doubling of the distance the sound pulse must now traverse.

On the firmware side of things, what you propose is possible but you're going to have to put some thought into it. During the excitation phase, you're going to need to "hit" the transducer at a precise frequency for a precise number of cycles. Sounds very much to me like a job for a PWM (the CCP module of most PICs). You also need to precisely measure time from the start of excitation to the reception of the start of the echo - again, sounds like a good job for a CCP module. To make things easier from a code standpoint, a different CCP module than the one used to generate the transmit pulses (the chirp) would be better.

It's definitely possible, but the firmware isn't the hard part.

All that said, is there a specific reason why you don't want to use an off-the-shelf ultrasonic distance measuring module?
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Fri Jan 18, 2019 1:57 pm     Reply with quote

Thousands of such units on the market.
Key thing is that the ping, must be at the resonant frequency of the
transducer, or the sensitivity declines massively. You need to choose
the drive carefully.
Range of detection will depend massively on the drive and the nature
of the surface being sensed. Things like a tennis ball give very poor
return signals (soft surface and curved).
Because of the resonant nature of the transducer, you can get a much
higher drive voltage than you actually apply.
A single transistor amplifier can receive the output from such a sensor
fine (mV rather than uV).
Remember your receive needs to be disabled for a while after drive
is removed. The ping does go on for a short while, and you will
always get some coupling back through the PCB and casing.
The little 'brick' rangefinder supplied with the Lego Mindstorms
system, was a design I made some time ago. Uses a PIC and CCS C
inside...
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 18, 2019 3:37 pm     Reply with quote

I'm with newguy... WHY reinvent the wheel ?? It's probably a safe bet you cannot make a sensor better and cheaper than an 'off-the-shelf' one.

Jay
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Sat Jan 19, 2019 2:25 am     Reply with quote

Thanks for feedback.

It is all about the end price. We need something simple and it must be waterproof. Measurement range will be from about 15cm to 100cm resolution is not so important 1 cm will be fine.
There is tons of china stuff out there, but we don’t want to use any china model, they are cheap but how long will it work and what about stability.
A commercial sensor is about 60-80$ that is more than our final price for the complete product.
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Sat Jan 19, 2019 5:32 am     Reply with quote

The cheapest source for reasonably waterproof ultrasonic sensors
is the automotive industry.
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 19, 2019 5:49 am     Reply with quote

Mr T. is right again ! Don't know what 'over the counter cost' as I get them from wrecked vehicles, 2pr in every crunched bumper !!

Jay
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Sat Jan 19, 2019 8:47 am     Reply with quote

Right, have looked there, but we need not more then +-20 degree. Most auto range sensors are +-60 to 80 degree.
Still looking, price limit about 8$, don't laugh...
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 19, 2019 9:01 am     Reply with quote

Why US sensors? IR can give 'narrow beam', low cost oo !

just thinking of options
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Sun Jan 20, 2019 2:02 am     Reply with quote

Narrow beam is actually quite hard to do with ultrasonic. Just like with sound
there is a strong tendency to pick up stuff outside the beam area. So called
narrow beam sensors will not genuinely give their narrow performance,
without a trumpet shield.
Just like a microphone, getting real narrow performance requires either
staggered tube elements, or a reflector.
In the case of the ultrasonic transducer, the narrow beam unit
will have a huge fan of 'lobes' coming out at much wider angles
at the base of the beam pattern. The trumpet is needed to suppress
these.
Most car bumper sensors are at least 50degree beam angle, while for
narrow beam applications, the manufacturers switch to radar, to avoid
having the external visible trumpet. So a car 'blind spot' system will use
radar rather than ultrasonic, and similarly cross traffic sensors are radar
based.
So long as you don't mind having an external trumpet, a narrow beam
sensor can work quite well. Without the trumpet though be prepared to pick
up things well outside the quoted beam angle. Even with the trumpet,
reflections can lead to spurious range detection at times.
Companies in the security industry do use quite a lot of narrow beam
ultrasonic sensors, so look here for the best price on these.
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Tue Jan 22, 2019 2:36 am     Reply with quote

Is your maximum distance 1m?.
Honestly, look at IR, rather than ultrasonic if so.
Sanyo, do some great IR distance sensors.

The GP2Y0A02YK0F supports ranges from 15cm to 1.5m, and gives a
simple analog output. Only just over your budget, but it is a complete
unit. Only needs power, and you just read distance from it. The output
is not quite a straight line, but is easy to correct with a look up table.
Gives 2.7v at 15cm, falling to 0.4v at 1.5m. Works comfortably with
materials with a wide range of reflectance (they show basically the same
output, from 18% to 90% reflectance). It doesn't like direct sunlight
though.

Even if you get your sensor for $8, by the time you add a driver, receive
amplifier, and a suitable funnel, your total is going to be double this. The
Sanyo IR, is about $10 (in quantity - one off is about $14).

Possibly worth considering.
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Sat Jan 26, 2019 3:27 pm     Reply with quote

Yes it is true, main problem is the environment in which the sensor is to be used.
It is placed outside 24/7, together with, water, dust, and word i wont say, the environment is not for IR.

Thanks for all the nice hints and suggestion.
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 26, 2019 5:45 pm     Reply with quote

hmm.. there are some RADAR style sensors (have one here 'somewhere') maybe they'll work ?? cheap, short distance units. Since it's a 'challenging' enviroment, I'd use 2,3 or 4 sensors and use a 'majority rules' algorithm. I did that for the direct wire system to eliminate false or bad data.

Just thinking of options for you.

Jay
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Tue Jan 29, 2019 6:29 am     Reply with quote

More complicated than first assumed.

A sensor with RX-TX integrated has after resonance of about 3ms. When using independent RX TX units the after resonance can be damped to near nothing (distance, and mounting them in some absorbing materials), it then run smooth and measures from 4cm and up to 1,5meters. I need a range from 10cm to 100cm with a resolution on about 1cm.

System run from 3v3 use one PIC (16F1825), and one op-amp. The transducer are on the half_bridge PWM.
Then two band-pass filters (op-amp), one at AV=10 and one at AV=23 about 47db totally.
Feed it into the PIC on a comparator. The comparator use the DAC (DAC reference using the FVR_Buffer) as reference, so minimum of components. Most are in the software.

Just bad it won’t work with the right sensors…

Someone who have tried single combined (RX-TX in same unit) waterproof ultrasonic sensor units? (not a factory complete unit but a DIY one)
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Tue Jan 29, 2019 7:30 am     Reply with quote

This is ringing.
Look for a transducer with a lower Q.
Downside of this is the higher the Q, the better the transducer suppresses
signals that are at other frequencies.
You can also suppress this electronically, either by shorting the transducer with
a FET a few moments after the drive is stopped, or even by applying an anti-
phase drive for a couple of cycles.
This behaviour is also massively affected by the mechanical mounting of the
transducer.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group