Welcome! Log In Create A New Profile

Advanced

Ultrasonic Z-height sensing?

Posted by Radian 
Ultrasonic Z-height sensing?
February 13, 2014 06:19AM
dc42 has done sterling work with the IR sensing and continues to explore other solutions. I have another proposal which I think ought to have it's own topic to avoid any hijacking!

A 40kHZ Ultrasonic source and receiver can measure time-of-flight to and from the bed to within a few millimeters, and switch to phase comparison for final homing below 8mm (25us/cycle * 340um/us = 8500um or 8.5 millimeters per cycle). It should be a pretty clean return from the plane surface of the bed and could perform the X homing using a tab on the back of the X motor (similar to the original IR homing technique). I've done some ranging with ultrasound using PIC chips and obtained good results so it should fly. Any comments?


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 06:51AM
Hi Radian, the only reason I had so far discounted ultrasonics is that the speed of sound is affected by temperature but I am unsure how much of an effect it would be.

regards

mike
Re: Ultrasonic Z-height sensing?
February 13, 2014 07:12AM
Hi Mike, from Wikipedia


Ambient Temperature can be compensated for in software as it has a known relation to velocity of sound. Temperature can be inferred from bed thermistor and or a local sensor. Shouldn't be too much of a problem.

Edited 1 time(s). Last edit at 02/13/2014 07:14AM by Radian.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 07:16AM
Hi Radian it looks like a fairly constant change so you may be able to compensate for it depending on the effects on the transducer.

regards

Mike
Re: Ultrasonic Z-height sensing?
February 13, 2014 07:32AM
Mike, I accidentally hit the post rather than preview and went back in to edit in pretty much what you just said! The ambient temperature is a pretty big factor and it has to be taken into account, yet it might even benefit from the closed-loop bed heating already in place. The air temperature near the bed surface might be even more predictable for a given set-point than it would be without active heating.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 07:51AM
I agree Radian the only worrying factor is airflow and temperature gradients etc between the sensor and the bed but if measured at a known temp with the bed heating cycle not started it could be accurate.

Best regards

Mike
Re: Ultrasonic Z-height sensing?
February 13, 2014 08:42AM
I think we would want to do the measurement with the bed up to temperature, because bed heating affects bed levelling - although with sufficient improvement to the y-axis design, this effect could perhaps be reduced enough to be insignificant. However, the temperature of the air in the first 2mm or so above the bed should be only a few degrees lower than the bed, so it should be possible to compensate for it in software. The temperature coefficient of the speed of sound in air is about 1 part in 700 per degC at the bed temperatures of interest, so if we are calibrating at a height of 2mm then it would take a temperature error of 17C to get a height error of 0.05mm.

The wavelength @ 40kHz is about 8.5mm but the sound travels to the bed and back, so the resolution is about 4.25mm per cycle. To get 0.05mm resolution, the phase will need to be measured to a resolution of about 4 degrees. One potential problem is that the resonant frequency - and hence phase shift at the driven frequency - of the transducer itself may be temperature-sensitive. A higher frequency transducer would probably help, but a I had a quick look at Farnell's range and found that above 58kHz they get expensive.

I've used attiny processors to do quadrature phase sensitive detection/phase measurement at 7kHz and simple phase sensitive detection at 40kHz. For this application, we really need to do quadrature phase detection at 40 or 58kHz, which is beyond the capability of the attiny processors that I am familiar with, however the ATXMEGA8E5-AU is inexpensive and looks to be more than adequate for the job.

Instead of measuring the phase, which would require 2 transducers, I think it may be possible to rely on the fact that at 2mm or so range, the standing wave between the bed and the transducer will affect the impedance of the transducer, and hence the amplitude and phase of the signal across it when it is driven from a high impedance source. So we could look for a maximum or minimum in this signal, and calibrate the height at which this maximum or minimum occurs.

Edited 1 time(s). Last edit at 02/13/2014 08:43AM by dc42.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 13, 2014 09:02AM
Quote
dc42
Instead of measuring the phase, which would require 2 transducers, I think it may be possible to rely on the fact that at 2mm or so range, the standing wave between the bed and the transducer will affect the impedance of the transducer, and hence the amplitude and phase of the signal across it when it is driven from a high impedance source. So we could look for a maximum or minimum in this signal, and calibrate the height at which this maximum or minimum occurs.

