# Bi-directional homing with central limit switch

**URL:** <https://marlin.crc.id.au/forum/t/bi-directional-homing-with-central-limit-switch/1978>\
**Category:** General Discussion\
**Created:** [1 December 2023 11:50 UTC](https://marlin.crc.id.au/forum/t/bi-directional-homing-with-central-limit-switch/1978 "2023-12-01T11:50:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.dean](https://marlin.crc.id.au/forum/letter_avatar_proxy/v4/letter/g/9de053/32.png) [@g.dean](https://marlin.crc.id.au/forum/u/g.dean)\
**Post date:** [1 December 2023 11:50 UTC](https://marlin.crc.id.au/forum/t/bi-directional-homing-with-central-limit-switch/1978/1 "2023-12-01T11:50:29Z")

</div>

Hi,

I am currently using the marlin firmware on a CNC board and motor set up for a robotics project, rather than a 3D printer, to make use of all the pre-written functions in the G-Code. It has been working really well so far.

For my next stage, the home position must be at the centre of the linear actuator leadscrew. My idea is to place a limit switch in the central location and jog the actuator mount left or right until it reaches this spot. I have already coded this up with G1 etc.

I wondered if there was a simpler way, using G28.

For example: for the linear actuator X, if the user could feed in G28 X\_1 to home from the right towards the centre, and feed in X\_2 to home from the left towards the centre.

I have tried to implement this, but it seems that two limit switches are required - could I essentially just split my limit switch wires and do a hardware fix, or does anyone know a better software fix?

Thanks so much!

---

<div class="post-metadata">

**Author:** ![jordanarthur](https://marlin.crc.id.au/forum/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jordanarthur](https://marlin.crc.id.au/forum/u/jordanarthur)\
**Post date:** [9 February 2026 00:02 UTC](https://marlin.crc.id.au/forum/t/bi-directional-homing-with-central-limit-switch/1978/2 "2026-02-09T00:02:31Z")

</div>

> [@g.dean](#):
>
> I am currently using the marlin firmware on a CNC board and motor set up for a robotics project, rather than a 3D printer, to make use of all the pre-written functions in the G-Code. It has been working really well so far.
> 
> For my next stage, the home position must be at the centre of the linear actuator leadscrew. My idea is to place a limit switch in the central location and jog the actuator mount left or right until it reaches this spot. I have already coded this up with G1 etc.
> 
> I wondered if there was a simpler way, using G28.
> 
> For example: for the linear actuator X, if the user could feed in G28 X\_1 to home from the right towards the centre, and feed in X\_2 to home from the left towards the centre.
> 
> I have tried to implement this, but it seems that two limit switches are required - could I essentially just split my limit switch wires and do a hardware fix, or does anyone know a better software fix?

Short answer: **splitting the limit switch wires is not recommended** , and Marlin isn’t really designed to interpret _direction-based homing_ from a single switch via `G28`.
