<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Detailed proposal for IR sensor modulation</title>
        <description>I attach a fairly detailed proposal for modifying the hardware and firmware to support modulation of the IR sensor. I would appreciate feedback before I implement it, in particular from Ian in case RepRapPro have any similar plans.</description>
        <link>https://reprap.org/forum/read.php?340,290720,290720#msg-290720</link>
        <lastBuildDate>Wed, 20 May 2026 15:40:51 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,300560#msg-300560</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,300560#msg-300560</link>
            <description><![CDATA[ as a sideline from this discussion of relative angular displacements that could influence measurement from the z-probe, is there a reference available discussing the the transforms that are used in compensation (particularly the dissection of bed correction from x/y correction, as applied using the ormaxis.g test piece)? <br />
<br />
The reason I ask is that it is perfectly possible without bed compensation to print a perpendicular column on a sloping bed: at an extreme slope in one direction (say Y) when printing a cuboid outline, the effects are that at the bottom of the Y slope, extrusion is free but may not attach, halfway up the slope flow slows until a critical point where it becomes blocked, the nozzle moves with no extrusion (while pressure builds up) until the head moves back down the slope, where back pressure drops and there' s overextrusion, eventually, the z axis moves to the next layer and the process repeats until there's a level top - from then on, as long as the axes are perpendicular to each other, the cuboid column rises vertically, with a horizontal upper edge (one of the reasons I don't need to level the bed - I grind off the bottom layer or two anyway, since with ABS they're oversized in X and Y, as long as it sticks and the other angles are good, then the print is good). <br />
<br />
A (say) left leaning vertical columnar print would be due to either a left leaning Z support, or an interaction between Y and Z (presuming Y runs left to right in this example) - the interaction could be drag from the print head whose moment increases as the height increases (which isn't necessarily balanced depending on retraction point and pattern), belt slippage (ditto), or torsion around X (something that i had occur today when my Z runners could no longer prevent it - again, this isn't necessarily a balanced force, depending on the pattern of extrusion, an edge may be hit more in one direction than another, giving a net shift in one direction as a sum of small hits)<br />
  <br />
oops, I'm rambling - back to the question, any references discussing the transforms please ? :)<br />
,]]></description>
            <dc:creator>rayhicks</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 24 Jan 2014 18:02:57 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,300540#msg-300540</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,300540#msg-300540</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>dmould</strong><br />
