<p>I am getting a 24&nbsp;V based Ender 3. From the factory, it has an aluminium bed. So I also put this <a href="https://www.amazon.de/gp/product/B071ZQ6VV6/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1" rel="noreferrer">LJ12 A3-4-Z/BX Inductive NPN NO 4 mm</a> with 6-36&nbsp;V operation current into the box together with a few other spare parts. Now, as I read up on these things something dawns on me: The normal input and output voltage of a simple switch is 5&nbsp;V, as sensors are ran on 5&nbsp;V on most boards (and in digital logics). The sensors run on 6&nbsp;V plus though.</p>

<p>I do not want to fry my machine by putting in 24&nbsp;V into the sensor input: What do I have to do (besides making a mount)?</p>

[{'answer_id': 6359, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 5, 'selected': True, 'text': '<p>The inductive sensors work better when you apply a higher voltage than 5&nbsp;V. Usually they are rated for 6-36&nbsp;V, but please do check.</p>\n\n<p>To prevent frying your board when connecting the sensor to (12 or) 24 Volts you could optically isolate the 5&nbsp;V and the (12 or) 24&nbsp;V circuit with an OptoCoupler module:</p>\n\n<p><em>Image of an optocoupler module</em><br>\n<a href="https://i.stack.imgur.com/Xfrlg.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Xfrlg.jpg" alt="OptoCoupler module"></a></p>\n\n<p>This module uses an optical switch based on the output of the sensor and should be correctly connected:</p>\n\n<p><em>Image of connecting an optocoupler module to the sensor and to the board</em><br>\n<sub>Please note that the image uses a capacitive sensor rather than a inductive sensor, both are connected similarly</sub>\n<a href="https://i.stack.imgur.com/munY6.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/munY6.jpg" alt="wiring of an optocoupler module"></a></p>\n\n<p>Note that there are many sorts of sensors, a few are listed <a href="https://3dprint.wiki/reprap/anet/a8/improvement/autobedleveling#sensor_support" rel="noreferrer">here</a>. Generally speaking, the larger the diameter of the sensor, the larger the detection distance to the bed. Note that these work well with metal beds (Iron/steel better than Aluminium), but will not work for glass (capacitive sensors work on glass but are prone to drift by moisture in the air, a touch sensor may then be a better alternative).</p>\n'}, {'answer_id': 6368, 'author': '0scar', 'author_id': 5740, 'author_profile': 'https://3dprinting.stackexchange.com/users/5740', 'pm_score': 2, 'selected': False, 'text': '<p>Another possibility is to create a <a href="https://en.wikipedia.org/wiki/Voltage_divider" rel="nofollow noreferrer">voltage divider</a> circuit. </p>\n\n<blockquote>\n  <p>In electronics, a voltage divider (also known as a potential divider)\n  is a passive linear circuit that produces an output voltage (V<sub>out</sub>)\n  that is a fraction of its input voltage (V<sub>in</sub>). Voltage division is \n  the result of distributing the input voltage among the components of the\n  divider. A simple example of a voltage divider is two resistors\n  connected in series, with the input voltage applied across the\n  resistor pair and the output voltage emerging from the connection\n  between them.</p>\n</blockquote>\n\n<p>Note that fluctuating voltages of the power supply can have side effects that the voltage of the divider is either too low or high for the pin and could result in either a detection miss or could burn the on board processor. </p>\n\n<p>A voltage divider based on 12&nbsp;V is depicted below based on <a href="https://mertarauh.com/2017/01/18/dont-trust-the-internet-and-how-to-add-an-inductive-proximity-sensor-to-your-3d-printer-the-proper-and-easiest-way" rel="nofollow noreferrer">this source</a>:</p>\n\n<p><a href="https://i.stack.imgur.com/6HSYk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6HSYk.png" alt="12 V voltage divider"></a></p>\n\n<p>Please note that for different voltage you require a different value, e.g. for 24&nbsp;V you would require (<a href="http://www.ohmslawcalculator.com/voltage-divider-calculator" rel="nofollow noreferrer">by calculation</a>) a 2.63&nbsp;k&#8486; resistor (which does not exist, so put two resistors in <a href="https://en.wikipedia.org/wiki/Series_and_parallel_circuits" rel="nofollow noreferrer">series</a>; a 2.2&nbsp;k&#8486; and a 430&nbsp;&#8486; to get that value).</p>\n\n<hr>\n\n<p><em>NOTE:<br>This is posted as a separate answer as the question by the OP can be answered by different solutions; this solution uses a totally different approach than my other answer. It is up to the OP to decide which of the answers suits the OP best. This is not in contrast to the SE approach as can be taken from various Meta questions on this topic. To incorporated this answer into the other answer (with multiple ways under captions) is per definition not better than having various answers; different solutions should be in different answers so that they can be voted independently of each other</em></p>\n'}, {'answer_id': 10265, 'author': 'JPC', 'author_id': 16758, 'author_profile': 'https://3dprinting.stackexchange.com/users/16758', 'pm_score': 2, 'selected': False, 'text': '<p><strong>Minimalist Solution</strong></p>\n\n<p>The very simplest possible implementation is to use a single resistor(!) to protect the input pin, as described in this <a href="https://scienceprog.com/using-current-limiting-resistors-on-avr-io-pins/" rel="nofollow noreferrer">source</a>. The AVR inputs are protected from over/under voltage by internal silicon diodes D1 and D2. The input resistor must be sized such that it will conduct no more than 1 mA when the internal clamping diode, D1, conducts at Vcc+0.5V, or 5.5V in this case. A 22K resistor could work in this case if we use our 24V supply for the sensor. Our current through the clamping diode is calculated by Ohm\'s Law as (24V - 5.5V)/22K = 0.84 mA.</p>\n\n<p>There is no reason, in this case, to cut so close to the bone though. We do not need particularly high speed detection for this application, so a 100K resistor would be a better choice, and limits diode D1 to 0.19 mA. This gives additional protection for voltage spikes.</p>\n\n<p>This solution works well until the internal diode gets fried by a spike or surge, so it is much better to add redundancy, and use a pair of external Schottky clamping diodes, which have a lower forward voltage drop and will conduct before the internal silicon diodes.</p>\n\n<p>So, my solution, (the one I plan to implement soon on my own Ender 3 Pro*), is from <a href="https://scienceprog.com/using-current-limiting-resistors-on-avr-io-pins/" rel="nofollow noreferrer">this source article</a> and looks like this:</p>\n\n<p><a href="https://i.stack.imgur.com/Iudxx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Iudxx.png" alt="Circuit diagram showing protection diodes for AVR input"></a></p>\n\n<p>Where R1, D3, and D4 are my external components as described, and C1 is omitted for simplicity. (If C1 is used, it forms a low-pass RC filter, so you\'d need to size it appropriately. If we find that noise or \'bounce\' is an issue, we can add C1 easily later.)</p>\n\n<p>In my opinion a single 100K resistor and two Schottky diodes are adequate protection for this circuit, and the 6-36V proximity sensor will work very well on the available 24V supply.</p>\n\n<p>*Based on the first comment to this proposed solution, I recognize the need to look carefully at the failsafe property here. Depending on whether the existing Z endstop is included in the loop, and how Marlin handles this too will determine whether this is a satisfactory solution.\nI\'ll leave my part of the discussion there for now, until I get closer to design and implementation on my own machine.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/6358', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/8884/']