How to connect flowmeter to my hexacopter

Greetings!
My hexacopter is built for agriculture purposes. Now I need to attach a flowmeter whose job is to stop the pump when the tank which contains the liquid becomes empty. I have connected the flowmeter to AUX4. But i dont know what are the changes i need to make in the parameters.
FC: Pixhawk orange cube plus

You suggestions would really be appreciated. Thanks!!!

I’d use a companion computer for this.

You did a Google search for “arducopter flowmeter” right? And found the Wiki entry for it?

Yes i did and i followed the procedure mentioned in it. The good news is that im able to read the flow meters value and thats it.
What i want is when my 10L tank gets empty, it should trigger a fail safe but i dont know how to do this. Any suggestions?

Hi Vishal_Mendon_J,

I just want to know if you use a campanion at all for your project.

If so, you can just add a program that read the liquid level from the sensor and do something (stop the drone or return home!)

You use the battery monitor as explained in the Wiki page.

No sir I’m not using a companion computer. I’m making this copter for a client of mine. If i add a companion computer, it would unnecessarily complicate it for him.

yes i did. I gave battery monitor as 11 and it works fine. The flow meter is working and I’m able to read the values as well. But what I need is that after the tank gets empty, my pump should turn off and rtl should get triggered. Is there any parameter i can change to achieve this?

Can you tell me how the pump is connected to the flight controller?

You are acting fuel sensor like a battery sensor in that case you could check BATT_FS battery failsafe parameters and manage according to your needs.

Yea, that is fine but how to turn off the pump. Im allowed to use lua script here. I need to make some changes in the source code and build a new custom firmware

You don’t need to make source code changes to run Lua scripts.