Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCD on Arduino To read values #3

Closed
krex4 opened this issue Feb 19, 2019 · 18 comments
Closed

LCD on Arduino To read values #3

krex4 opened this issue Feb 19, 2019 · 18 comments

Comments

@krex4
Copy link

krex4 commented Feb 19, 2019

Is it possible to read vealues of measurements on a LCD ?

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@krex4
Copy link
Author

krex4 commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@martinbogo
Copy link
Owner

martinbogo commented Feb 19, 2019 via email

@martinbogo
Copy link
Owner

martinbogo commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@krex4
Copy link
Author

krex4 commented Feb 19, 2019 via email

@krex4
Copy link
Author

krex4 commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@martinbogo
Copy link
Owner

martinbogo commented Feb 19, 2019 via email

@felixfetche
Copy link

felixfetche commented Feb 19, 2019 via email

@martinbogo
Copy link
Owner

@krex4

I am now adding code to the project, that will simply display the values in a continuous loop. You will need one of the displays I have linked to on Amazon, and you will need to connect SDA/SCL correctly both to the Segway battery and the display.

I'll be adding it into a "i2c display" branch, and once I've finished it will be merged into the main codebase with a #define to enable/disable the feature.

-Martin

@rhinomods
Copy link

rhinomods commented Feb 20, 2019 via email

@krex4
Copy link
Author

krex4 commented Feb 20, 2019 via email

@martinbogo
Copy link
Owner

I believe there is a pattern to the "checksum" that involves adding the two bytes together then performing a checksum alg.

00111000 00010000 00110001 38 10 31
00111000 00010001 00110000 38 11 30
0x10+0x31 = 0x41
0x11+0x30 = 0x41

They have an identical "checksum" of 0x41 ( 65 )
This happens again here, but in a different way

10111010 00001110 00110001 BA E 31
10111010 00001111 00110000 BA F 30
0xE + 0x31 = 0x3F
0xF + 0x30 = 0x3F

Checksum is identical 0xBA ( 186 )

00111100 00000100 00111001 3C 4 39
00111100 00000110 00110111 3C 6 37
0x4 + 0x39 = 0x3D
0x6 + 0x37 = 0x3D

Checksum is identical 0x3C ( 60 )

Here are three with identical checksums:

10101010 00011001 00110110 AA 19 36
10101010 00011011 00110100 AA 1B 34
10101010 00000000 01001111 AA 0 4F

0x19 + 0x36 = 0x4F
0x1B + 0x34 = 0x4F
0x0 + 0x4F = 0x4F

Checksum is an identical 0xAA ( 170 )

SO -- this is definitely "A THING" -- the checksum is based on the addition of the first and second byte.

Then we look at values that are off by one-- and things get a bit harder to predict:

01000001 00001000 00110000 41 8 30
01000000 00001001 00110000 40 9 30
0x8+0x30 = 0x38 = 56
0x9+0x30 = 0x39 = 57

They have "checksums" that are off by one 0x41, 0x40 but the checksum is one LESS for the higher number

00101101 00011100 00110000 2D 1C 30
00101100 00011101 00110000 2C 1D 30
0x1C + 0x30 = 0x4C = 76
0x1D + 0x30 = 0x4D = 77

Again, checksums are off by one ( 2D, 2C ) but this time the checksum is one HIGHER for the higher number

10000011 00100001 01010101 83 21 55
00000010 00100010 01010101 2 22 55
21+55 = 76
22+55 = 77

This has a "checksum" that is off by more than 1, so breaks the previous pattern. 0x83 (131) and 0x2 (2)

@martinbogo
Copy link
Owner

Thanks to my friend Kristin, we have solved the checksum algorithm!

Take all bytes, add them together, then take modulo 8 and check if the value is 1. If not, there may have been an issue in packet transmission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants