How to implement RTH after empty spray tank

I want to implement RTH after spray tank is empty.
I am using orange cube and qgroundcontrol.

what are you using to measure your tank level? or how do you detect it is empty? you just need a lua script to change the mode to RTH when low level is detected.

I will be using XKC-Y25 PNP Non Contact Level Sensor.
I don’t have any knwoledge of lua scripting. If you could provide any reference or script it would be great help.

Thank you

1 Like

I wrote a basic guide for a version of that sensor and using it with lua a while ago. It was the V version not the pnp so you might need to tweak the wiring and set the button function to RTL.