opendps icon indicating copy to clipboard operation
opendps copied to clipboard

Voltage is off

Open danielkucera opened this issue 5 years ago • 18 comments

Today I've upgraded my DPS5005 to OpenDPS but when I set voltage, the output voltage is off. See following table:

Set,Displayed,Measured 27,25.7,25.59 20,19.04,18.94 15,14.28,14.22 10,9.53,9.48 5,4.78,4.74 3.3,3.17,3.13

I'm attaching original firmware data sets:

3.7V-off.txt 3.7V-on.txt 5V-off.txt 5V-on.txt

Is this a bug or do I need to calibrate something?

danielkucera avatar Sep 10 '19 13:09 danielkucera

You will need to run the calibration script.

The main commands you will need are:

dpsctl.py -C
dpsctl.py -cr

Pull request #120 was useful to me

If you are using the USB adapter that came with the DPS you will need to change the baudrate in your build #135 (9600 works for me)

There is a ticket to add this calibration routine information to the readme #131 (This issue also caught me by surprise when I got my DPS a week ago)

I would like to see your calibration parameters and see if they lineup with mine. If so it might be worth recording them somewhere for future users.

Mine:

Calibration Report:
	A_ADC_K = 1.67881917953
	A_ADC_C = -117.5
	A_DAC_K = 0.664585292339
	A_DAC_C = 263.0
	V_ADC_K = 13.1308298111
	V_ADC_C = -124.792572021
	V_DAC_K = 0.0761880800128
	V_DAC_C = 3.04274582863
	VIN_ADC_K = 16.7254924774
	VIN_ADC_C = 20.6332607269

JackNewman12 avatar Sep 10 '19 22:09 JackNewman12

Thanks @JackNewman12

kanflo avatar Sep 10 '19 23:09 kanflo

I'm having trouble running it:

Func       : calibration (off)
  A_DAC    : 2
  V_DAC    : 0
V_in       : 12.21 V
V_out      : 0.00 V
I_out      : 0.000 A
danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -q
Func       : calibration (off)
  A_DAC    : 2
  V_DAC    : 0
V_in       : 12.22 V
V_out      : 0.00 V
I_out      : 0.000 A
danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -C
For calibration you will need:
	A multimeter
	A known load capable of handling the required power
	A thick wire for shorting the output of the DPS
	2 stable input voltages

Please ensure nothing is connected to the output of the DPS before starting calibration!

Would you like to proceed? (y/n): y

Input Voltage Calibration:
Please hook up the first lower supply voltage to the DPS now
ensuring that the serial connection is connected after boot
Type input voltage in mV: 12250
Error: protocol error (-3).
danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -q
Func       : calibration (off)
  A_DAC    : 2
  V_DAC    : 0
V_in       : 12.22 V
V_out      : 0.00 V
I_out      : 0.000 A

danielkucera avatar Sep 11 '19 15:09 danielkucera

I switched to 9600bps, I can pass more steps but still I cannot finish the procedure. Please see attached log.

calibration.txt

danielkucera avatar Sep 11 '19 20:09 danielkucera

Could you rerun with -v so we can see the traffic on the UART?

kanflo avatar Sep 11 '19 22:09 kanflo

Here it is but I have a bad feeling that something went wrong with the device. The output voltage is 0V no matter what I set :( calib2.txt

danielkucera avatar Sep 12 '19 05:09 danielkucera

danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -q -b 9600 -v
Communicating with /dev/ttyUSB0
TX  5 bytes [7e 04 40 84 7f]
RX 48 bytes [7e 84 01 7d 5e 9d 00 00 00 00 01 ff ff ff ff 00 63 76 00 76 6f 6c 74 61 67 65 00 35 30 30 30 00 63 75 72 72 65 6e 74 00 32 30 30 30 00 38 da 7f]

Func       : cv (on)
  current  : 2000
  voltage  : 5000
V_in       : 32.41 V
V_out      : 0.00 V
I_out      : 0.000 A

danielkucera avatar Sep 12 '19 06:09 danielkucera

Curious what the calibration report -cr will show. I expect it might be corrupt. Could you dump that for me?

Can you do a --calibration_reset and see if that brings you back to your original behaviour?

Someone else might like to comment. But I believe you should be able to manually set the voltage output via dpsctl.py -c VOUT_DAC=XXX to prove the device is still working.

Enabling the debug calibration plots might be useful to ensure the maths isn't going horrifically wrong: https://github.com/kanflo/opendps/blob/94cb035bade6d2caeb58ba41b2c935aad3b995fd/dpsctl/dpsctl.py#L51-L53

Have you attempted to apply my calibration parameters and see how it behaves?

JackNewman12 avatar Sep 12 '19 06:09 JackNewman12

danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -b 9600 -v -cr
Communicating with /dev/ttyUSB0
TX  5 bytes [7e 12 32 73 7f]
RX 58 bytes [7e 92 01 00 07 07 86 00 00 00 00 00 00 3f db 43 96 c2 ed 05 1f 3f 26 e9 79 43 90 4e 35 00 00 00 00 00 00 00 00 7d 5f 80 00 00 7d 5f c0 00 00 41 86 16 fb 42 a1 07 c6 b9 73 7f]

Calibration Report:
	A_ADC_K = 1.71300005913
	A_ADC_C = -118.510002136
	A_DAC_K = 0.652000010014
	A_DAC_C = 288.610992432
	V_ADC_K = 0.0
	V_ADC_C = 0.0
	V_DAC_K = inf
	V_DAC_C = nan
	VIN_ADC_K = 16.761220932
	VIN_ADC_C = 80.5151824951
	VIN_ADC = 1926
	VOUT_ADC = 7
	IOUT_ADC = 0
	IOUT_DAC = 0
	VOUT_DAC = 0

danielkucera avatar Sep 12 '19 06:09 danielkucera

Phew... I was starting to be a little bit worried, but now it is in original state:

danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -b 9600 -v --calibration_reset
Communicating with /dev/ttyUSB0
TX  5 bytes [7e 14 52 b5 7f]
RX  6 bytes [7e 94 01 c4 0e 7f]

danman@silverhorse:/storage/Projects/opendps/dpsctl$ ./dpsctl.py -d /dev/ttyUSB0 -b 9600 -v -cr
Communicating with /dev/ttyUSB0
TX  5 bytes [7e 12 32 73 7f]
RX 56 bytes [7e 92 01 01 71 07 84 00 46 0d dd 01 6a 3f db 43 96 c2 ed 05 1f 3f 26 e9 79 43 90 4e 35 41 52 9f be c2 c9 80 83 3d 93 74 bc 3f ec cc cd 41 85 f7 cf 42 80 39 58 93 e1 7f]

Calibration Report:
	A_ADC_K = 1.71300005913
	A_ADC_C = -118.510002136
	A_DAC_K = 0.652000010014
	A_DAC_C = 288.610992432
	V_ADC_K = 13.1639995575
	V_ADC_C = -100.750999451
	V_DAC_K = 0.0719999969006
	V_DAC_C = 1.85000002384
	VIN_ADC_K = 16.7460002899
	VIN_ADC_C = 64.1119995117
	VIN_ADC = 1924
	VOUT_ADC = 369
	IOUT_ADC = 70
	IOUT_DAC = 3549
	VOUT_DAC = 362

danielkucera avatar Sep 12 '19 06:09 danielkucera

Interesting how

V_ADC_K = 0.0
V_ADC_C = 0.0
V_DAC_K = inf
V_DAC_C = nan

got written to the device. Those calibration plots might actually be helpful in this situation. I guess the maths went funky or the communication got corrupt.

JackNewman12 avatar Sep 12 '19 06:09 JackNewman12

It's strange that during all calibrations the 10% and 90% output never changed. It was always the same value (either 0mV or 4750mV)

danielkucera avatar Sep 12 '19 06:09 danielkucera

Possibly a mix of #129 or #130?

Xenoamor avatar Sep 12 '19 09:09 Xenoamor

Oh wait, so I am not supposed to disconnect my DPS from one power supply and connect to another (so it is off for a few seconds)? I don't have any other variable power supply...

danielkucera avatar Sep 12 '19 09:09 danielkucera

I've created a PR to resolve this #157. Sorry for the confusion!

Xenoamor avatar Sep 12 '19 09:09 Xenoamor

Calibration DONE. Now the output is correct. My calibration report:

Calibration Report:
	A_ADC_K = 1.79930484295
	A_ADC_C = -95.1757049561
	A_DAC_K = 0.623115241528
	A_DAC_C = 232.119384766
	V_ADC_K = 13.2031030655
	V_ADC_C = -81.2796630859
	V_DAC_K = 0.0757494047284
	V_DAC_C = -0.125067427754
	VIN_ADC_K = 16.7640190125
	VIN_ADC_C = 81.8370361328
	VIN_ADC = 1921
	VOUT_ADC = 7
	IOUT_ADC = 70
	IOUT_DAC = 0
	VOUT_DAC = 0

danielkucera avatar Sep 12 '19 16:09 danielkucera

Second calibration with 3.9Ohm resistor:

Calibration Report:
	A_ADC_K = 1.51646900177
	A_ADC_C = -61.857170105
	A_DAC_K = 0.739067077637
	A_DAC_C = 219.17300415
	V_ADC_K = 13.2118587494
	V_ADC_C = -85.1219482422
	V_DAC_K = 0.0757377296686
	V_DAC_C = -0.163032591343
	VIN_ADC_K = 16.8438606262
	VIN_ADC_C = 31.3570976257
	VIN_ADC = 1922
	VOUT_ADC = 7
	IOUT_ADC = 70
	IOUT_DAC = 0
	VOUT_DAC = 0

But it surprises me that even without load it shows 0.043A output current. Is this normal?

danielkucera avatar Sep 12 '19 20:09 danielkucera

I found that I ended up tweaking the values manually to get those perfect 0,0 intersection.

See my comment https://github.com/kanflo/opendps/issues/130#issuecomment-527873355 And #158

IOUT_ADC = 70
A_ADC_K = 1.51646900177
A_ADC_C = -61.857170105

I see your ADC is about 70 with no current (I am assuming you have no current since the voltage output is off)

So the current it reports should be: 70*1.516-61.85=44mA If this really is 0mA then just nudge the zero offset. Set dpsctl.py -c A_ADC_C=-106.12

JackNewman12 avatar Sep 12 '19 21:09 JackNewman12