Analog float switch to Pixhawk aux ports

Hello people!

I am planning to build a UAV sprayer system that will trigger an RTL if the the liquid inside the tank reach a certain level. My idea is to install a float switch inside the tank and maybe hook up the connection to one of the aux ports of the Pixhawk. And have the FC read the pwm values of the switch with out using a companion computer.Unfortunately, I could not find the answer despite scouring the internet and wiki for information. 
Is this something you guys have come across with? If so could you gave hints as how to approach this problem? Thank you.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Paul, the problem with measuring tank contents in an aircraft is that the fluid is subject to forces outside of the aircraft's inertial frame of reference. Put simply, the fluid sloshes around. Full size aircraft face this problem. Float sensors don't work very well except on the ground. Capacitive sensors work better but you need lots of them. When I fly I ignore them and use fuel flow to calculate my remaining fuel. This is what you do when your life depends on it.

    The model jet flyers are starting to catch on, at last!! They are using fuel flow sensors.

    In your case it's not too hard. Replace your pump with a positive displacement pump, say like the ones the jet flyers use. These are a geared pump, ie. two intermeshing gears. You need a motor with a pulse output to sense revolutions. Alternatively put a pulse flow sensor in the fluid line somewhere. These can be purchased from any of the model turbine accessory suppliers or you can source yourself directly.

    Each pulse represents a fixed delivery quantity. If you know how much you started with, then any time you know how much you have left. In the case of the model turbine sensors, the accuracy is better than 10mL on a 3L tank.

    You can use a small processor to do the counting and output whatever you like to the PixHawk. An AtTiny Arduino would work just fine and be easy to program. You could also add the counting to the PixHawk code so the PixHawk interfaces directly to the pulse meter.

    Hope this helps,

    Afterthought: Add the fluid contents to the MavLink data stream so you can see it in your GCS.

  • Hi Paul.  Chris definitely has the right idea. A float would be unnecessarily heavy and complex - especially if you simply want to know when the tank is empty.  Back in the day I designed a meniscus sensor for an automated pipettor that was essentially two stainless steel wires, a 10-turn potentiometer, a couple of resistors and a small darlington transistor.  Dirt simple, adjustable for the conductivity of the liquid, highly reliable, lightweight and you can get a PWM output by feeding the circuit to something like an Arduino Trinket. You could also compensate for sloshing via soft hysteresis - tell the Arduino not to provide an output to your FC unless the tank appears empty for a solid 1 or 2 seconds.

    Introducing Trinket
    Trinket may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATtiny85, a little chip with a lot…
  • 3D Robotics

    Crop sprayer support is already built in: http://ardupilot.org/copter/docs/sprayer.html

    As for the switch you describe, there are lots of problems with your proposed method:

    1) Switches typically don't produce PWM. They're digital on/off

    2) It's very difficult to have a floating switch give accurate readings on moving tank due to sloshing, unless you have some very sophisticated baffling in the tank.  Why not go with multiple moisture sensors around the tank and average the values? 

    As for the question on how to read a sensor of any sort, an easy way is to treat them like analog sonar modules and just use trigger action based on "distance" (actually whatever you're really measuring)

    Crop Sprayer — Copter documentation
This reply was deleted.

Activity