# Power Module

**URL:** <https://discuss.px4.io/t/power-module/9328>\
**Category:** Uncategorized\
**Created:** [January 23, 2019, 10:55pm UTC](https://discuss.px4.io/t/power-module/9328 "2019-01-23T22:55:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 23, 2019, 10:55pm UTC](https://discuss.px4.io/t/power-module/9328/1 "2019-01-23T22:55:54Z")

</div>

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.

 ![](https://discuss.px4.io/uploads/default/original/2X/8/8c7a03d6bd3dc71ecad58f78b58969f359107c8d.png)

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](https://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:

 ![](https://discuss.px4.io/uploads/default/original/2X/5/509ccc4e76d5bfc54dc7432b9fa068f6016081e8.png)

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?

---

<div class="post-metadata">

**Author:** ![LorenzMeier](https://discuss.px4.io/user_avatar/discuss.px4.io/lorenzmeier/32/17_2.png) [@LorenzMeier](https://discuss.px4.io/u/LorenzMeier)\
**Post date:** [January 24, 2019, 10:42am UTC](https://discuss.px4.io/t/power-module/9328/2 "2019-01-24T10:42:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [January 24, 2019, 12:17pm UTC](https://discuss.px4.io/t/power-module/9328/3 "2019-01-24T12:17:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 27, 2019, 9:29pm UTC](https://discuss.px4.io/t/power-module/9328/4 "2019-01-27T21:29:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 27, 2019, 9:29pm UTC](https://discuss.px4.io/t/power-module/9328/5 "2019-01-27T21:29:51Z")

</div>

I’ll keep that in mind.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [January 28, 2019, 7:29am UTC](https://discuss.px4.io/t/power-module/9328/6 "2019-01-28T07:29:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 28, 2019, 8:00pm UTC](https://discuss.px4.io/t/power-module/9328/7 "2019-01-28T20:00:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [January 29, 2019, 9:58am UTC](https://discuss.px4.io/t/power-module/9328/8 "2019-01-29T09:58:25Z")

</div>

Current is probably very low unless you run motors.

---

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 30, 2019, 12:21pm UTC](https://discuss.px4.io/t/power-module/9328/9 "2019-01-30T12:21:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [January 30, 2019, 12:30pm UTC](https://discuss.px4.io/t/power-module/9328/10 "2019-01-30T12:30:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Darshan\_Jain](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/b9e5f3/32.png) [@Darshan\_Jain](https://discuss.px4.io/u/Darshan_Jain)\
**Post date:** [January 30, 2019, 1:08pm UTC](https://discuss.px4.io/t/power-module/9328/11 "2019-01-30T13:08:52Z")

</div>

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