Auto Bed Leveling Inductive Sensor | Auto Bed Level Inductive Sensor For 3d Printers

Tech2C

Subscribe Here

Likes

1,658

Views

170,451

Auto Bed Level Inductive Sensor For 3d Printers

Transcript:

If you’re thinking about adding the auto bed leveling feature to your 3d printer, you’re going to need a probe, which can accurately measure the distance to the print bed at various test points. One such probe is the inductive sensor. The inductive sensor works by sensing a change in the electromagnetic field emitted from its tip when this field comes close to a metallic object, such as an aluminium print build service, the amplitude of the field changes. This change is sensed by the internal circuitry, which triggers the output sense wire. When purchasing an inductive sensor for your 3d printer. There are two common types to choose from NPN and PNP each type, also having either a normally open or normally closed switch output. These options can make choosing an inductive probe confusing, especially when NPN PNP is terminology used to describe a transistor and normally open, normally closed is terminology used to describe a relay switch position. In my opinion, it doesn’t matter which probe you choose as we can change the end, stop trigger behavior in firmware. What I believe is important is if your probe works at 5 volts. These probes have a working voltage range between 6 and 36 volts DC. That means we can’t simply plug them into our electronics. As we only supply 5 volts, therefore, you’d need to power the probe directly from a 12 volt source, which means the output sense wire will also give 12 volts. In this case. We can’t plug this output directly into our electronics as 12 volts will fry the input of the Arduino board. We would need to step down the voltage. Using a 2 resistor divider or a diode in reverse. Both methods will isolate our electronics from the 12 volts. However, there are some probes which do work at 5 volts this. PNP sensor does work at 5 volts, while us. This NPN sensor doesn’t both of these purchase from bangun and reading various forums. It seems to be random if your sensor will work at 5 volts or not, I purchased two of these PNP probes and they both work at five volts. Plus comments left on the bangle item page also mentioned they work at five volts. So it’s a good bet that this is the one to buy. These sensors also stipulate a detection distance for triggering the output usually in the millimeter range. A common detection distance is four millimeters. However, the rated distance is when sensing iron in a 3d printer. We are sensing aluminium. According to the datasheet, the sensitivity is reduced to 40% when sensing aluminium, so for a four millimeter rated probe sensing an aluminium bed. The detection distance is one point Six millimeters, But let’s take a deeper look, let’s probe no pun intended these probes using the multimeter and see what the sense wire is telling us when there is metal detected of the probe. Here we have the! PNP probe hooked up directly to five volts. I have the multimeter set to voltage DC on the automatic range as you can see, its reading virtually zero volts. I have the negative probe of the multimeter hooked up to the negative of the power supply. I have the brown wire hooked up to the plot of the positive supply. The blue wire hooked up to the negative and our sense wire is actually this black wire here coming out of the probe so to start with. I’ll show you the voltage supply. We’re looking at five volts here, okay, so we’re looking at five volts on the positive rail, and now when we probe the sense output, so there’s not, there’s no metal at the front near the Leds, not on, let’s see what we get. We’re getting zero volts, so that’s basically ground. Now, let’s place a metallic object in front of the probe and see what we get, you see. The light is now on the probe and we’re getting four point four three volts and more on the multimeter. Now these are transistor switches, so we’re looking at a diode voltage drop across the across the switch. That’s why we’re losing about 0.6 of a volt here, But four point four volts is still classified as a logic high on the Arduino. So this sensor here works at five volts. The LED is nice and right. I’ll show you that now, so you get a good look at how bright that the LED is, and we can also take a look at these sensor output when this probe isn’t activated so rather than measuring voltage across the sense output, Let’s move the multimeter across to the ohm’s range and see what we get, so we’re measuring resistance now, and as you can see, we’ve got 10k ohms. So the pro when it’s not engaged is actually pulling down the input to ground. That’s good in Marlin in the configuration dot. H file for this PNP inductive probe. We don’t need to worry about enabling the Pull-up resistor inside the Arduino as there’s already a 10k pulldown resistor inside the probe. However, I’ve tried both ways. The probe will work if the Pull-up Resistor is enabled. What you must check is the logic inverting as we go high when it sees metal, we don’t want to invert the logic, so this is set to false. However, if you have the normally closed version of the inductive probe, then the logic is inverted and you would have to set this to true so. I’ll switch it over the probe to the NPN probe. This is a little note. I’ve been using for a few months, and I know for a fact. It does not work on 5 volts so at first. I’ll show you how this probe behaves when it doesn’t work on 5 volts so again. I’ll just measure the input voltage here, so we are looking at 5 volts. I’ll measure the output sense wire from the probe when it’s not detecting any metal to see what it’s telling us and look it’s 5 volts. So by default when it’s not measuring any metallic object, it’s sending a logic high. Now let’s move a metallic object to the probe and see what happens you’ll see It’s trying to reduce the voltage down to ground, but it just doesn’t have enough juice to do it, so it’s still well and truly above the threshold voltage, so it’s still going to sense a voltage high and just showing you the brightness of the LED. It’s very dim. When we sense a metallic object, so you see that you can see that in the camera, it’s a lot brighter in the camera than it is in real life, but it’s definitely dimmer than the probe that works at five volts. Okay, for our next test. I’ve increased the voltage input to approximately 12 volts and we’ll see the behavior of this NPN probe, which didn’t work at 5 volts so again. I’ll just measure the supplier voltage to show you that it is a lot higher, so we’re looking at about eleven point. Four six volts as the input, we’ll measure the output sense wire without a metallic object near the probe, so we’re getting the exact same voltage from the supplier on the output. Now we’ll move a metallic object to the probe and see what happens look at that. The voltage has dropped to zero point six seven volts and again that zero point six. Our volts is the diode drop within the transistor, but 0.67 volts is still well within the logic low range of the Arduino, which is approximately 15 volts so that will be sensed as a logic change when a metallic object comes close to this probe. And to show you again how bright the LED is, so I’ll place a metal object close to it, and you’ll see how much brighter that is so straight away You can tell even just by the brightness of the LED. If your probe is going to work or not, five, five volts. So if you’re going to use a probe with more than five volts, you need to use a voltage divider or some other method to reduce the voltage coming out of the probe because if we just connect 12 volts directly to the Arduino or Rams board, it’s going to fry the input to the Atmega CPU. So the first thing we’ll try is this simple voltage divider. There are just two resistors here between the signal output and ground They are a 10 and 15 K Resistor. And as we know when there’s no metallic object here, its logic high, so let’s now probe in between these two resistors and see what voltage we get on the multimeter four point, nine volts. Fantastic that is a high voltage, which won’t fry the input to our Arduino mega. And, of course you’d need to wire that into some form of connector and I’ve just been using this to plug into the end. Stop minimum. Zn stop for the NPN. And here’s the other method to protect the electronics from the 12 volt signal coming out of a sense wire. We can use a diode in. Reverse that is, we’re sending the diode in this direction. So the black bar is down here actually facing the high voltage and we’re plugging this side into the Arduino input. Well, what is that going to do? Well, as we know if we probe this side of the diode, we’re getting the full 11 point 4 volts from the source, but if we probe this side of the diode, we’re getting basically nothing, so it’s going to protect the electronics, but what happens when we ground the probe? So I’ll activate this probe Now that get that going so now when we probe this side of the diode with God 0.6 volts, which is the transistor voltage drop from the probe, but that means electricity is now allow current is it allow allowed to flow in this direction? So what we setup on the Arduino is the Pull-up resistor when the Pull-up resistor is active and this side is low current with voltage is allowed to flow. Therefore, it sees this as a ground because this side will be at 5 volts, and this side is only at 0.6 so the registered aside as a logic low when the probe is not engaged and this side is high, The 5 volts is at a lower voltage in the 11 volts over here. So there is no voltage and current flowing. Therefore, it’s seen as the Pull-up resistor is still active, so it’s a logic high for the NPN probe we do need to define the pull-up resistor for the Z minimum input, and we also need to set the inverting logic to true for Z minimum as a high signal is no metal and a low signal or a ground is conducting metal. However, if you’re using the normally closed version of the probe, then you would set this to false When testing the inductive probe you can use the G-code Command m-19 to check the status of the. N stops by default. The ED stop should be open if it’s not sensing metal and it should be triggered if it is sensing metal so based on the two tests perform between the P and P sensor. I have here which does work at five volts and the NPN sensor here, which does not work at five volts. Depends on how you wire these up into the Ram’s board as we can use five volts here. I’ve simply wired up a three connector Dupont straight to this so positive on the Left negative in the center and the sensor on the right clean, easy installation, This one over here, which requires a higher voltage you’re going to need to wire out twelve volts to the brown and blue wires and then set up some form of either voltage divider to drop the output voltage from the sensor, using two resistors or using the diode in Reverse out of the sense wire to protect your electronics. So obviously it’s much easier to set up a inductive probe if it works on five volts.