Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: Debugging my Power Monitor Code

Re: Debugging my Power Monitor Code 6 years 7 months ago #16428

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352

Re: Debugging my Power Monitor Code 6 years 7 months ago #12926

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
The plot shows voltage level vs. time, just in case that's not clear. There are about 3000 measurements over the span shown.

Re: Debugging my Power Monitor Code 6 years 7 months ago #12928

  • majenko
  • majenko's Avatar
  • Offline
  • Fresh Boarder
  • Thanks received: 62
Well hunted down there, sir.

That one would have probably had me stumped for hours. But then, not used to using BASIC, and having it all handed to me on a plate with sprintf() in C, these things aren't upper-most in my debugging mind

Re: Debugging my Power Monitor Code 6 years 7 months ago #12929

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
By the way, I'm certain there are many other ways to parse the mV data into decimal volts. This was more about the process of isolating the problem, following a logical sequence.

Finding the right test case was definitely the key to understanding and solving the mystery.

Re: Debugging my Power Monitor Code 6 years 7 months ago #12932

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
Using padding in the DecimalToStr command did indeed correct the conversion problem. No more of the glitch problems but also what I thought was just measurement noise is gone too. Below is a plot similar to those that had the glitches. This plot shows a battery discharge curve; the plot shows data taken every second for nearly an hour - over 3000 measurements. Man is the curve pretty!

The curve has a bit of inflection at the right side, caused by my LM-317-based constant current load falling off below around 3 volts. If the same load had continued, the line would be nearly vertical; the battery is just about dead at that point.

Attachments:
Time to create page: 0.280 seconds