BNO-055 9DOF orientation in GLCD

Hi! I need your help guys, I’m trying to recreate this project

this is a flight instrument system using arduino mega and sensors

since I could not find a 192x64 GLCD I used 2 128x64 GLCDs. I managed to combine it to be a 128x128 GLCD.

Its my first time using a 9DOF and a GLCD but thanks to the guide in the given website I managed to split the displays in the GLCD.

in the first picture below is the artificial horizon(circled in yellow) that I want to move to the other GLCD. now in the first GLCD I managed to put the other 2 displays. the other 2 pictures are the results of editing the code. they’re currently in a breadboard.

im having difficulties in modifying the code of BNO-055 for the orientation in the GLCD. I’ve attached the code that is used for the GLCD.

I hope someone can help me. thank you! :slight_smile:

EFIS.ino (6.01 KB)

Display.ino (2.44 KB)

Gyro.ino (6.43 KB)

Hi,

jkdatoy23: im having difficulties in modifying the code of BNO-055 for the orientation in the GLCD. I've attached the code that is used for the GLCD.

What is it exactly that you have a problem with ?

I guess you have some original code which you have modified (is that Gyro.ino?), is your display a different resolution and/or flipped X,Y or ... ?

Yours, TonyWilk

TonyWilk: Hi, What is it exactly that you have a problem with ?

I guess you have some original code which you have modified (is that Gyro.ino?), is your display a different resolution and/or flipped X,Y or ... ?

Yours, TonyWilk

hi,

Yes, I modified the original code coz I have a different resolution. The original resolution is a 192x64 which is not available in my country locally. So I combined 2 128x64 to have a 128x128 resolution vertically. Now the X,Y coordinates for the project is now somehow messed up. I managed to correct the coordinates in the other displays but not in the Artificial Horizon which I moved to the other display. So when I moved the gyro sensor the horizon in the GLCD should also move.

Thank you

jkdatoy23: I modified the original code coz I have a different resolution.

If you run the original code, does the horizon work at all ? I guess it should appear somewhere on the right-hand side of your display ? (and probably on top of your other display stuff)

You can either work thru all the code and alter the coordinates or try this:

It looks like there's a small number of methods used to draw on the glcd: GLCD.DrawLine() GLCD.DrawVLine() GLCD.DrawCircle() GLCD.DrawRect()

So you could replace these with functions of your own that offset the coordinates, for example:

#define offsetX -30       // offsets for X and Y coordinates from the original code
#define offsetY  32       // to the new display

// replacement for GLCD.DrawLine() which adds in the offsets
//
void myDrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color=PIXEL_ON)
{
  GLCD.DrawLine( x1+offsetX, y1+offsetY, x2+offsetX, y2+offsetY, color );
}

// same for GLCD.DrawVLine()
//
void myDrawVLine (uint8_t x, uint8_t y, uint8_t height, uint8_t color=PIXEL_ON)
{
 GLCD.DrawVLine( x+offsetX, y+offsetY, height, color );
}

Do the same thing for all the GLCD methods that you use, then you just have to replace every GLCD.DrawLine with myDrawLine and so on.

That will probably be a lot less work than re-coding the whole thing and lets you adjust the display position of the whole graphic by just setting the offsetX and offsetY values

Yours, TonyWilk

Hi, if I run the original code the horizon doesnt work at all. I tried other codes to be sure like the clock and api and thankfully its fine.

I tried offset, I think I miss a part or something in the code. I believe it's too much for me lol but I am hopeful. I'll go through the codes again. Thank you