Power Module

Hello,

For testing purposes, I’ve my power module connected to regulated power supply and the 6 pin cables is connected to an Arduino Uno (Analog pin), I’m trying to measure voltage value like this.

I wrote this Arduino code. which would read analog pin and convert the value from 0-1023 to 0-5V.

//pin1 - current
//pin2 - voltage
int pin1 = A1;
int pin2 = A3;
float current = 0.0;
float voltage = 0.0;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
current = analogRead(pin1);
// multiply by 5/1023 to convert to volts
voltage = analogRead(pin2)*0.00488759;
//Serial.println(current);
Serial.println(voltage);
}

For a certain voltage from my regulated power supply, I get fluctuating values in Serial monitor.

Here’s the output:

My intuition here is that I would require some kind of filtering to get rid of bad datapoints.

Does anyone how this data is filtered when we see it QGroundControl?
Could anyone point out the firmware page for this code?

Given this is really an Arduino and not a PX4 question you might want to ask in an Arduino forum.

Stupid question: You have ground of the power module and the arduino connected? And you are sure to read the voltage pin and not the current pin?

Thanks for the reply,

I did not connect the ground of the power module and the Arduino, which cable would be that?
I know that cable 3 is current and cable 4 is voltage.
And I’m sure that I’m reading the voltage pin.

I’ll keep that in mind.

Pin 6 (opposite Pin 1 which is red) is GND.

And yes without GND connected you don’t have a reference to measure against, so you’re probably measuring garbage.

I got stable values for voltage now, but keep on getting a constant zero value for current, is there anything else that I need to account for?

Current is probably very low unless you run motors.

I did run the motors, but still the current value didn’t change, I connected a multimeter to see the current drawn (up to 2 amps) but the module showed a constant zero.

Is that with the scaling factor already applied? 2 amps is not much, motors spinning under load will likely draw 10+ amps each.

That was without props, and what is the scaling factor?