Welcome! Log In Create A New Profile

Advanced

Z height sensor - simpler improvement?

Posted by Treth 
Z height sensor - simpler improvement?
January 07, 2014 03:37AM
Having looked back through the posts related to improved z height sensing the following may be an alternative and easier to implement upgrade (I'm way behind with my other work so haven't got time to try myself, I haven't even done a print this year sad smiley )
The z height sensor is quite a good unit, but as seen is prone to being affected by ambient light.

Improvements to the sensor resistors for improved operation is a good idea and should be implemented (sorry can't find who suggested this, but your suggestion is acknowledged)

Modulating the IR system (38kHz etc) as used in remote controls has been suggested and is a good idea and would cure the stray light issue, but a simpler method that could be investigated is a simple two reading approach. I remember reading about this in Circuit Cellar magazine many years ago, but haven't seen anyone implement it. It's amazing how the brain recalls these things (eventually)!

It relies on their being minimal change in the ambient between the two readings and is simply:

IR LED OFF, read sensor, this gives simply the signal from the ambient IR.
IR LED ON read the sensor, this gives the signal from the reflection plus the ambient IR.

Then just subtract the first reading from the second to get the distance signal with the ambient cancelled out.

This relies on the sensor being linear with light intensity which they are pretty good at and as said the ambient light not changing between the two readings.

Further improvements? You could even do repeat measurements to get an average or eliminate any reading where the ambient has changed.

Any takers to try this out?


Ormerod #007 (shaken but not stirred!)
Re: Z height sensor - simpler improvement?
January 07, 2014 04:09AM
Treth, that's what I was planning to try. It still requires a hardware mod, because the IR output cannot be switched by the Duet. I haven't tried it yet because for a while I couldn't build the firmware, then when I could I was distracted getting the Ethernet working reliably. The current firmware averages 5 sensor readings AFAIR, and I was going to change that to add 3 readings with the LED on and subtract 3 readings with the LED off.



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

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Z height sensor - simpler improvement?
January 07, 2014 05:46AM
@DC42 Excellent, I missed that discussion.

I thought the discussions were around 38khz type modulation and someone had suggested putting a small uC on the sensor to do this!
This 'single cycle' modulation should be a good outcome and simple to implement as a mod for most people.


Ormerod #007 (shaken but not stirred!)
Re: Z height sensor - simpler improvement?
January 07, 2014 06:00AM
When I was unable to build the firmware, I was considering adapting an attiny board I have to produce something that was hardware-compatible with the existing sensor. It would also have made it easier to use a fixed frequency so as to reject 50/60Hz modulation in the ambient light. But now that I can build the firmware, I will try modulating the IR in firmware. As I mentioned before, a transistor will have to be added to switch the IR, because the Due output pins don't have enough current drive to do it directly.



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

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Z height sensor - simpler improvement?
January 07, 2014 06:10AM
Hi,

Thats a good idea, but then we need to have constant ambient light, especially you place your printer near window. As for artificial light, it blinks following your main power source at 50Hz or 60 Hz. I don't know if it interfere the operation of light sensor?
Re: Z height sensor - simpler improvement?
January 07, 2014 06:17AM
Quote
tru168
Hi,

Thats a good idea, but then we need to have constant ambient light, especially you place your printer near window. As for artificial light, it blinks following your main power source at 50Hz or 60 Hz. I don't know if it interfere the operation of light sensor?

That's why a dedicated processor taking continuous readings at a high rate would be better. However, I think the approach of modulating the light at an unknown and variable frequency in the firmware, along with the component changes I have already made to increase the intensity of the emitted IR, will probably be good enough. An improvement I may try is to run the ADC on a schedule triggered by an interrupt (although I would prefer to go further and rewrite the firmware to use a time-triggered architecture), so that the temperature and IR readings are taken at a consistent rate.



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

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Z height sensor - simpler improvement?
January 07, 2014 06:32AM
It might actually be possible to get some factor of 'ambient light removal'
in software only with the current set up.

Move head to Z 30
Measure Sensor (this is so high we only measure ambient IR /no reflected light)
so this is effectively very similar to a hardware mod switching off the led.

Correct Z sensor reading for measured light
Home Z

it would be possible to perhaps refine this more by having a lookup of
Z,Sensor,ambient and using this to interpolate an accurate Z height
after making 2 or more sensor readings at different Z values.

Lots of space and CPU on the controller, and adding a few seconds to Z homing to get
a really accurate value would not be a problem as it would still be a lot faster than manual Z setting

Chris
Re: Z height sensor - simpler improvement?
January 08, 2014 08:41AM
Quote
chriscain
It might actually be possible to get some factor of 'ambient light removal'
in software only with the current set up.

... snip

Chris

Good idea, Chris. The idea I think would be

(1) Take Z down using present sensor method to bring it roughly to within 3 mm.
(2) Take Z up by a large amount so there is no light reflected from the IR LED.
(3) Take several readings over at least 10mS and average them to smooth out variations in (a half-cycle of) artificial mains powered ambient light
(4) Take Z back down to a low position and then subtract the average in (3) from similar averaged readings as the head is brought down slowly to find the home position.

It will have to be ensured that the ambient light does not change over the several seconds needed to accomplish the Z movement between (3) and (4).
If I find the time to play with the firmware I'll try it myself. My fear however is that the amount of ambient light picked up by the photocell at low heights will be a lot less than that at a distance because of the shadow cast by the extruder assembly itself.

I guess a dirty workaround right now is to make a light-proof cover to put over the Ormerod whilst it does its automatic Z homing/compensation. A black bin liner would probably do the trick. I'll give that a go because making the adjustments manually before every print is beginning to become a right PITA.

Dave

Edited 1 time(s). Last edit at 01/08/2014 08:43AM by dmould.
Sorry, only registered users may post in this forum.

Click here to login