I was using a ~$1K 3D printer through my work and got hooked. When I changed jobs, I looked for something cheap but usable to feed my addiction and settled on the TronXY P802MA, a "Prusa knock-off", because it was inexpensive, came with a heated bed and an induction Z probe sensor. A great printer by the way that has been as good or better than the more expensive one and very customizable.
The one thing I really missed was the heated glass bed. Working with the blue tape gets old very quickly. I picked up one of the inexpensive glass plates, but the inductive probe that came with the TronXY did not have enough range to work with the glass. I played around with a capacitive sensor, that worked great with the glass, but, boy was it inaccurate. I was thinking that I was going to have to go to an 18mm inductive sensor, when I saw a reference to aeropic's optical Z probe sensor and knew that I had to make one.
The original design doesn't quite fit correctly with the P802MA's metal plate holding the print head assembly, so I modified it so the lower flange sits on the same side as the main body and fits in the gap between the back plate and the mounting plate. I also extended that flange so that it connects with the X end stop sooner giving a little more room for the IR sensor cable.
Since I was modifying, I also added mounting blocks for the servo motor and a support structure for them so you don't need to print with supports.
The other change that I made was to make the arm for the servo longer and made the probe cover longer as the servo mount moves it back and over a bit.
I am using the TCST2103 IR sensor and a piece of coat hanger for the probe.
I haven't really tweaked it to get optimum performance, but initially, it is outperforming the inductive sensor with the following M48 results:
M48 Z-Probe Repeatability Test
Mean: -0.392000 Min: -0.400 Max: -0.383 Range: 0.017
Standard Deviation: 0.0061052
Lastly, a huge shout out to aeropic for the design, for using OpenSCAD (my favorite 3D design tool) and for including the OpenSCAD source files!
I added a few more supports than the original design as well as supports for the servo mounting blocks. Just cut those away.
For wiring and other instructions, see aeropic's original posting.
One suggestion is to wait to put your servo arm on until after the probe is installed, then use "M280 P0 S0" to set the servo at zero and then install the servo arm in the upright position. Then, the stow and deploy values will be 0 and 110.
In order to make this work, you have to modify the Marlin firmware to enable the servo and adjust offsets and other variables. So, the first thing I had to do was to get the TronXY working with the latest(1.19) version of Marlin. That was actually fairly painless once I realized that a couple of uncommented lines in the "official" TronXY source needed to be commented out in 1.19. Once I got it working with the inductive sensor, it was straightforward to make the necessary changes with aeropic's information.
The one change that I did have to make outside the configuration.h file, was to define a SERVO0 pin in the pins_SANGUINOLOLU_11.h file.
For anyone interested, I have included both versions of my configuration.h and the modified pins file.
For information on getting the compiled Marlin firmware onto your board, see any of the numerous posts giving suggestions. I used an AVR Dragon that I had from another project.