USB reading wrong if OLED not connected

Started by jseyfert3, August 26, 2024, 06:39:03 AM

jseyfert3

I broke out my CR again for a new project. Initially the OLED screen said about 8.5 mA of draw. I connected it via USB to my computer and used Current Viewer to plot the data. Said the same, all good so far.

The CR FAQ recommended not using the OLED when measuring via serial, so I powered off the CR, unplugged the OLED and powered it back on. Current Viewer suddenly said it was drawing only 4.1 mA, or half the draw the OLED and Current Viewer said before. I powered off the CR and put the OLED back, powered on and they were both back to reading 8.5 mA!

I connected my Fluke 115 to the output and put it in mV mode, it measured about 9.2 mV. This was the same regardless of if I had the OLED or not, and regardless of if Current Viewer showed 8.5 or 4.1 mA (depending on if the screen was connected or not). So that ruled out something weird happening with my project's power draw depending on if the OLED was connected, or powering on and off the CR, and pointed to the values coming out of the serial port changing depending on if the screen was connected or not.

Any ideas why the serial data would start reading off by a factor of about 0.5 when the OLED is not connected vs when it is?

jseyfert3

I connected to the USB Serial port. CR has firmware 1.1.3, ADC calibration has an offset of 0, gain of 2048, and LDO of 3.300. This does not change when I have the OLED connected vs not (also matches what's displayed on the OLED when the CR boots).

Felix

Can you check whether switching to AUTORANGING will resolve the halving of the readings through USB?
I should note that the raw output will/should always read the true value and anything that is output to USB is read through ADCs and then interpreted through firmware and perhaps subject to a bug.

Felix

I believe I found the problem and it was because the analog reference was not being initialized the first time except when the OLED was connected, in which case the VBAT was being read for the purpose of being displayed on the OLED and it was triggering the reference to be toggled.
I made a new release (v1.1.4) and you can replace your firmware with CurrentRanger_R3_1.1.4.UF2 but be sure to save your calibration values and set them back to what they were using the USB serial menu (send a '?' to get the full menu).
Thanks for reporting this, and I hope this is helpful.

jseyfert3

Thank you for the reply, and quick fix! I've been busy with other things as of late, but I will try upgrading the firmware here shortly. Appreciate the response!