Home        Store        Learn        Blog

How can i Monitor a level signal change

Now I have a ROV with ardusub,I know that ardusub can control motors or servos with PWM,and can control delays , *That’s all output.
Now I have a level signal from my battery pack, One state is 0V, the other is 5V,How can I get this information on the upper computer?This information could be Mavlink,Or something else

Hi @qiuqiuggl,

How you achieve this depends a bit on what information you need to receive at the topside.

From a hardware perspective, the easiest way to do this would be using one of the Pixhawk AUX pins as an input, or possibly one of the ADC pins. To then get that working in software you can either create a custom version of ArduSub so that it can detect an input and send a suitable MAVLink message (of your choosing), or you can abuse the existing leak detection mechanism by setting the LEAK2_PIN parameter to AUX 5 (with an appropriate LEAK2_LOGIC value), in which case you’ll get a “Leak detected” warning when your battery level signal changes on the AUX 5 signal input pin. Note that it’s then not possible to tell the difference between a battery level notification or an actual leak.

Alternatively, if you’re using a Companion computer you could convert the battery level signal down to 3.3V (with a level shifter, or just a voltage divider from two resistors, e.g. 12kΩ and 22kΩ), in which case you could connect it to one of the Raspberry Pi GPIO pins, and run some Python code to monitor it and send a relevant MAVLink message when it changes. You could send regular BATTERY_STATUS updates, or perhaps just a STATUSTEXT for QGC to read out, as described here.

*Thanks. I forgot the leak sensor. This method is enough for me to use.What information i need is the current level of that signal is 0V or 5V.

Hi @EliotBR ,I also want to know if my signal is slightly higher than 5V(which is actually around 5.8V), it will hurt Pixhawk ? * What is the proper voltage range? :smiley:

According to the ArduPilot “Powering the Pixhawk” docs, 5.7V is the maximum operating voltage, and above that is considered critically high. It may not permanently damage the Pixhawk if 5.8V happens, but it won’t operate or draw power from that supply.