Now that's a darn good idea but it would have to have be a well-defined response such that you knew you were somewhere in the first and only cycle.
RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 09:20AM
Quote
Radian
Quote
dc42
Instead of measuring the phase, which would require 2 transducers, I think it may be possible to rely on the fact that at 2mm or so range, the standing wave between the bed and the transducer will affect the impedance of the transducer, and hence the amplitude and phase of the signal across it when it is driven from a high impedance source. So we could look for a maximum or minimum in this signal, and calibrate the height at which this maximum or minimum occurs.

Now that's a darn good idea but it would have to have be a well-defined response such that you knew you were somewhere in the first and only cycle.

I'm thinking that the sensor board would output (to the Duet) the amplitude of the signal across the transducer relative to the driving signal, with some constant subtracted to make the reading at the Duet less sensitive to noise. To home Z, the Duet firmware would move the head up 5mm or so, then slowly down, looking for maxima and minima, until the difference between the last maximum and last minimum is large enough to indicate that we have reached the one closest to the bed (which is the one we will have calibrated). This assumes that the size of the maxima and minima vary sufficiently with distance.

I'll try this out on an Arduino, and port it to an attiny if it looks to be working well.

Edited 1 time(s). Last edit at 02/13/2014 09:21AM by dc42.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 13, 2014 10:08AM
I just did a quick test on an ancient ultrasonic transducer I had lying around. The greatest difference in amplitude I was able to see between the first maximum and first minimum was about 10%. So I think this method may be feasible. However, the maximum and minimum are not sharp peaks, so it may be better to calibrate at the point halfway between.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 13, 2014 03:28PM
To get the phase difference as an analogue signal to feed to the Duet, convert the driving and received signals to a square wave (clip and go via an op-amp comparator), then feed the Tx and Rx square waves into the inputs of an XOR gate. Feed the output of the XOR via a resistor to a capacitor (which acts as a simple RC low pass or "loop" filter). The voltage across the capacitor is proportional to phase difference - 0=exactly in phase, max=exactly out of phase (180 degrees), half is 90 degrees out of phase and the best value to use as reference height. It cannot determine whether the phase is leading or lagging, so you have to be within a half-wavelength. You might have to buffer the analogue output with an op-amp (which can be wired to act as a better lowpass filter).

My concern is that the transducers are relatively large and so would have to be mounted a wavelength or more apart horizontally, meaning that the distance measured would not be vertical, and a given change in height would give a smaller change in that measured slope distance. Also whether the received signal would be pure enough in phase rather than containing a broad spread because the sound is received after reflection from a fairly large area of glass - the beamwidth of ultrasonic transducers is pretty large. For those reasons it would probably be better to mount the ultrasonic transducers quite a bit above the nozzle to reduce both effects, and use a different method to get the head to within a known number of halfwaves from the glass. Perhaps start by traditional sonar rangefinding (timing the echo of a very short pulse), and then switch to phase measurement when the height is within the ballpark. All perfectly possible in the Duet firmware with just a few cheap external components to handle the transducers. If we're lucky, we may be able to get a distance measurement to within 4mm from the amplitude of the received signal. Which would then allow us to use a pair of simple comparators to clamp the phase output to zero or max when the amplitude of the received signal is below or above the 2mm range we want. (wavelength = 8mm. Half wavelength for simple comparator = 4mm. Distance of half wavelength (there & back) = 4mm/2 = 2mm)

Phase resolution should be at least 1 degree with even that simple comparator = 0.01mm at 40kHz, so we could go down in frequency quite a bit which would help to resolve the half wavelength while still giving adequate distance resolution. 10kHz would allow at least 0.05mm resolution, and also keep mosquitos and teenagers away from the machine.

