Home        Store        Learn        Blog

Read current and voltage from PSM 2

Hi, our PSM2 is not working right in QGC. So I am testing in arduino to see the value.

I connect pin 3(current), 4(voltage), and 5 (ground) to arduino zero. Input directly from bluerov battery, output directly to bluerov led. The Arduino Zero operation voltage is 3.3v.

#include <Servo.h>

Servo led;

void setup() {

void loop() {

  int voltageValue = analogRead(A0);
  int currentValue = analogRead(A1);

  float voltage = voltageValue * (3.3/ 1024.0)* 11.0;
  float current = (currentValue * (3.3/1024)-0.33)*38.8788;

  //print out the value you read:
  Serial.print("voltage: "); 
  Serial.print(", current: ");


Output is:

voltage: 1.74, current: -9.20
voltage: 1.77, current: -9.20
voltage: 1.74, current: -9.07
voltage: 1.70, current: -9.20
voltage: 1.74, current: -9.20

The raw reading:

voltage: 49.00, current: 31.00
voltage: 50.00, current: 31.00
voltage: 50.00, current: 31.00
voltage: 50.00, current: 31.00
voltage: 49.00, current: 31.00

Any suggestions? Thanks for the help.

Hi @linzhao,

What’s it doing? Is it not connecting, or giving incorrect readings or something? If you’ve got a multimeter you can follow the QGC power setup instructions to calibrate the sensor if you’re getting different results to what you expect you should.

What voltage are you actually providing to the power sense module? I’m unfortunately not familiar with how ArduSub calculates the power sense results, but based on the numbers in the Power Sense Module product page your maths seems reasonable (except the current multiplier should be 37.8788 rather than the 38.8788 that you’ve got - I’m unsure if that’s something you’ve measured and changed or just a typo).

Any chance you’ve changed analogReadResolution, or are using a non-default analogReference? If you’re using a 7-bit ADC resolution on both pins (128 samples instead of 1024) with a 3.3V reference then you’d be using 14.46V, with a current of 17.77A (if you weren’t using a thruster while measuring that’s likely too high).

Hi @EliotBR , thanks for your reply. The PSM2 issue in QGC is wrong reading. I tried calibrate the sensors. But the reading will keep the same when we are using the battery. That’s why we put the PSM out to directly connect to arduino just for test.

I also double check the 10-bit ADC and 3.3v reference voltage by


But result is same. I will order new PSM for another test.

1 Like

Fair enough. If you bought the PSM2 from us I’d suggest you contact support@bluerobotics.com and mention this forum thread. It’s good for our quality management, and if the product arrived defective or something then they should be happy to replace it for you :slight_smile: