NPN sensor problem
-
Hello guys,
I use NPN NO sensor, probe test is OK, but command M119 writes: Z: at min stop, Z probe: at min stop, I tried all the combinations, but nothing worked. Can you help me please?
; Configuration file for Duet WiFi (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.0 on Mon Aug 23 2021 16:43:59 GMT+0200 (Středoevropský letní čas) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"BLV" ; set printer name M669 K1 ; select CoreXY mode ; Network M552 S1 ; enable network M586 P0 S1 ; enable HTTP M586 P1 S0 ; disable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P0 S0 ; physical drive 0 goes forwards M569 P1 S0 ; physical drive 1 goes forwards M569 P2 S0 ; physical drive 2 goes forwards M569 P3 S0 ; physical drive 3 goes forwards M569 P4 S0 ; physical drive 4 goes forwards M584 M584 X0 Y1 Z2:4 E3 ; set drive mapping M671 X-10:155 Y300:155 S0.5 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X80.00 Y80.00 Z400.00 E420.00 ; set steps per mm M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min) M203 X9000.00 Y9000.00 Z3000.00 E6000.00 ; set maximum speeds (mm/min) M201 X1500.00 Y1500.00 Z100.00 E3000.00 ; set accelerations (mm/s^2) M906 X800 Y800 Z800 E800 I50 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X-20 Y-2 Z0 S1 ; set axis minima M208 X310 Y310 Z330 S0 ; set axis maxima ; Endstops M574 X1 S1 P"!xstop" ; configure active-high endstop for low end on X via pin xstop M574 Y2 S1 P"!ystop" ; configure active-high endstop for high end on Y via pin ystop M574 Z1 S2 ; Z-Probe M558 P5 C"!zprobe.in" H5 F120 T6000 ; set Z probe type to switch and the dive height + speeds G31 P0 X35 Y-4 Z0 ; set Z probe trigger value, offset and trigger height M557 X10:290 Y10:290 S56 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 0 as thermistor on pin bedtemp M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0 M307 H0 B0 S1.00 ; disable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C M308 S1 P"e0temp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin e0temp M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1 M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H1 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency M106 P1 S1 H1 T50 ; set fan 1 value. Thermostatic control is turned on ; Tools M563 P0 D0 H1 F0 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Custom settings are not defined ; Miscellaneous M501 ; load saved parameters from non-volatile memory
-
@petr-k said in NPN sensor problem:
M558 P5 C"!zprobe.in" H5 F120 T6000
Try
M558 P5 C"^!zprobe.in" H5 F120 T6000 -
If it thinks it's triggered when it isn't, either it's picking up noise, or the trigger signal needs to be inverted/reverted.
M558 P5 C"!zprobe.in" H5 F120 T6000
The
!
means invert the signal. If you remove that what does it report? Does it detect a trigger still?The
^
on the pin name would enable the pullup resistor.How exactly do you have the probe wired?
Can you confirm for us what your firmware version is? Post the results of sending M122 and M98 P"config.g"
-
@tecno I will try it this afternoon, thanks.
-
@phaedrux
I use Shottky diode BAT43 too and code I wil send this afternoon, thank you. -
I recently tested a number of inductive sensors and capacitive sensors.
Do you know the switching frequency of your device?
The response time of such a sensor is related to it's switching frequency. The higher the frequency the faster the response.
The best inductive sensors I tested had a switching frequency 3 kHz.
The switching frequency of the two capacitive sensors I tested was 50 Hz which gave them a slow response time, so slow that I found them unsatisfactory.
It's not that they don't work, it's just that you have to use a rather slow probing speed which makes creating high density height maps (20 x 20) a very slow and tedious experience.
The advantage of capacitive sensors is that they can work with the various flexible plate build surface systems that use magnets.
Inductive sensors can have problems with such systems.
Frederick
-
@fcwilt https://www.aliexpress.com/item/4000259928467.html?spm=a2g0s.9042311.0.0.27424c4dCecg3g I have this M20 NPN NO
-
@petr-k said in NPN sensor problem:
@fcwilt https://www.aliexpress.com/item/4000259928467.html?spm=a2g0s.9042311.0.0.27424c4dCecg3g I have this M20 NPN NO
Well that indicates it is a inductive sensor but your previously posted image mentions a capacitive sensor.
And it seems to show that the switching frequency is 500 Hz - which should be fine.
Thanks.
Frederick
-
@phaedrux said in NPN sensor problem:
M122
M122 === Diagnostics === RepRapFirmware for Duet 2 WiFi/Ethernet version 3.3 (2021-06-15 21:44:54) running on Duet WiFi 1.02 or later Board ID: 0JD0M-9P6M2-NWNS4-7J9DL-3SN6Q-TT2ZK Used output buffers: 3 of 24 (11 max) === RTOS === Static ram: 23876 Dynamic ram: 75028 of which 24 recycled Never used RAM 15488, free system stack 184 words Tasks: NETWORK(ready,13.4%,231) HEAT(delaying,0.0%,314) Move(notifyWait,0.1%,364) MAIN(running,86.2%,443) IDLE(ready,0.3%,29), total 100.0% Owned mutexes: WiFi(NETWORK) === Platform === Last reset 00:05:12 ago, cause: power up Last software reset at 2021-08-26 17:54, reason: User, GCodes spinning, available RAM 15488, slot 2 Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0041f000 BFAR 0xe000ed38 SP 0x00000000 Task MAIN Freestk 0 n/a Error status: 0x00 Step timer max interval 0 MCU temperature: min 12.6, current 20.6, max 21.0 Supply voltage: min 24.2, current 24.3, max 24.5, under voltage events: 0, over voltage events: 0, power good: yes Heap OK, handles allocated/used 0/0, heap memory allocated/used/recyclable 0/0/0, gc cycles 0 Driver 0: position 0, standstill, SG min/max not available Driver 1: position 0, standstill, SG min/max not available Driver 2: position 0, standstill, SG min/max not available Driver 3: position 0, standstill, SG min/max not available Driver 4: position 0, standstill, SG min/max not available Driver 5: position 0 Driver 6: position 0 Driver 7: position 0 Driver 8: position 0 Driver 9: position 0 Driver 10: position 0 Driver 11: position 0 Date/time: 2021-08-27 16:46:06 Cache data hit count 4294967295 Slowest loop: 2.88ms; fastest: 0.17ms I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0 === Storage === Free file entries: 10 SD card 0 detected, interface speed: 20.0MBytes/sec SD card longest read time 2.6ms, write time 0.0ms, max retries 0 === Move === DMs created 83, maxWait 0ms, bed compensation in use: none, comp offset 0.000 === MainDDARing === Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === AuxDDARing === Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === Heat === Bed heaters = 0 -1 -1 -1, chamberHeaters = -1 -1 -1 -1 === GCodes === Segments left: 0 Movement lock held by null HTTP is idle in state(s) 0 Telnet is idle in state(s) 0 File is idle in state(s) 0 USB is idle in state(s) 0 Aux is idle in state(s) 0 Trigger is idle in state(s) 0 Queue is idle in state(s) 0 LCD is idle in state(s) 0 Daemon is idle in state(s) 0 Autopause is idle in state(s) 0 Code queue is empty. === Network === Slowest loop: 15.79ms; fastest: 0.00ms Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0), 0 sessions HTTP sessions: 1 of 8 - WiFi - Network state is active WiFi module is connected to access point Failed messages: pending 0, notready 0, noresp 0 WiFi firmware version 1.23 WiFi MAC address e8:db:84:92:3c:57 WiFi Vcc 3.40, reset reason Turned on by main processor WiFi flash size 4194304, free heap 24456 WiFi IP address 192.168.1.112 WiFi signal strength -66dBm, mode none, reconnections 0, sleep mode modem Clock register ffffffff Socket states: 0 4 0 0 0 0 0 0
M98 P"config.g" HTTP is enabled on port 80 FTP is disabled TELNET is disabled Driver assignments: X0 Y1 Z2:4 E3, 3 axes visible Warning: Macro file config-override.g not found
-
@tecno said in NPN sensor problem:
M558 P5 C"^!zprobe.in" H5 F120 T6000
M119
Endstops - X: not stopped, Y: not stopped, Z: at min stop, Z probe: at min stop -
@petr-k said in NPN sensor problem:
@tecno said in NPN sensor problem:
M558 P5 C"^!zprobe.in" H5 F120 T6000
M119
Endstops - X: not stopped, Y: not stopped, Z: at min stop, Z probe: at min stopWell if the sensor was not actually triggered remove the ! character from the M558 and test again.
Frederick
-
@petr-k if it's definitely a NPN NO sensor, then this command should work:
M558 P5 C"^!zprobe.in" H5 F120 T6000
unless the senor has high leakage current. If that's the case then you might need to add a pullup resistor (e.g. 10K) between the sensor output and +3.3V or +5V. But I've not heard of this happening before.
Are you certain that it isn't a PNP output sensor?
-
@dc42 This is writes on sensor LJ20A3-10-Z/BX. Ok I will try pull-up, thanks.
-
@dc42 pullup did nothing
-
@fcwilt said in NPN sensor problem:
M558 P5 C"^!zprobe.in" H5 F120 T6000
Z probe value 1000, when triggered value is 0
-
@petr-k said in NPN sensor problem:
@fcwilt said in NPN sensor problem:
M558 P5 C"^!zprobe.in" H5 F120 T6000
Z probe value 1000, when triggered value is 0
Was that with the ! character or without?
Frederick
-
-
@petr-k said in NPN sensor problem:
Well then it should work with the ! unless the the output voltage of the sensor simply isn't meeting the logic levels needed of the input.
What is the forward voltage drop of that diode?
Did you try it without the diode?
As I recall the logic 0 voltage level for the input is appx 0.8 volts. It's possible the combination of the drop across the NPN transistor in the sensor and the diode fails to meet that logic 0 level.
Frederick
-
@fcwilt I try it without diode too, but it was the same, nothing changed.
-
@petr-k said in NPN sensor problem:
@fcwilt I try it without diode too, but it was the same, nothing changed.
Do you have a way to measure the voltage at the input to the board to verify the low (sensor triggered) and high (sensor not triggered) voltage levels
Frederick