Honda Insight Forum banner
41 - 60 of 94 Posts

Engine-Off-Coast
Joined
2,372 Posts
Where I've gotten now is I can control text elements like the version info, but I still can't change the value of other elements.

There's another way the data can be formatted using bytes instead of the strings seen here. I'll look into that next and see if that lets me update bar graphs and numbers.



Code:
//Copyright 2021-2022(c) John Sullivan
//github.com/doppelhub/Honda_Insight_LiBCM

//LiDisplay (HMI) Serial Functions

#include "libcm.h"

bool versionAlreadyDisplayed = false;
uint8_t LiDisplayElementToUpdate = 0;
const String typeMap[3] = {
    "j", "n", "t"
};
const String attrMap[2] = {
    "txt", "val"
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void LiDisplay_begin(void)
{
    #ifdef LIDISPLAY_CONNECTED
         Serial.print(F("\nLiDisplay BEGIN"));
        Serial1.begin(9600,SERIAL_8E1);

        LiDisplayElementToUpdate = 0;

/*  Serial1.print("page0.j0.val=" + String('"') + String(SoC_getBatteryStateNow_percent()) + String('"'));
  Serial1.write(0xFF);
  Serial1.write(0xFF);
  Serial1.write(0xFF); */

  //LiDisplay_writeByte(SoC_getBatteryStateNow_percent());
    #endif
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void LiDisplay_updateElement(uint8_t page, uint8_t elementTypeIndex, uint8_t elementId, uint8_t elementAttrIndex, String value) {
    #ifdef LIDISPLAY_CONNECTED
        static String LiDisplay_Data_Str;
        LiDisplay_Data_Str = "page" + String(page) + "." + typeMap[elementTypeIndex] + elementId + "." + attrMap[elementAttrIndex] + "=" + String('"') + value + String('"');
        Serial1.print(LiDisplay_Data_Str);
        Serial1.write(0xFF);
        Serial1.write(0xFF);
        Serial1.write(0xFF);
    /*
        Serial1.print("page0.t1.txt=" + String('"') + String(FW_VERSION) + String('"'));
        Serial1.write(0xFF);
        Serial1.write(0xFF);
        Serial1.write(0xFF);
        Serial1.print("page0.n0.val=" + String('"') + String(SoC_getBatteryStateNow_percent()) + String('"'));
        Serial1.write(0xFF);
        Serial1.write(0xFF);
        Serial1.write(0xFF);
    */
    #endif
}

void LiDisplay_refresh(void)
{
    #ifdef LIDISPLAY_CONNECTED

        //static uint8_t LiDisplayElementToUpdate = LCDUPDATE_NUMERRORS; //init round-robin with least likely state to have changed
        static uint32_t millis_previous = 0;

        #define LIDISPLAY_UPDATE_RATE_MILLIS 256 //one element is updated each time

        if(millis() - millis_previous > LIDISPLAY_UPDATE_RATE_MILLIS)
        {
            millis_previous = millis();

            switch(LiDisplayElementToUpdate)
            {
                case 0:
                    //LiDisplay_updateElement(0, 1, 0, 1, String(SoC_getBatteryStateNow_percent()));
                    LiDisplay_updateElement(0, 2, 1, 0, String(FW_VERSION));
                    break;
                case 1:
                    //LiDisplay_updateElement(0, 2, 1, 0, String(555));
                    LiDisplay_updateElement(0, 1, 0, 1, String(SoC_getBatteryStateNow_percent()));
                    break;
                case 2:
                    //LiDisplay_updateElement(0, 2, 1, 0, String(666));
                    LiDisplay_updateElement(0, 0, 0, 1, String(SoC_getBatteryStateNow_percent()));
                    break;
            }

            LiDisplayElementToUpdate += 1;

            if (LiDisplayElementToUpdate > 2) {
                LiDisplayElementToUpdate = 0;
            }

            /*
            uint8_t updateAttempts = 0;
            do
            {
                if( (++LiDisplayElementToUpdate) > LIDISPLAYUPDATE_MAX_VALUE ) { LiDisplayElementToUpdate = 1; } //reset to first element
                updateAttempts++;
            } while( (lcd_updateValue(LiDisplayElementToUpdate) == SCREEN_DIDNT_UPDATE) && (updateAttempts < MAX_LIDISPLAYUPDATE_ATTEMPTS) );
            */
        }

    #endif
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uint8_t LiDisplay_bytesAvailableForWrite(void)
{
  return Serial1.availableForWrite();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uint8_t LiDisplay_writeByte(uint8_t data)
{
  Serial1.write(data);
  return data;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uint8_t LiDisplay_readByte(void)
{
  return Serial1.read();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uint8_t LiDisplay_bytesAvailableToRead()
{
  return Serial1.available();
}
 

Linsight Designer
Joined
3,892 Posts
Discussion Starter · #42 ·
Great to see some tinkering here. Eventually LiBCM will need to communicate by sending bytes instead of strings, to minimize data transfer. For now you can go either way. If you're still having trouble getting it all to work, make a branch and send me a link... I'll see how it works on my end.
 

Engine-Off-Coast
Joined
2,372 Posts
Television set Bumper Gadget Automotive exterior Gas


Very beginnings... I finally got it to edit the values of more than just text boxes. Now that it works I can start making us an actual UI.

I'm thinking 5 screens:
  • Splash On
  • Grid Charging
  • Driving
  • Configuration
  • Splash Off

Different stuff could be displayed on each. Splash Off for example might display version number, hours left, and KW used during most recent drive cycle. Splash On might display version, hours left, and KW charged or energy consumption (from fan) during the period since last key-off.
 

Registered
Joined
814 Posts
Where it's at now. Still lots of work to be done.
It's so cool, building "dashboards" like this. I did dozen and dozens of business/manufacturing ones.

If I may make a humble suggestion: Consider the type of information a car's dashboard displays (the G1 has one of the best). It simultaneously shows you something of the past, present, and future and allows you to assess past performance and predict the future. Some of that information is in detail and some in general. But... When deciding what to display, most people tend to focus on the here-and-now. That's minimal use. To really get the most out of the information you need to develop ways to cast into the near (and perhaps far) past and future and present it in a non-psychotic manner.

It's so enjoyable to render the complex into the useful and immediately understandable. Have fun!
 

Engine-Off-Coast
Joined
2,372 Posts
So far most of my efforts have been spent on getting the functionality down... have it turn on when car on, show splash then, and same with when car turned off, update data while driving without getting hung up, etc.

I haven't given a lot of thought to what parameters I want to display, but I've had a few ideas.

I'm assuming the stock instrument cluster was NHTSA approved, so I want to borrow ideas from it. Font, text size, colours used, black background, etc. Because the Nextion can do so much more than an old 4x20 character display I want to get away from the raw parameter readout. The stock instrument cluster makes sense to anyone who can read english even if they've never sat in the car before. The 4x20 displays are confusing and complicated.

I don't think most of the data that was displayed on the beta LCD needs to go on here, except maybe on a secondary page the driver can access by pressing a button to toggle between screens. For debugging purposes it will be good to see high and low cell for example but for most driving it's not helpful. When I still had the LCD the only thing I ever looked at was the SoC.

Anyway, on the Nextion I'll probably have a battery gauge similar to the one shown. I was also thinking of adding charge and assist bar graphs, maybe with numbers next to them, because we know from OBDIIC&C that the stock CHRG and ASST gauges lie to the driver all the time -- failing to show bg charge or incorrectly indicating maximum assist, etc.

Version info is for sure only going to end up on the splash page.

I might make a display of cumulative pack delta (kw in subtracted from kw out) or maybe a display of total KW regenerated over the drive cycle and total KW used over the drive cycle. The G2 Insight had the little plant gauge of driving fuel economy that it showed you when you turned the car off -- maybe some kind of helpful info presented at the end of the drive like could inform the driver on their driving habits.
 

Linsight Designer
Joined
3,892 Posts
Discussion Starter · #49 · (Edited)
Sweet... sounds like it's time to overload @Natalya with feature requests!

I'd like to see a page that is a graph of power (Y axis) over time (X axis). Possibly two identical graphs, except that one is showing power over the last 30 seconds, while the other is showing power over the entire trip.

I'd also like to see a 'geek' page that shows the voltage status of every single cell. See the chicken scratch drawings I showed in the video in post#1 in this thread.

...

I agree that an LCD really opens up the types of data we can display. I certainly prefer integer readouts, but that's because I'm an engineer and also am intimately familiar with LiBCM and the IMA system in general... to be honest, I'm probably the least likely person to design useful GUIs for customers.

On your idea about replicating the OEM gauge visual elements, I propose that each 'bar' on the assist/regen gauge should be 1 horsepower.

...

Architecture question:
How well contained is your code in the LiDisplay.cpp file? Are you having to hack things elsewhere, or is it pretty much all self-contained? I'd love to peek at your architecture whenever you get a change to push it somewhere. I'd rather address any concerns I have before your codebase gets too large.

Once again, thank you for your efforts designing LiDisplay! You are substantially reducing my workload and realizing things that I wouldn't have gotten to this year on my own.
 

Registered
Joined
1,329 Posts
I'm not sure if it will be popular enough to include but with 10kwh of nominal capacity on the horizon I'd love some CampSight tm features.

For people leaving their house on a fresh charge a "hold" button that seeks to keep capacity in a tighter range towards the top of the charge limits.

For someone that has already camped the previous night or nights a mode that sets a steady amount of background charge that the user could choose between depending on their state of charge, distance to next campsite and anticipated power needs so like 1 amp 2 amp 5 amp etc it would be nice if they had timers on estimated time to max soc.

For someone actively camping a timer that estimates at current usage when the pack will run out.
 

Registered
Joined
1,329 Posts
For everyday use definitely have the option to adjust brightness without having to go through a menu. This could be an option that is enabled since some people might only drive in the day and want more screen real estate.
 

Registered
Joined
814 Posts
@Natalya or anybody else, for that matter...

If you're interesting in such things, E.T. Tuffte's The Visual Display of Quatitative Information can be an inspiration. You might not be able to pull directly from it, but is has numerous good and bad examples of displays of complex datasets and unusually clear text. It's helped me out a number of times. And it's also a very beautiful book, besides.

It's available on Amazon for not too much. A used copy can sometimes be bought for less.
The Visual Display of Quantitative Information, 2nd Ed.: Edward R. Tufte: 9781930824133: Amazon.com: Books

Also... @Natalya ... If you need a non-technical type to bounce ideas off of, feel free to message me. As I mentioned, I designed a number of dashboards back in my pre-retirement life and was even sometime able to make ENGs, CEOs, and MBAs reasonably happy. I'm happy to share what experience I have. But I ain't programming nothing--my brain don't do that no more!
 
  • Like
Reactions: Natalya

Registered
Joined
56 Posts
I've written some stuff for Nextion before... you can do quite fancy stuffy. also note that alot of the transparancy stuff is only available on the nicer screens, I'd acutually go for an inteligent screen over the merely enhanced model. The inteligent model also has a speaker (so you could beep if there is some emergency warning displayed etc...).

If you are going to use touchscreen inputs... it is sensitive to the polling interval so you can end up hanging the screen if you don't poll it often enough etc... the stock Nextion library is very prone to this.

I ended up using EasyNextion which handles alittle of the work of getting the thing to work reliably .... you put a bit of code in each button and it triggers predefined functions eg trigger0() etc... when you press a button that is printing the correct bytes to UART. The other nextion libraries are all nice and use objects and such but they this is the only library I got working reliably.

You can put
Code:
bauds=38400
In the Program.s to set the baud rate to a permanently higher or lower rate... I have tested higher rates and they can only really be done over short cables, 38400 is a good compromise speed. I also changed all the names of my screen objects to single letters... so I could maximize sceen update speed and minimze serial errors.

I implemented a progress guage for the project I did (it was QT tester for an industrial board).... it also had an encoder my board was using and displaying the output to a graph with, something like add 0,23,0,data here to add plot points... I can dig up the code if curious.
 

Registered
Joined
56 Posts
Also note the inteligent screens don't just beep they can play wav files and display GIFs etc... also you can recover the screen with an SD card if you missprogram something so no worries there.
 

Engine-Off-Coast
Joined
2,372 Posts
I ended up with NXT4832T035_011 which is one of the least sophisticated screens. LiBCM has a beeper and it already uses that to beep warnings at the driver.

Here's what I'm working with right now:

Gauge Font Measuring instrument Trip computer Odometer




This would be for the main driving screen. I'm not 100% sure about this layout yet.
 

Administrator
Joined
13,900 Posts
I would say you def do not need to duplicate the OEM IMA display style.
Straight line horizontal or vertical bar graphs would be a lot easier.
 

Engine-Off-Coast
Joined
2,372 Posts
Mario made an .svg of the Insight graphs, so it wasn't that hard, I just copied from what he had done.

In the video I posted earlier I do have a normal Nextion bar graph of SoC, but when driving it isn't very helpful because it goes from 0 to 100 instead of 20 to 80, and it's a continuous bar instead of incremented segments so you can't actually get a feel for the value it's trying to represent. When looking at it, it's always just somewhere in the middle and isn't very informative, so looking at the written SoC was the only way to have an actual idea.
 

Registered
Joined
814 Posts
Just a suggestion...

Can you alter the color or pattern of the bar graph(s) based on the value reprented? That might be a way to inject a little more information into it. Sort of like the old "Ribbon Speedo" - 1959 Oldsmobile Speedometer... - YouTube (the music might make you gag). Old Mercedes' had a color-changing speedo that was super-cool, too: Mercedes Benz W110 Fintail - Erratic Gauges - YouTube

You have to be careful with such techniques because of the potential color-blindness of individuals. Total loss is less common than blue-yellow is less common than red-green. Patterns can be better, but more subtle. A combination, if you can find one that's appealing, is best.

Like, this from a project I'm working on: More red = more missed. More blue = More found. No color = 50% value. The numbers are there, but you don't need them to spot where some or a lot of things are missing or found. You can even quickly find potential trends in the data. You can post the SOC and people can look at that for detait and change the color for a quick peek.

Font Pattern Number Parallel Symmetry
 
41 - 60 of 94 Posts
Top