One thing to consider:  When you take a reference measurement, you are measuring the distance of the nozzle from the bed, not the IR sensor.  You may think that the difference in height between the two is a fixed value so doesn't matter, but its value changes if the slope of the glass changes between prints (because the bed has moved).  So the reference height really needs to be adjusted by computing how much the bed angle (as obtained from the bed setting parameters) had added or subtracted from the nozzle/IR height difference.<br />
<br />
Dave<br />
(#106)</div></blockquote>
<br />
Very true; but I think a bigger effect is that any change in the amount of head sag will also affect the relative heights of the nozzle and sensor. The sensor would be better positioned directly in line with the nozzle.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 24 Jan 2014 16:41:13 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,300538#msg-300538</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,300538#msg-300538</link>
            <description><![CDATA[ One thing to consider:  When you take a reference measurement, you are measuring the distance of the nozzle from the bed, not the IR sensor.  You may think that the difference in height between the two is a fixed value so doesn't matter, but its value changes if the slope of the glass changes between prints (because the bed has moved).  So the reference height really needs to be adjusted by computing how much the bed angle (as obtained from the bed setting parameters) had added or subtracted from the nozzle/IR height difference.<br />
<br />
Dave<br />
(#106)]]></description>
            <dc:creator>dmould</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 24 Jan 2014 16:37:34 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,300537#msg-300537</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,300537#msg-300537</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>jmgiacalone</strong><br />
I have also stumbled upon something whilst trying to improve the hot end thermistor readings at room temperature. The arduino libraries set the default ADC resolution to 10 bits, but using <a href="http://arduino.cc/en/Reference/AnalogReadResolution" target="_blank"  rel="nofollow">analogReadResolution()</a>, we can set this to 12 bits. This gives a resolution of less than one micron with the sensor a couple of mm from the target surface.</div></blockquote>
<br />
Although that may help with the temperature readings, unfortunately it won't help with the IR sensor readings because the IR sensor input on the Duet board is picking up quite a lot of  noise, mainly from the switching regulator. See [<a href="http://forums.reprap.org/read.php?340,290720,297256#msg-297256" target="_blank"  rel="nofollow">forums.reprap.org</a>] for my findings.<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>jmgiacalone</strong><br />
I need to put another prototype together with a 3k3 resistor, as I still have a 4k3 fitted and direct sunlight does saturate the sensor. I will try and fit the extra 10u capacitor and 1k resistor across the transistor as you (dc42) suggested earlier in this thread.</div></blockquote>
<br />
3k3 is better, but to avoid saturation in direct sunlight, you would need even lower. See [<a href="http://forums.reprap.org/read.php?340,290720,297432#msg-297432" target="_blank"  rel="nofollow">forums.reprap.org</a>] for my conclusions on this matter. The 10u capacitor is already present on the original sensor board. Regarding the 1K resistor across the transistor, I think a lower value such as 470R might give even better results.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 24 Jan 2014 16:35:53 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,300522#msg-300522</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,300522#msg-300522</link>
            <description><![CDATA[ Hey guys,<br />
<br />
I have prototyped a similar setup now and run it on my test machine. Shining a 1kW halogen over it varies the readings by only +/-3, whilst the combined average (in brackets) moves around a few hundred points.<br />
<br />
I have also stumbled upon something whilst trying to improve the hot end thermistor readings at room temperature. The arduino libraries set the default ADC resolution to 10 bits, but using <a href="http://arduino.cc/en/Reference/AnalogReadResolution" target="_blank"  rel="nofollow">analogReadResolution()</a>, we can set this to 12 bits. This gives a resolution of less than one micron with the sensor a couple of mm from the target surface.<br />
<br />
I need to put another prototype together with a 3k3 resistor, as I still have a 4k3 fitted and direct sunlight does saturate the sensor. I will try and fit the extra 10u capacitor and 1k resistor across the transistor as you (dc42) suggested earlier in this thread.]]></description>
            <dc:creator>jmgiacalone</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 24 Jan 2014 16:11:45 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297955#msg-297955</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297955#msg-297955</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>kwikius</strong><br />
Great work! Sounds like a vast improvement. What version of the firmware do I need to try it? (I'm still using the original one)<br />
<br />
regards<br />
Andy</div></blockquote>
<br />
My changes are in the latest firmware on the Duet branch, however that firmware also has some incomplete changes to the stepper movement code that I think are best avoided until that work is completed. So get it from [<a href="https://github.com/dc42/RepRapFirmware/blob/duet/Release/RepRapFirmware-dc42.bin" target="_blank"  rel="nofollow">github.com</a>] instead.<br />
<br />
Btw my suggested procedure for modifying the sensor board is a little different now:<br />
<br />
- Epoxy an extra header pin on top of the board<br />
- Replace the 15K resistor by 3k3<br />
- Replace the 165R resistor by 1K<br />
- Cut the trace between the 1K resistor and the IR sensor, scrape away the solder resist, tin the copper, and solder a 51R 0603 resistor across the gap<br />
- Solder a BC817 transistor on top, collector to one pad of the 51R, emitter to one pad of the 1K, base pin floating, so that the transistor is connected in parallel with the 1K<br />
- Connect a 1K resistor from the base of the BC817 to the header pin<br />
<br />
<div id="div_3f0fb309f5c8938c9c5d798224bb0968"
     class="mod_embed_images"
     >

  

    
      
    

    <div id="imagediv_3f0fb309f5c8938c9c5d798224bb0968" class="mod_embed_images_image"
         >

    
      

      

      

      

      

      

      <noscript>
      <div>
    

    <a href="https://dl.dropboxusercontent.com/u/19369680/finalModifiedSensorBoard.jpg">
        <img src="https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FfinalModifiedSensorBoard.jpg"
             
             
             id="image_3f0fb309f5c8938c9c5d798224bb0968"
             alt="finalModifiedSensorBoard.jpg"
             title="finalModifiedSensorBoard.jpg"/>
    </a>

    
      </div>
      </noscript>
    

    </div>

    <div class="mod_embed_images_info " id="info_3f0fb309f5c8938c9c5d798224bb0968"
      >
      <a id="link_3f0fb309f5c8938c9c5d798224bb0968" href="https://dl.dropboxusercontent.com/u/19369680/finalModifiedSensorBoard.jpg">finalModifiedSensorBoard.jpg</a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('3f0fb309f5c8938c9c5d798224bb0968', 'https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FfinalModifiedSensorBoard.jpg', 'https://dl.dropboxusercontent.com/u/19369680/finalModifiedSensorBoard.jpg', 'https://reprap.org/forum/addon.php?340,module=embed_images,check_scaling=1,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FfinalModifiedSensorBoard.jpg', '', 297955, 800, 400, 'Loading image ...', false);
</script>
<br/>]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Mon, 20 Jan 2014 05:01:38 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297942#msg-297942</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297942#msg-297942</link>
            <description><![CDATA[ Great work! Sounds like a vast improvement. What version of the firmware do I need to try it? (I'm still using the original one)<br />
<br />
regards<br />
Andy]]></description>
            <dc:creator>kwikius</dc:creator>
            <category>Ormerod</category>
            <pubDate>Mon, 20 Jan 2014 04:29:01 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297933#msg-297933</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297933#msg-297933</link>
            <description><![CDATA[ Hi Treth, I think you are looking at the wrong graph. That one is for a a target at a fixed distance of 1mm where the target slides from side to side. The graph of interest here is Fig 7, which shows the collector current peaking at 1mm distance. So as long as the sensor face is at least 1mm higher than the nozzle, the reading will be monotonic with distance. Preferably it should not be much higher than this, so as to get maximum sensitivity at the calibration height.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Mon, 20 Jan 2014 04:14:41 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297904#msg-297904</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297904#msg-297904</link>
            <description><![CDATA[ @DC42 that is a great improvement. :)<br />
<br />
One final consideration is the physical position of the sensor, how high above the extruder nozzle tip is the sensor face?<br />
Looking at the Vishay data the sensor linear distance range is 2.5mm to 4.5mm, so the sensor needs to be at least 2.5mm higher than the tip.<br />
<br />
Outside of this 2.5mm to 4.5mm range the ambient IR interference will not be compensated for correctly.<br />
<br />
Sorry if you have already considered this in the design details...<br />
[attachment 25208 z-heightsensorrange.PNG]]]></description>
            <dc:creator>Treth</dc:creator>
            <category>Ormerod</category>
            <pubDate>Mon, 20 Jan 2014 02:53:08 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297728#msg-297728</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297728#msg-297728</link>
            <description><![CDATA[ I've finalised my design for a modulated sensor hacked from the original one. The schematic is attached. The main change from my original design is the addition of the 1K resistor between the collector and emitter of the transistor. This causes the IR emitter to generate a small amount of light even when the modulation control signal is off. The purpose of this is to bias the phototransistor into the linear region even when there is very little ambient IR.<br />
<br />
Adding this resistor has halved the residual sensitivity to ambient light. I can now go from no ambient IR to enough ambient IR to almost saturate the sensor when the IR is turned on, and the Z31 reading only goes up from 480 to 490. If I turn the modulation off, under the same conditions the reading goes up from 470 to 775. So the modulated sensor is 30 times less sensitive to ambient light than the unmodulated sensor. The change in reading from no light to bright light corresponds to a difference in nozzle height of just 0.05mm. I'm satisfied with this. All I need to do now is make sure I don't have direct sunlight on the white tapes when z-homing or running the bed compensation.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sun, 19 Jan 2014 15:51:43 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297432#msg-297432</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297432#msg-297432</link>
            <description><![CDATA[ The sun shone again this morning so ar last I was able to do some proper tests of the modulated sensor in sunlight.<br />
<br />
With my 3k3 load resistor and the sun shining directly on the white tape, at my 1mm nozzle G31 calibration height, the sensor saturates.<br />
<br />
If I add a 1k5 load resistor in parallel with the 3k3 (giving just over 1K total load), then the sensor no longer saturates and the reading is about 140 (510). If I then draw the blind, the reading drops to 130. This change in reading corresponds to 0.15mm change in nozzle height.<br />
<br />
So I have a few options:<br />
<br />
1. Stick with my 3k3 load resistor, which gives me readings around 430, well above the noise level. As long as I shield the white tapes from direct sunlight when z-homing or bed calibration is being performed (even if there is direct sunlight on other parts of the bed), I get consistent readings and the sensor is nowhere near saturation.<br />
<br />
2. Reduce the load resistor to 1K. The readings are less comfortably above the noise level, so I would change the software to take readings at more frequent intervals and average more of them. Also the 0.15mm error when I calibrate in direct sunlight is too much. I presume the sunlight biases the phototransistor into an operating area that is more sensitive. The software could be changed to adjust the calculated value depending on the ambient light. Unfortunately, the phototransistor in this sensor does not have its base connection brought out, so it is not possible to add an electronic bias.<br />
<br />
3. Revert to my other idea of using an attiny on the sensor board to do the modulation, and generate a single analog voltage to simulate the unmodulated sensor. The sensor board is sufficiently far away from the switching regulator in the electronics board not to pick up noise from it, so I should be able to use a lower value load resistor without getting noise problems. Do whatever correction for strong ambient light is needed in the attiny software.<br />
<br />
I'll go with (1) for now, but possibly (3) in future.<br />
<br />
After a few attempts, I succeeded in connecting a 10nF capacitor between pins 74 and 78 of the MCU. It didn't appear to reduce the noise. Nevertheless, I think adding a capacitor here (or at least the pads for one) would be wise in the next revision of the Duet board.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sun, 19 Jan 2014 06:28:58 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297420#msg-297420</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297420#msg-297420</link>
            <description><![CDATA[ Andy, I agree, a digital solution would indeed be better, using an attiny or similar on the sensor board and sending the data back to the Duet via SPI or similar. Of your other suggestions, an R-C filter right at the Duet mcu would help by averaging out the noise - that is why I would like to connect 10nF between pins 74 and 78 of the mcu. A buffer amp on the sensor board would help protect against noise capacitively coupled into the wires from the board, but would do nothing for noise that is inductively coupled.<br />
<br />
Another thing I may try is increasing the modulation and sample frequencies. Currently, the poll interval is about 6ms. If I trigger the ADC from a tick interrupt, and get it to do the conversions in the background, I can have the software average a larger number of readings, which should help average out the noise.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sun, 19 Jan 2014 05:56:52 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297329#msg-297329</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297329#msg-297329</link>
            <description><![CDATA[ It wonder if a digital solution would be best here.  The MCU has numerous options for digital IO, but as a first go you could use PWM and convert the PWM output from the sensor to analog with an RC filter (EDIT: buffer wouldnt be necessary since the RC capitor should give low impedance <s>and ideally buffer amp</s>) in the lead at the Duet end Using (say) 100 kHz PWM, which after filtering with a time constant of (say) 1/50 th sec would still give a pretty smooth output. Alternatively a buffer amp at the sensor end with say 100 R output impedance,might be more robust and improve accuracy.<br />
<br />
regards<br />
Andy]]></description>
            <dc:creator>kwikius</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sun, 19 Jan 2014 00:37:41 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297256#msg-297256</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297256#msg-297256</link>
            <description><![CDATA[ Well I looked at the waveforms on the +5V and +3.3V rails with a scope. First thing I saw was a lot of ringing at about 200MHz, several hundred mV peak to peak. As my scope only has a bandwidth of 100MHz, I reasoned it must actually be somewhat greater than I could see. I was a little suspicious of the input and output capacitors on the LM1117. The datasheet recommends 10uF tantalum at the output, but the board has 10uF ceramic and 100uf aluminium. Ceramic capacitors of that value are made with dielectrics that lose most of their specified capacitance as their rated voltage is approached, and as the parts list on KiCad doesn't give the capacitor voltage, I wondered whether a 6.3V capacitor had been used. So I tried adding 10uF tantalum right at the regulator leads. No change. I also tried a 47uF input capacitor between the regulator input and ground leads, again with no effect.<br />
<br />
Eventually I found that I could see the same 200MHz the ringing on the ground terminal of the regulator. I realised that the ringing was probably caused by resonance of the inductance of the loop formed by my scope probe and earth clip, together with the input capacitance of the probe. This loop was picking up the sharp changes in magnetic field as the switching regulator operates.<br />
<br />
I then turned my attention to the ripple I could see at 1MHz. The amplitude was 10 to 30mV p-p depending on where I looked. I realised that once again the loop formed by my scope probe and earth lead was picking up the magnetic field generated by the switching regulator, so it was hard to say how much ripple there really was. Measured at the sensor cable 3.3V and ground connections with the sensor disconnected, the ripple appears to be about 18mV.<br />
<br />
Eventually I realised that the source of the noise in the sensor readings was staring me in the face. The ground connection is at the bottom of the board, while the signal connection is right at the top. The loop formed by these cables and pcb tracks to the mcu will pick up the switching regulator magnetic field, just like my scope probe did. So the solution would be to eliminate this loop. To do this, I added a 3-way header strip at the bottom of the board, right below the existing pins used by the sensor.<br />
<br />
<div id="div_7eed649ec8237fdeeb11170431b1c0e5"
     class="mod_embed_images"
     >

  

    
      
    

    <div id="imagediv_7eed649ec8237fdeeb11170431b1c0e5" class="mod_embed_images_image"
         >

    
      

      

      

      

      

      

      <noscript>
      <div>
    

    <a href="https://dl.dropboxusercontent.com/u/19369680/SensorConnector.jpg">
        <img src="https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorConnector.jpg"
             
             
             id="image_7eed649ec8237fdeeb11170431b1c0e5"
             alt="SensorConnector.jpg"
             title="SensorConnector.jpg"/>
    </a>

    
      </div>
      </noscript>
    

    </div>

    <div class="mod_embed_images_info " id="info_7eed649ec8237fdeeb11170431b1c0e5"
      >
      <a id="link_7eed649ec8237fdeeb11170431b1c0e5" href="https://dl.dropboxusercontent.com/u/19369680/SensorConnector.jpg">SensorConnector.jpg</a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('7eed649ec8237fdeeb11170431b1c0e5', 'https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorConnector.jpg', 'https://dl.dropboxusercontent.com/u/19369680/SensorConnector.jpg', 'https://reprap.org/forum/addon.php?340,module=embed_images,check_scaling=1,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorConnector.jpg', '', 297256, 800, 400, 'Loading image ...', false);
</script>
<br />
<br />
I ran a wire from the expansion connector pin used by the sensor on the back of the board down to one of these pins, following first the pcb track from the expansion connector to the mcu, then the pcb track from the mcu ground plane area to the sensor ground pin at the bottom of the board. For good measure I routed the sensor modulation control signal similarly. I left the third header pin free.<br />
<br />
<div id="div_1269000150513a6beae968c6ff45523d"
     class="mod_embed_images"
     >

  

    
      
    

    <div id="imagediv_1269000150513a6beae968c6ff45523d" class="mod_embed_images_image"
         >

    
      

      

      

      

      

      

      <noscript>
      <div>
    

    <a href="https://dl.dropboxusercontent.com/u/19369680/SensorWireReroute.jpg">
        <img src="https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorWireReroute.jpg"
             
             
             id="image_1269000150513a6beae968c6ff45523d"
             alt="SensorWireReroute.jpg"
             title="SensorWireReroute.jpg"/>
    </a>

    
      </div>
      </noscript>
    

    </div>

    <div class="mod_embed_images_info " id="info_1269000150513a6beae968c6ff45523d"
      >
      <a id="link_1269000150513a6beae968c6ff45523d" href="https://dl.dropboxusercontent.com/u/19369680/SensorWireReroute.jpg">SensorWireReroute.jpg</a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('1269000150513a6beae968c6ff45523d', 'https://reprap.org/forum/addon.php?340,module=embed_images,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorWireReroute.jpg', 'https://dl.dropboxusercontent.com/u/19369680/SensorWireReroute.jpg', 'https://reprap.org/forum/addon.php?340,module=embed_images,check_scaling=1,url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F19369680%2FSensorWireReroute.jpg', '', 297256, 800, 400, 'Loading image ...', false);
</script>
<br />
<br />
With the sensor signal wire connected directly to the expansion connector, the reading I get from the sensor at 1mm nozzle height varies between 439 and 448. With the wire connected to the new header at the bottom of the board instead, it varies from 443 to 446. So this mod has reduced the noise by two thirds. This still isn't quote as good as I get when powering from USB only, but it is significantly better. I have some evidence that putting a 1mH inductor (a value I just happened to have lying around) in series with the 3.3V supply to the sensor reduces the noise a little more, but is isn't conclusive. I would like to try adding a 10nF capacitor between pins 74 and 78 of the mcu, but I don't have any capacitors with thin enough leads.<br/>]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sat, 18 Jan 2014 19:08:03 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,297022#msg-297022</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,297022#msg-297022</link>
            <description><![CDATA[ @dc<br />
<br />
What about ferrite beads on each of the IR Sensors wires individually, something like this: <a href="http://uk.rs-online.com/web/p/ferrite-beads/7259032/" target="_blank"  rel="nofollow">RS: 725-9032</a><br />
[attachment 25054 ferritebead.png]<br />
It has a 1mm inner dimension and 3.6mm outer and is 4.85mm long and are very cheap.<br />
<br />
We have used these in the past to reduce noise going down wires between devices like keyboards and wired devices etc basically any data lines that was getting noise etc.<br />
In some cases we have had to fit these very close to both of the ends to stop the cable becoming an antenna to noise like wireless devices and mobile phones etc. <br />
<br />
Paul]]></description>
            <dc:creator>TMD_RS436</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sat, 18 Jan 2014 10:13:50 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296948#msg-296948</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296948#msg-296948</link>
            <description><![CDATA[ I did a bit more investigation. The expansion connector has only one ground pin and it is connected to totally the wrong place to use as the ground return for analog inputs. The expansion connector really needs a separate analog ground pin near the other end. However, the ground connections along the bottom of the board go fairly directly to the processor, so the ground here should be fairly clean and good for the ground side of an analog input, provided you do not run anything off any of these ground pins that injects noise. The only things running off these grounds are the IR sensor board and the fan. The stepper drivers use a different ground return path.<br />
<br />
I've also found that if I have the 12V supply on and all the steppers and fan connected, but JP9 out (so 5V power is supplied from USB), then the noise on the analog reading goes away. So I now suspect that the problem is noise from the switching regulator getting on to the 3.3V rail. I recall that someone previously reported that he observed on a scope that noise on the 5V rail seemed to be passed through to and amplified on the 3.3V rail.<br />
<br />
I'll attach a scope and carry on with the investigation.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Sat, 18 Jan 2014 07:02:27 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296727#msg-296727</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296727#msg-296727</link>
            <description><![CDATA[ @TMD_RS436: I don't think a UV tube would affect the sensor significantly, it's the IR in the sunlight that is the problem.<br />
<br />
@Dennis, @Treth: yes, if I put an attiny or similar mcu on the sensor pcb, then I could arrange for the output to be 800 to 900 at the calibration height, thereby minimizing the effect of the Duet electronics noise on the reading. This is assuming that the 3.3V supply at the sensor board is clean enough. The attiny45 is available in a TSSOP package, which should be small enough to fit on the sensor board.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 17:55:11 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296703#msg-296703</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296703#msg-296703</link>
            <description><![CDATA[ @DC42, this all looks promising but with lots of optimising required. <br />
The following is just a thought, and probably not an appreciated one, but way back in time, well last month did you not suggest a small uC on the sensor board? You could then have complete control of the whole modulation process and signal handling (and noise?).<br />
<br />
It also is less appealing for ongoing user development, enhancements due to the specialist and expert knowledge required, so may not be approved by RepRapPro, but it could make the z-height board the equivalent of a bespoke height module.]]></description>
            <dc:creator>Treth</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 17:08:25 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296626#msg-296626</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296626#msg-296626</link>
            <description><![CDATA[ Hi DC 42<br />
Your mods to the Z sensor look quite good.<br />
It does beg the question about if it is worth re-working the small IR PCB to have an integrated sanitary system on it.<br />
With SMDs  this would work. The change would be a clean hands PCB swap.<br />
This might prove less risky than mods.<br />
<br />
Keep up the good work<br />
<br />
Dennis]]></description>
            <dc:creator>DennisCowdery</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 14:21:19 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296597#msg-296597</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296597#msg-296597</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>dc42</strong><br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong>TMD_RS436</strong><br />
@dc<br />
<br />
Why not fit the bare minimum value in series with a pre-set resistor that way you can adjust it with the arm at its maximum height and adjust it to reduce the ambient/sun light and then do the test for the Z sensor.<br />
And by having the bare minimum fixed resistor you will be protecting the emitter if you went to low with the pre-set.<br />
<br />
SMD Pre-sets are rather small.<br />
<br />
Just an idea.<br />
<br />
Paul</div></blockquote>
<br />
Could do, however I am now set up to add extra parallel load resistors into the circuit easily using a push-in connector and croc clip lead. What I really need is consistent sunlight. And to sort out the noise issue.</div></blockquote>
<br />
What about a UV tube?<br />
<br />
Paul]]></description>
            <dc:creator>TMD_RS436</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 13:43:30 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296577#msg-296577</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296577#msg-296577</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>TMD_RS436</strong><br />
@dc<br />
<br />
Why not fit the bare minimum value in series with a pre-set resistor that way you can adjust it with the arm at its maximum height and adjust it to reduce the ambient/sun light and then do the test for the Z sensor.<br />
And by having the bare minimum fixed resistor you will be protecting the emitter if you went to low with the pre-set.<br />
<br />
SMD Pre-sets are rather small.<br />
<br />
Just an idea.<br />
<br />
Paul</div></blockquote>
<br />
Could do, however I am now set up to add extra parallel load resistors into the circuit easily using a push-in connector and croc clip lead. What I really need is consistent sunlight. And to sort out the noise issue.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 13:14:33 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296560#msg-296560</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296560#msg-296560</link>
            <description><![CDATA[ @dc<br />
<br />
Why not fit the bare minimum value in series with a pre-set resistor that way you can adjust it with the arm at its maximum height and adjust it to reduce the ambient/sun light and then do the test for the Z sensor.<br />
And by having the bare minimum fixed resistor you will be protecting the emitter if you went to low with the pre-set.<br />
<br />
SMD Pre-sets are rather small.<br />
<br />
Just an idea.<br />
<br />
Paul]]></description>
            <dc:creator>TMD_RS436</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 12:52:49 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,296488#msg-296488</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,296488#msg-296488</link>
            <description><![CDATA[ Yesterday I painted the x-carriage around the sensor black, as per dmould's suggestion. I was sceptical, because even if some light either gets through the x-carriage or reflects off it, it stand to reason that ambient light reflected from the target area on the bed will also be a problem. But I felt I had to try it.<br />
<br />
Today the sun came out briefly, so I did some more tests using the modulated sensor. The bad news is that sunlight shining on the white tape under the sensor can still saturate it at 1mm nozzle height. This is even with the black paint and a 3k3 load resistor.<br />
<br />
During one of the sunny interludes, I briefly manage to do a test with a 1K resistor in parallel with the 3k3 one. This yielded two results:<br />
<br />
1. I was no longer able to saturate the sensor with direct sunlight on the bed. Of course, in summer with the sun higher, or in a more southerly country now, that might not be the case.<br />
<br />
2. The readings decreased by a factor of about 4 as expected, but the amount of noise in the reading hardly reduced at all. Going back to the 3k3 load resistor, I found that the G31 reading at 1mm varies over a range of about 8 between highest and lowest. However, if I turn off the ATX power supply, the range reduces to 2. If I disconnect all 3 motor looms and the fan loom, and turn on the ATX PSU, the jitter goes back up to 8. So it's not the motor or fan current causing the noise. I suspect that noise on either the +12V supply or generated by the switching regulator is getting into either the ground wire to the sensor or the 3.3V line. Either that, or there is noise on the 3.3V rail.<br />
<br />
I would like to reduce the load resistor from its current 3k3 value to increase the tolerance to sunlight, but the amount of noise on the signal from the sensor means that this would also reduce the signal-to-noise ratio. Unfortunately, the Duet board layout doesn't separate the analog and digital grounds, neither does it provide a ground pin close to the processor. So reducing the noise probably requires hacking the Duet board.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Fri, 17 Jan 2014 10:35:39 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,295260#msg-295260</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,295260#msg-295260</link>
            <description><![CDATA[ For the benefit of people who have not seen my other posts on the subject, I found that the IR Z sensor works far better - more consistent and almost unaffected by ambient light after I printed a black X-carriage part on which it mounts.  Black paint should achieve the same thing.  The readings go <i>way</i> down - more so than dc42's resistor mod - my reading at 1mm height over white paper is 230, and it is nowhere near saturated at 0 nozzle height (I cannot achieve a reading as high as 500 since the black housing) - with no mods to the board.  Seems that most of the problem is caused by ambient light reflections from the plastic surrounding the photo sensor.<br />
<br />
Dave<br />
(#106)]]></description>
            <dc:creator>dmould</dc:creator>
            <category>Ormerod</category>
            <pubDate>Wed, 15 Jan 2014 14:40:02 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,295255#msg-295255</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,295255#msg-295255</link>
            <description><![CDATA[ Once again, I'm delighted to see that RRP have accepted my changes and merged them into the Duet branch.<br />
<br />
I haven't moved the code to read the IR sensor (or thermistors) into an ISR yet, and I think that would require discussion with RRP first. The stepper motor drive is done under interrupt control, and any additional interrupts would have to be implemented carefully so that the timing of the steppers is not affected significantly. The variation in ambient light reading is modest, with a 60W bulb just 30cm from the sensor, and the sensor 1mm above the bed. So under more realistic conditions, I think the effect of 50Hz modulation should be almost negligible anyway.<br />
<br />
Even with the modulated IR sensor, having an incandescent desk lamp very close to the Ormerod is clearly not a good idea. Would anyone with more CAD experience than I have care to design a modified z-upper-mount to hold a LED light to illuminate the bed?]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Wed, 15 Jan 2014 14:19:45 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,294694#msg-294694</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,294694#msg-294694</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>dc42</strong><br />
....It's still a bit sensitive to ambient light, but the sensitivity has been reduced by a factor of 14.5. The practical upshot of this is that when I do a bed probe or z-axis home, the effect of having that light on is make the nozzle just over 0.1mm too high. Without modulation, having the same light on makes the nozzle 2.5mm too high.<br />
<br />
I can see that the G31 reading is more variable with the light on than off. I think this is due to 50Hz modulation in the light. If I can find the time, I'll look at running the ADC on a timer interrupt, doing conversions for the z-probe and the thermistors in the background.</div></blockquote>
Excellent, thanks DC42, that improvement is really significant reducing it to that magnitude.<br />
I'm sure you have considered this, but if you are moving it to a timer interrupt task, then synchronising to a multiple of 20mS for your averaging may help to reduce the residual variation.]]></description>
            <dc:creator>Treth</dc:creator>
            <category>Ormerod</category>
            <pubDate>Tue, 14 Jan 2014 14:25:56 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,294683#msg-294683</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,294683#msg-294683</link>
            <description><![CDATA[ I've now committed these changes to <a href="https://github.com/dc42/RepRapFirmware/tree/duet" target="_blank"  rel="nofollow">github</a> and created a pull request. The 4-wire sensor board design that RRP is working on is very similar to mine, so it should work with the same firmware.]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Tue, 14 Jan 2014 14:14:38 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,294678#msg-294678</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,294678#msg-294678</link>
            <description><![CDATA[ Alan, if your lamp uses an incandescent bulb, try replacing it with a LED or CFL bulb - that should avoid the problem.<br />
<br />
I want to push an LED light on my Ormerod, but that is so that I can see how the print is progressing. LED lighting should not affect the sensor (although I haven't checked this yet).]]></description>
            <dc:creator>dc42</dc:creator>
            <category>Ormerod</category>
            <pubDate>Tue, 14 Jan 2014 14:06:36 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,294666#msg-294666</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,294666#msg-294666</link>
            <description><![CDATA[ May be a simple suggestion but,<br />
<br />
In the process of setting up my omerod, I have also noticed this sensitivity as I have it in a darkish bit of my office near a directional lamp. Changing the angle of the lamp makes a great deal of difference. My question is would it be sensible (make any difference or be feasible enough to try) to hang a  led off the x carrier to light the area under the sensor in order to get a constant(ish) background illumination level. <br />
<br />
I am too much of a beginner to try it myself at the present. Need to do a couple of actual prints first.<br />
<br />
Alan]]></description>
            <dc:creator>alanbattersby</dc:creator>
            <category>Ormerod</category>
            <pubDate>Tue, 14 Jan 2014 13:41:21 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?340,290720,294613#msg-294613</guid>
            <title>Re: Detailed proposal for IR sensor modulation</title>
            <link>https://reprap.org/forum/read.php?340,290720,294613#msg-294613</link>
            <description><![CDATA[ Cool! We'll be testing it soon...<br />
<br />
Ian<br />
RepRapPro tech support]]></description>
            <dc:creator>reprappro</dc:creator>
            <category>Ormerod</category>
            <pubDate>Tue, 14 Jan 2014 12:23:27 -0500</pubDate>
        </item>
    </channel>
</rss>