Dave
(#106)
Re: Ultrasonic Z-height sensing?
February 13, 2014 05:13PM
Quote
dc42
I just did a quick test on an ancient ultrasonic transducer I had lying around. The greatest difference in amplitude I was able to see between the first maximum and first minimum was about 10%. So I think this method may be feasible. However, the maximum and minimum are not sharp peaks, so it may be better to calibrate at the point halfway between.

Right, but what sort of source impedance was driving the transducer? At close range I was expecting the reflected wave to have more than a 10% effect. I just tried driving a 5V square wave through 10K and get something like 30%. The first peak (constructive return) looks dead easy to threshold. If it was synchronously sampled it could easily be "ridden" to locate the maximum - within around 4mm of the bed. And just calibrating for the maximum looks as though it would be reliable enough to determine that it was in the first cycle. BTW this is with a £1.50 transducer.

@dmould, I always get a kick out of using XORs! However, dc and I are looking at a single transducer solution that capitalizes on the close-range interference effect of the reflected signal. I think it may be all we need to give us an absolute distance a few mm above the bed.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 05:45PM
Quote
Radian
Quote
dc42
I just did a quick test on an ancient ultrasonic transducer I had lying around. The greatest difference in amplitude I was able to see between the first maximum and first minimum was about 10%. So I think this method may be feasible. However, the maximum and minimum are not sharp peaks, so it may be better to calibrate at the point halfway between.

Right, but what sort of source impedance was driving the transducer? At close range I was expecting the reflected wave to have more than a 10% effect. I just tried driving a 5V square wave through 10K and get something like 30%. The first peak (constructive return) looks dead easy to threshold. If it was synchronously sampled it could easily be "ridden" to locate the maximum - within around 4mm of the bed. And just calibrating for the maximum looks as though it would be reliable enough to determine that it was in the first cycle. BTW this is with a £1.50 transducer.

When I drive the transducer through a 10K or even 100K resistor, I see very little change in amplitude with range. The best result I had was with a 4.7mH series inductor, with the driving frequency shifted to allow for the change in the resonant frequency caused by the inductor.

This is with a 30-year-old transducer in which the element is a few mm below the grille on the face. I have ordered a transducer with a flat metal face, which I hope will give better results.

Edited 1 time(s). Last edit at 02/13/2014 05:46PM by dc42.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 13, 2014 06:25PM
The ones in the cans look ideal for mucky printing beds - but are a bit heavy on price! [www.rapidonline.com] have the best selection I've seen. The prices have gone up a bit since I last played with ultrasound though. Do you think it would be better to select a source with as narrow a beam angles as possible? If we want to create the maximum amount of constructive/destructive interference it seems logical to focus as much energy as possible on the transmit axis. Returns from further out in the beam pattern will have larger phase differences and dilute the effect.

I think my Source Transducer is a Murata MA40S4S which has a rather wide 80deg. beam. It has a 2.5nf capacitance hence me driving it with a maximum of 10K @40kHz Seems like it could be as simple as driving it via a resistor from any old GPIO - ideally a PWM peripheral pin.

I also noticed that Rapid have some true transceivers which are optimised for shorter ringing times. I can't see that this would help as we are talking about driving it with CW.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 13, 2014 06:56PM
Radian, thanks for the link. This one [www.rapidonline.com] looks promising because of its small size, but as you say, it is a little expensive. I have this one [uk.farnell.com] and a few others on order.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 14, 2014 08:13AM
There's a very simple way to "see" more of the interference and that's to let the transducer freewheel for half a cycle. This is easily done by driving the transducer from a GPIO pin directly via a diode. The diode blocks the negative cycle so a resistor is needed across the transducer to damp the energy but that's all there is to it.


video of it in action on Vimeo

The green trace is the 40kHz square wave (on the diode cathode) and the purple the voltage across the transducer (on the diode anode). You should be able to see how measuring the voltage across the transducer just before hitting it with the next positive half-cycle gives a snapshot of the construction/destruction of the wave at varying ranges. The most constructive signal (highest meeting point between purple and green trace) occurs around 4mm from the transducer.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 14, 2014 11:59AM
Radian, that looks promising. My new transducers arrived today so I tried two of them. The metal-cased one gave disappointing results, but a 10mm plastic one that looks similar to the one in your video is giving me 30% amplitude difference between the first minimum and the second maximum (the first maximum is too close to the transducer to be usable). This is in the same circuit I used yesterday, with a series inductor. I'll try an arrangement with a diode next.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 14, 2014 12:15PM
The diode is a neat way of "loosening" up the response but it all depends on how we want to sample the results. Right now I'm trying to make q drop-in replacement for testing, and all it consists of is a SO8 PIC (could be a 555) to generate the 40kHz and then a peak holding diode/cap directly off the transducer driven by 3K9 from the PIC. Unlike like the original IR setup, this analogue level hunts up and down but it has a unique minimum... it might even work without a change in firmware!

I looked at the timing issues relating to doing A/D on the raw signal and it would need a sample/hold. Alternatively, if it was just a "home yes/no" this could be done with the raw signal using an on-board comparator checked under interrupt on the end of the PWM cycle. But the more I thought about it, a simple diode/capacitor hold (with long time constant bleed resistor) gives a lovely smooth signal that looks ready to go.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 14, 2014 01:00PM
Hi Radian,

I tried to replicate your results with the diode and resistor, using resistors between 1K and 10K, but I couldn't get the signal to go negative at all. Looks like the capacitance of my transducer is too high for that to work.

I think I'll go ahead with the arrangement I have working, and use the attiny ADC to do synchronous detection. One slight complication is that the drive frequency is quite critical for good sensitivity and stability. So I'll use a 12MHz ceramic resonator instead of the attiny internal clock, to ensure sufficient temperature stability. Fortunately, I have just enough pins on the attiny to do this.

Edited 1 time(s). Last edit at 02/14/2014 01:00PM by dc42.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 14, 2014 04:19PM
I don't understand that; most transducers seem to be around 2.5nF. JIC I didn't describe it too well, here's a diagram of the cct I used to get a DC analogue value of the distance:



In this circuit I'm decoupling the transducer from the driver using a 3K9 resistor so it's driven on both half cycles unlike the idea I had before to decouple on the -ve half cycle. That gave a greater voltage swing but it wouldn't be so amenable to conversion to a DC level. Another advantage of this circuit is that the microprocessor isn't driving a capacitive load of a couple of nF directly but through a relatively high resistance.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 15, 2014 03:29PM
Update: Built (bodged) a prototype on a scrap of stripboard that fits in exactly the same place as the original. The PIC12F1822 simply drives the transmitter using its PWM output as per the drawing above. The peak held output provides a very similar level to the original - i.e. at a few mm above the bed, G31 gives around 600.



(The 5-way socket on the bottom edge is for a ISP lead)



The transmitter is almost in line with the extruder so better positioned for any sag in the head. Everything looks good and repeatability is excellent - except, for some reason I've yet to figure out, it repeatedly homes to +0.4mm above the bed confused smiley

All I'm doing is the regular setup procedure, so I carefully set the nozzle position exactly on the bed and zero the Z axis with G92 Z0. I then take it up to 4mm (near where I know the optimum signal maxima lies) and take a G31 reading - giving, say, 600. Then I set G31 Z4.0 P600

Every time I subsequently home the Z axis, the nozzle finishes 0.4mm off the table. So I could of course correct for this by feeding Z4.4 into G31 but it's ugly and I feel a strong desire to understand how the niggly offset comes about.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 15, 2014 05:14PM
Good to see you've got it working! I'll try out your circuit tomorrow. I've finished laying out the sensor board but there is still time to make changes. My circuit uses a 4.7mH inductor and it would be good to get rid of that if possible. Regarding your 0.4mm error, perhaps the maximum output is at 4.2mm so you are getting the same amplitude at 4.0 and 4.4mm?

Have you worked out what effect the temperature coefficient of the diode forward voltage will have?



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 15, 2014 06:20PM
I made a table of values vs. height but it's no longer valid after reducing the time constant of the peak hold. It now has 100K/1uF.

Roughly though, the reading is at an all-time minimum (say 500) at zero height, then climbs to an all-time maximum (say 650) at around 3mm. However, the Z home routine always starts above this, certainly above 4mm - so by taking a reading at 4mm, where the level is falling again (say 600) it's still at a higher level than all subsequent peaks, hence uniquely identified.

Homing doesn't seem worried that the level goes up and down to begin with, it just keeps on going slowly down as the peaks and troughs get bigger. On the final cycle, the level climbs (just like the IR) until the threshold set by G31 is met and then, voila, Z does its final fast move to... 0.4mm angry smiley

I had wondered about the time constant of the peak hold, but if the voltage level was lagging behind the actual height then the error would be minus (wouldn't it?) I mean, the head might actually be lower than the reading makes it appear to be. Er, I could with some confirmation on this as I've gotten totally confused (I'll blame it on the Beer)


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 15, 2014 07:01PM
Sorry, forgot to mention about temp.co's... the idea is to always home at a set temperature. As you pointed out, Z homing is best done when the bed is at working temperature and with the head just above the bed it seems likely to be pretty consistent. OK, its not as tight as a reference oven but I think it's much better controlled than the ambient IR issue.

I still worry that the real limiting factor is the 'less than ideal' layout on the duet PCB. A/D readings jitter by several counts without resorting to separate grounding for the sensor. I'm assuming your intention is to bypass the A/D in favour of a digital SPI type link anyway?

Now I'm wondering again about that 0.4mm offset... could it be a Doppler effect? I take the reference reading when the head is stationary. The Z homing makes continous readings as it's moving downwards. So is the velocity adding to the phase shift due to distance alone? My physics is terribly rusty.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 17, 2014 08:14AM
I've still not discovered the reason for the fixed offset. All I know is that it's highly repeatable so, for the time being, I work around it by adding whatever offset I get after homing following setting the probe point with G31 Z4 Pxxx, i.e. by following up with G31 Z4.4 Pxxx so that all subsequent homing takes it all the way down to zero.

However, IMO the overall scheme seems like a definite improvement over IR. Here's my take on the advantages:
  • Total immunity to ambient lighting
  • Eliminates the need for reflective targets on bed and X homing platform
  • 3-wire direct replacement for original Z-probe hardware
  • Works with original and future firmware that expects the IR sensor

The only issues I can see are that without firmware modification, the homing process is best performed at the working temperature of the heated bed. The closed-loop heating system then performs speed-of-sound compensation by maintaining a known ambient temperature during Z probe calibration and subsequent homing operations. This happens to be good practice anyway as the bed dimensions alter slightly at working temperature.

The "physics" seem reliable enough to me, although the Z probe readings follow that of a damped sine wave so there's a fairly tight window on the operational range in terms of distance above the bed/X-homing platform (the first 4.25mm above the bed). This isn't a problem, it's just different to the IR probe which could be referenced at almost any height, although even that was best done in the middle of the range. The relative positioning I've chosen puts the "sweet spot" at a memorable 4mm above the bed which is nice and tidy, only to be slightly uglified by the mystery offset as described above.

Oh, and the X-homing platform needs extending to reach further out to the Ultrasound source (I used some Meccano but obviously a revised X motor mount would be better). Alternatively a X-home switch can be added as per original Ormorod build.


One thing that affects both Ultrasound and IR probe readings is the grounding arrangements on the Duet PCB as already noted by dc42. The 3-wire Z-probe cable loom connects to +3.3V (not without its own noise) and logic 0V (VSS). The A/D input measures with respect to a different ground (VSSA). The net result is a reading that jitters by up to 10 counts. A 1.5V battery between the A/D input (AD7) and VSSA allowed for the cleanest measurement I could perform and the jitter fell to 3 counts max. Unfortunately both IR probe and Ultrasound need to be connected to 0V if only 3 wires are used. So it's not possible to clean up the analogue conversion.

The good news is that the Duet firmware simply does a simple "greater than" comparison - so by sampling the return signal using the 12F1822 A/D (which is referenced locally and can therefore maintain a jitter-free conversion) the PIC can do the thresholding and drive AD7 with a bang-bang level change. Going to have a stab at this next.

Edited 1 time(s). Last edit at 02/17/2014 09:00AM by Radian.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 17, 2014 03:26PM
If it is doppler that's affecting the reading as it homes, it would suggest that your driving frequency is slightly too low, so the doppler shift increase when homing is bringing the reflection closer to the transducer's resonant frequency. If however you correct the driver, the doppler will cause the reading to be lower than your static reading. I would have thought that the Z movement would be too slow for any appreciable frequency shift, but I haven't done the calculations to be sure.

I suspect that it is noise spikes from the stepper motor appearing on the signal line, causing the A/D to sense a slightly higher reading while driving the motor. Try taking a measurement while (say) driving the extruder motor.

Dave
(#106)
Re: Ultrasonic Z-height sensing?
February 17, 2014 06:25PM
Hi Dave, I'm pretty sure it's not an injected noise artifact as the readings remain constant when I dismount the sensor board from the X carriage and run the Z motor.

However, I can just about half imagine how the offset might come about given that the wave isn't simply standing still with the sensor at a fixed point within the wave, but the sensor is moving towards the reflection. However, I'm struggling to visualize the sequence and the timing to any degree of reality.

Edit: I don't know why I'm making such a meal out of this... obviously the moving sensor compresses the wave and therefore shifts the point where max. & min. are located.


RS Components Reprap Ormerod No. 481
Re: Ultrasonic Z-height sensing?
February 17, 2014 09:14PM
I've prototyped an ultrasonic height sensor. I'm driving the sensor at its series resonant frequency from an attiny PWM pin, through an inductor to reduce the 3rd and higher harmonics. I'm sampling the voltage across the transducer twice per cycle using the ADC, feeding the samples through averaging filters, and taking the difference to get the peak-to-peak value. So effectively I'm doing synchronous rectification in the mcu. Then I'm using two more PWM pins as a DAC to generate the output for the Duet. The sensor face is about 3.3mm above the nozzle (a little higher than I intended). When the nozzle is about 0.5mm above the bed, destructive interference causes the transducer impedance to rise, causing a maximum in the voltage across the transducer. I've adjusted the parameters so that this gives a G31 reading of about 570. I'm calibrating at 0.75mm height, which gives a reading of 495.

In practice, when z-homing or G31 is run, it overshoots the position a little (just as it does using the IR sensor). So I'm setting G31 P475 Z0.75 to allow for the overshoot. I had it in mind to modify the firmware to slow down the z-speed when approaching the homing point, and I'll look at this again. I can reliably perform z-homing to better then 0.05mm repeatability. I don't see the 0.4mm offset that Radian sees, or anything like it.

The above tests were done with the bed cold (temp about 21C). I then tried heating the bed to 70C. This had the unfortunate effect of reducing the voltage across the transducer, throwing the calibration too far out even to use with a speed-of-sound correction applied. Reducing the drive frequency by about 3% restored the sensitivity. I was then able to re-establish a suitable calibration point (at 1.1mm this time, higher because of the lower frequency and higher speed of sound in the warmer air), and z-homing worked reliably again So I think the issue is variation of the resonant frequency of the transducer with temperature.

I'll think about how to compensate for this, and do more tests tomorrow.



Large delta printer [miscsolutions.wordpress.com], Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Ultrasonic Z-height sensing?
February 18, 2014 10:11AM
Quote
dc42
The above tests were done with the bed cold (temp about 21C). I then tried heating the bed to 70C. This had the unfortunate effect of reducing the voltage across the transducer, throwing the calibration too far out even to use with a speed-of-sound correction applied. Reducing the drive frequency by about 3% restored the sensitivity. I was then able to re-establish a suitable calibration point (at 1.1mm this time, higher because of the lower frequency and higher speed of sound in the warmer air), and z-homing worked reliably again So I think the issue is variation of the resonant frequency of the transducer with temperature.

I'll think about how to compensate for this, and do more tests tomorrow.
This sounds very promising indeed. Maybe modulate the drive frequency at around 100Hz and 5% and take the maximum reading over each frequency variation cycle?

Dave
(#106)
Re: Ultrasonic Z-height sensing?
February 18, 2014 04:02PM
Good progress all round then :-) I do like this method of Z probing, mine's never been so reliable! Oddly I haven't found it being discussed for this particular application anywhere else, yet it seems ideal, and none too expensive.

I bought-in some more Ultrasound devices today including transceivers (optimized for both TX & RX) and some 25kHz modules - advantage: bigger window of height to work within, disadvantage: more potential audio interference.

I'm also playing around with self-oscillating drivers that naturally track the changing resonant frequency, in the hope that simply measuring frequency is all that's needed to infer height (maybe too hopeful).


RS Components Reprap Ormerod No. 481
Sorry, only registered users may post in this forum.

Click here to login