Endstop LED lighting, but DWC does not show them triggered



  • Hi,

    First time configuring Duet!

    Here are my specs:

    • Duet 2 wifi
    • Duet Web Control 3.1.1
    • Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.1.1 (2020-05-19b2)
    • Duet WiFi Server Version: 1.23
    • Delta printer

    My endstops are PNP(?) normally high inductive sensors, meaning untriggered=Vcc and triggered=0.
    Since Vcc is 24v, I used a voltage divider in order to bring this down to ~3.3v

    Hardware wise, the endstops work great (I think): untriggered the LED is off, and when triggered the LED turns on. So far so good!

    However in software things are for some reason not that simple. I chose "active-low" in the configurator and correctly get "not triggered" in DWC, but neither DWC nor the homing procedure recognize the endstops are hit (no indication in DWC, axis just keeps on moving).

    Here is my config.g snippet:

    M574 X2 S1 P"!xstop"                           ; configure active-high endstop for high end on X via pin !xstop
    M574 Y2 S1 P"!ystop"                           ; configure active-high endstop for high end on Y via pin !ystop
    M574 Z2 S1 P"!zstop"                           ; configure active-high endstop for high end on Z via pin !zstop
    

    Any ideas what I'm doing wrong?

    Thanks!



  • @Leav

    The code comments say "active high" but your post says "active low".

    Is the code correct and the comment just wrong?

    Frederick



  • This was straight from the web configuration tool.
    I just tried it again with all different combos and it always says "active-high"

    ; Endstops
    M574 X1 S1 P"xstop"                            ; configure active-high endstop for low end on X via pin xstop
    M574 Y1 S1 P"!ystop"                           ; configure active-high endstop for low end on Y via pin !ystop
    M574 Z1 S1 P"^zstop"                           ; configure active-high endstop for low end on Z via pin ^zstop
    

    I guess "Setting active high via invert(Xstop)" is meant to say "Setting active high by inverting the active-low sensor on xstop pin", which makes sense but is slightly confusing.



  • So I probed around a bit and for some reason my voltage divider setup is only bringing the voltage down to 1.2v instead of 0v.

    Probably enough to trigger the LEDs but not the circuit.

    I'll fix this tomorrow and report back.



  • Maybe draw us a picture, lots of seemingly contradicting bits in the posts here? Or refer to https://duet3d.dozuki.com/Wiki/Connecting_a_Z_probe#Section_PNP_output_normally_open_inductive_or_capacitive_sensor the wiring is relevant for endstops as well as probes.



  • So I traced the issue to the fact that all my endstops seem to have their pull-up resistors enabled, even though I never specified the pull-up flag.
    (I'm seeing this on all the endstop input pins)

    Any thoughts on the matter would be appreciated as I try to hunt down this issue....



  • @Leav said in Endstop LED lighting, but DWC does not show them triggered:

    So I traced the issue to the fact that all my endstops seem to have their pull-up resistors enabled

    they're physical resistors on the board.

    you need to add pull down to counteract ref post above.



  • @bearer said in Endstop LED lighting, but DWC does not show them triggered:

    they're physical resistors on the board.

    Are you sure? I was looking at the schematic and couldn't find any pull-ups and the Atmel datasheet mentions software defined pull-ups and pull-downs:

    c89235ee-230c-4f63-a972-7ab9d6165b0c-image.png
    e93483b2-20f1-40d7-bcd0-4692140ce81f-image.png
    9279a360-77bf-4015-8bee-06ec0c704c31-image.png



  • Ok this section was hiding to the side! oops!
    dfa84d8c-cde7-4429-b20e-f122f9a6daa4-image.png





  • I don't see how that would solve it... would still result in ~1.5v on the input:
    (This model is missing the internal pulldown resistor in the atmel, I think. But I don't know it's value)
    c085b16b-11d2-4dc8-9793-b85803e1504d-image.png

    edit: Looks like the internal pull-down on the Atmel is 100K nominal:
    a7425b66-de56-4ebc-ac1c-3f1c9278b254-image.png

    And obviously I'm in over my head here since I don't see how the duet design works with that "1k pullup" and the LED... Falstad Circuit Simulator says the voltage on the input would not be pulled down effectively...
    2391ee7b-6ea8-4fc6-8ed0-798950be96ff-image.png



  • Your drawing isn't correct for a PNP sensor, it would be a swtich to 24v not to ground.

    (edit: if your sensor switches to ground then its a NPN sensor and you can connect the output directly to the duet input and use the internal pull up, no external resistors required)



  • First, I would like to say thanks for supporting and trying to help - very much appreciated!

    Second, it's an NPN sensor:
    de3e7c58-6831-4073-9c10-0e7a2dc6e2d8-image.png

    I suppose I could try the diode design proposed here, but not sure I have any diodes. Is there anyway to make it work with resistors?

    Also not sure I understand why it would work, but not surprising since I don't understand any of the circuit.... (how does the LED not pull up the voltage to ~1.5v? is the falstad simulation wrong? did I draw the diagram wrong?)



  • @Leav

    If your device has an open collector output that connects to ground when active you should be able to treat it as a switch.

    Have you verified that there is a voltage on the output when simply powered up and the output is not connected to anything?

    Frederick



  • @fcwilt Hi, Yes I can confirm that when the sensor is disconnected, I get 24v when untriggered and 0v when triggered.

    Do you mean just connect it as is to the board? won't that dump ~24v into the endstop circuit? I seem to remember reading that the LEDs can only handle ~8v....



  • @Leav

    No don't connect to the board.

    I just wanted to know if the device had an pure open collector output (no pull-up resistor) - meaning it would show no voltage with the output disconnected.

    What you can do to limit the voltage to the Duet is to connect 4 diodes (example 1N4148) in series, with the anode of the first one connected to the Duet input and the cathode of the last one connected to the Duet ground. This would limit the voltage at the input to roughly 2.8 volts but should be high enough to not activate the Duet input.

    Then you would connect a 1K resistor from the output of your device to the Duet input. This resistor would limit the current to roughly 24 mA and protect the diodes but should be small enough in value to activate the Duet input.

    The diode listed is rated to 200 mA so you could use, say, a 512 resistor if the 1K does not activate the Duet input.

    Frederick



  • @Leav said in Endstop LED lighting, but DWC does not show them triggered:

    Second, it's an NPN sensor:

    you did start your thread saying it was a PNP sensor..

    i'd perhaps suggest putting up the whole model number so you can get some help checking if it does have pull ups or have been damaged. Built in pull up on a NPN sensor is both uncommon and defeats the benefit of interfacing between different voltages.



  • @bearer said in Endstop LED lighting, but DWC does not show them triggered:

    you did start your thread saying it was a PNP sensor..

    Yup, forgot about that... to save face I can say I wasn't sure and added a question mark, but I could have just checked. Apologies.

    @fcwilt said in Endstop LED lighting, but DWC does not show them triggered:

    What you can do to limit the voltage to the Duet is to connect 4 diodes

    That sounds... complicated, and I'm not sure I have any diodes. I think I'll try out alternative solutions first. might be time to just swap out to opto-endstops I have laying around somewhere.... hopefully they are 3.3v compatible...

    @bearer said in Endstop LED lighting, but DWC does not show them triggered:

    Built in pull up on a NPN sensor is both uncommon and defeats the benefit of interfacing between different voltages.

    Thanks you for mentioning this! i'm not an EE but the pull up in that sensor did give me lots of headaches! would be so much simple if it was just not connected!!



  • @fcwilt

    Hi Fredrick,

    So I found that I did have some 1N4148 diodes, but tried this circuit instead (link to circuit simulator) of what you suggested (since I wasn't sure I 100% understood you).

    In theory it should work great! in practice the voltage on the xstop pin is ~1.2v and I can't understand why!

    Any clues here would be appreciated!

    Thanks!

    c43d39d9-58ed-46d7-8ba5-3cab5f030813-image.png
    7b514ab5-e10c-4a0b-82ee-43dd96f856ac-image.png



  • Hi

    What is the output voltage of your device when you are reading the -1.2?

    And where is the ground connection of your device connected?

    Frederick



  • How about you for a second entertain the possibility the sensor is faulty and list the full model number so we can look at the specs?



  • @fcwilt said in Endstop LED lighting, but DWC does not show them triggered:

    Hi

    What is the output voltage of your device when you are reading the -1.2?

    And where is the ground connection of your device connected?

    Frederick

    Hi,

    • When the sensor outputs 24v, input is at 3.3v (diode works!)
    • When the sensor outputs 0v/GND, input is at 1.2v (positive voltage, I was using the tilda sign)
    • GND is connected to endstop GND pin (because of wiring issues, all the endstop GNDS are connected to the E0-stop GND)

    @bearer said in Endstop LED lighting, but DWC does not show them triggered:

    How about you for a second entertain the possibility the sensor is faulty and list the full model number so we can look at the specs?

    • I have 3 such sensors (delta axes), and all 3 show the same behavior.
      *** Disconnected from the board they pull down the voltage to 0.7v!** holy moly this is the problem!
    • Model number is marked as "CHE12-4NA-A710 (LJ12A3-4-Z/BX)"
    • Apologies for not including this earlier!

    I'll investigate this further to see if this is an issue in my setup or the sensor!



  • @Leav

    Well if the output of the device only goes to 0.7 volts when you add in the voltage drop across the diode you added you are up to about 1.4 volts.

    You measured 1.2 volts - so that is about right.

    If 1.2 volts is too high then you may have to use the multiple diode approach I mentioned since this would allow pulling down the input to the 0.7 volts of the device while preventing the device from pulling up the input higher than 4 diode drops - or 2.8 volts. Three diodes might be enough if 2.1 volts is sufficient to deactivate the input.

    Frederick



  • @Leav said in Endstop LED lighting, but DWC does not show them triggered:

    *** Disconnected from the board they pull down the voltage to 0.7v!** holy moly this is the problem!

    i doubt it, 0.7v across the NPN junction on the sensor is well below the logic threshold MIN [0.8V, 0.3 × VDDIO] for the input pin; but it does mean that adding a diode (another PN junction) adds another 0.7v which brings you over the threshold. Maybe a schotty diode would do the trick, but not alot of margins.

    unfortunately quick google search doesn't yield a datasheet that shows a pull up resistor in the sensor so you'd probably have to measure the value of the pull up and design your voltage divider accordingly.



  • @bearer @fcwilt

    What do you think of this setup? (proposed on reddit).

    Is there any chance of damaging the 3.3v rail with a setup like this?

    685d0aeb-8406-4a92-bccc-162aa9510324-image.png
    410e8a6f-a458-43ae-8285-b6c78f6d8711-image.png


Log in to reply