TKlamp / Data-Logging-Tutorial

Quickstart on logging TKlamp Tester data to PC
https://tklamp.co
MIT License
3 stars 0 forks source link

odd results #1

Open flashlightstuff opened 4 months ago

flashlightstuff commented 4 months ago

Going over some results, something that seemed weird:

lumen candela lux
38 1141 0 0
39 1140 0 0
40 67 0 0
41 1009 0 0
42 1009 0 0

I read the serial data reference to mean that the 16-bit values are transmitted big-endian. I think bytes-to-uint16 conversion process is producing the wrong results for some inputs.

# data point 39
b = [b'\x04', b't']
o = [ord(x) for x in b]         # [4, 116]
f = [format(x, 'x') for x in o] # ['4', '74']
i = int(f[0]+f[1], 16)          # 1140
j = int.from_bytes(o, 'big')    # 1140

# data point 40
b = [b'\x04', b'\x03']
o = [ord(x) for x in b]         # [4, 3]
f = [format(x, 'x') for x in o] # ['4', '3']
i = int(f[0]+f[1], 16)          # 67
j = int.from_bytes(o, 'big')    # 1027

# data point 41
b = [b'\x03', b'\xf1']
o = [ord(x) for x in b]         # [3, 241]
f = [format(x, 'x') for x in o] # ['3', 'f1']
i = int(f[0]+f[1], 16)          # 1009
j = int.from_bytes(o, 'big')    # 1009

I'm attaching the output from tklamp.py and also the raw bytes.

Output2024-05-17-19.43.09.zip

somniummmm commented 4 months ago

Yes it is big-endian.

Does the on-device plotting also have an outlier?

flashlightstuff commented 4 months ago

I forgot I had taken this picture because it wasn't in my camera roll. It's from the same test run as the results I attached above. I don't see the outlier result in the picture. IMG_2348

somniummmm commented 4 months ago

The on-device plotting decodes the raw data separately. If there's no outliner in the raw data, the error could be introduced from the conversion.

Are you able to replicate the similar error?

flashlightstuff commented 3 months ago

Another test run with a different light. In the CSV there's a significant drop in the last 72 samples that isn't reflected in the on-device plotting. Picture included in the zip.

Output2024-05-22-20.21.26.zip