# Z homing problem; starts printing in the air

I have a DIY 3D printer with Marlin firmware. I use an LJ12A3-4-Z/BY sensor for the Z probe. Recently I have had a ridiculous problem with Z homing.

In doing Z homing, it senses the bed, goes up, and stops, it doesn't go back to the bed...

In doing Bed leveling, it goes up without sensing the bed and in the next step goes even higher and higher.

If I ignore bed leveling, it starts printing in the air. If I still use bed leveling, the Z axis moves in long courses in every layer.

It looks like it is saving the wrong Z-axis position as home! These are some related settings that I think of:

#define Z_PROBE_OFFSET_FROM_EXTRUDER 0.25   // Z offset: -below +above  [the nozzle]


and

// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -3
#define Y_MIN_POS -3
#define Z_MIN_POS 0


and

// For M851 give a range for adjusting the Z probe offset
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20

• What changed to have this happen? Did you change anything? Have you checked and replaced cables, remounted cables to the printer board?
– 0scar
Sep 12 at 20:03
• A few months ago sth in my power supply went wrong. It fried my MKS board and stepper drivers. I replaced them and I connected power supply earth to ground because I found some current leak in the Aluminum structure of the printer... I guess that was the reason it fried my board. Since then I have this problem randomly, sometimes. But now it is happening every time! Sep 12 at 20:26
• So you have this issue since you swapped hardware, but now more frequently, did you replace the PSU and board (and stepper drivers). This does sound like a hardware failure, please check, replace and re-seat cables and connectors. Personally I would have bought another controller board and rewired the printer to be sure. This is most likely not a firmware issue.
– 0scar
Sep 13 at 8:09
• I replaced Board and drivers. didn't replace the PSU. It was happening frequently but it's been a while that happens every time and I can't print anything! still I'm not sure it is because of hardware failure only. Sep 13 at 12:42
• I have a PNP proximity sensor with a 7805 regulator... inverted logic in marlin. Using M119 z probe is open before z homing, gets triggered after, even though sensor led is off. It keeps being triggered!!! Sep 13 at 16:43