Jump to content
Sign in to follow this  
Cement

Custom Digital Display

Recommended Posts

So I've become a bit tired of my 5x regular gauges and I'd like to display a wider range of data (A/F ratios per cylinder bank, maybe speed / rpm, some performance stats etc). Also want to get the space in the console back so I can install a proper Android Auto head unit or similar.

As I've already got a micro controller in the car hooking into the BMW and Nissan CAN buses its only a short(ish) jump to displaying things of interest on a screen.

I came across Waveshare who make a really amazing range of screens and ordered the 7.9" 1280x400 capacitive touch model. Its about the size of a single DIN unit which should work really well ... will drive this with a Raspberry Pi mounted to the back of it. Will run Grafana on the Pi and stream data to it from the micro ... which I will change from an Arduino to much more capable ESP32 also.

Anyhooooo ... a picture is worth a thousand words so here is the display and a simple mock up dash running off the Pi.

2023-02-08_19-42-13.jpg.33a22baec7cc9ee5f839ea5c3989532c.jpg

2023-02-08_19-42-27.jpg.0bbe84f86ec3616f63b0c6b1214945a5.jpg

2023-02-08_22-32-36.jpg.c24c8d7f7be6d34c93a3a60923e80227.jpg

  • Like 7

Share this post


Link to post
Share on other sites

Nothing of any great news here ... ordered an ethernet shield for the Arduino as it dawned on me that I probably don't need anything more powerful once I remove the existing display which is in the glove box. So as a first cut I'll simply link the Arduino to the Pi directly via ethernet and send forth the information 🤓

The other benefit of using the Arduino over ESP32 will be it works at 5v already (instead of 3.3v) so I can wire up the sensors more easily.

Might be a challenge getting some of the more fun information (A/F ratios say) from the Nissan ECU as its not published onto the CAN bus and instead I may have to try and get it into diagnostic mode and query the params instead or some such black magic. Good news is once I crack that nut I can also get any DTC codes and check light status.

On the physical front I'm trying to get a hold of another console so I can look to get the screen mounted.

Share this post


Link to post
Share on other sites

Got a great condition console (shout out to @Dogballs !!) to mount the screen in when the time is right. Good progress also after the ethernet shield arrived. Got things all connected and real data is now populating on the screen ... had some teething issues which have all been resolved now.

Not sure if folks are interested in the technical aspects or just keen to see pretty pictures ? Let me know if there is interest else i'll just keep a high level speel going.

Next up will be back to trying to request the more interesting data from the ECM which is not streamed by default. On to the pics ...

Raspberry Pi mounted to the back of the screen with HDMI jumper installed (comes with screen).

2023-02-10_17-12-41.jpg.879b5e9128e09d5fd0b8702c6fad4950.jpg

Arduino and 3x shields now plus power distribution to the side.

2023-02-18_11-40-38.thumb.jpg.c8394a1b315c5bf9ae5ec3b3f36d0f36.jpg

Getting things up and running

2023-02-19_22-13-24.jpg.0676a019f95cb3ee73d342203171e6f0.jpg

USB power adapters for screen and Pi

IMG_20230221_205127.jpg.c613235e8dd293243473d0b6b10ac53c.jpg

  • Like 2

Share this post


Link to post
Share on other sites

Awesome wee project! Very keen to follow along with pretty pictures and technical details as well.

Share this post


Link to post
Share on other sites

Made quite a bit of progress this weekend and now have the first 'polled' metrics displaying nicely. These are things that are not broadcast on the CAN network as they are not needed to be consumed by other modules in the car. Examples are oil temp, gas pedal position, air fuel ratios, intake air temp and injector duration. All of these thing in my case are coming from the Nissan ECM but there is no reason you can't do the same for the BMW or any other car for that matter.

Have also tweaked some visuals on the temp graphs to display blue when 'too cold' then green for normal and red when cooked. Plenty of easy mucking about left to do here when frustrated with the harder work.

For those curious, the rough process of reverse engineering has been:

  • Set up some light weight Arduino code to listen on the Nissan CAN bus and setup basic filtration to NOT show messages destined to known ID's (the things broadcast under normal conditions like coolant temp). For me these are ID's 0x160, 0x180, 0x1f9, 0x182, 0x580, 0x551 and 0x6e2.
  • Connect the ELM32 Bluetooth adapter to the diagnostic (OBD) port which I know works with the Android software on my phone which talks Nissan Consult 3 protocol ... no easy suite of OBD2 for me unfortunately.
  • Go about connecting via the Android application to the dongle and ECM whilst 'sniffing' the CAN network via the Arduino.
    • Turns out there are commands that need to be sent before you can query the parameters successfully, annoying.
  • Go about logging data for a specific metric one at a time if possible via a custom 'dashboard' in the Android app. For example I setup a dash with ONLY the gas pedal position ... in the Arduino serial debug I can see the CAN messages that are being sent by the Android app as well as the reply from the ECM.
  • Make note of the request payload and all of the responses plus what real world value they correspond with. For example to get the gas pedal position I know the request is sent to the ECM diagnostic ID of 0x7DF and the payload is {0x03, 0x22, 0x12, 0x0D, 0x00, 0x00, 0x00, 0x00}. For this Nissan generation the ECM replies to ID 0x7E8 with the requested info. An example of the data recorded which allows a formula to be worked out is as below ... you will see the actual values are represented in the bytes that change ... for this metric its bytes 4 and 5 (starting at 0, from the left):
    • 0.67v is represented by {0x05,0x62,0x12,0x0D,0x00,0x86,0x00,0x00}
      1.05v is represented by {0x05,0x62,0x12,0x0D,0x00,0xD2,0x00,0x00}
      1.50v is represented by {0x05,0x62,0x12,0x0D,0x01,0x2C,0x00,0x00}
      2.23v is represented by {0x05,0x62,0x12,0x0D,0x01,0xBE,0x00,0x00}
      2.81v is represented by {0x05,0x62,0x12,0x0D,0x02,0x32,0x00,0x00}
      3.06v is represented by {0x05,0x62,0x12,0x0D,0x02,0x63,0x00,0x00}
      3.70v is represented by {0x05,0x62,0x12,0x0D,0x02,0xE3,0x00,0x00}
      4.03v is represented by {0x05,0x62,0x12,0x0D,0x03,0x26,0x00,0x00}
      4.26v is represented by {0x05,0x62,0x12,0x0D,0x03,0x54,0x00,0x00}
      4.42v is represented by {0x05,0x62,0x12,0x0D,0x03,0x75,0x00,0x00}
      4.82v is represented by {0x05,0x62,0x12,0x0D,0x03,0xC3,0x00,0x00}
  • So from there you can try and work out how its representing the 'real' value in the data. This is quite the ball ache to be fair !! I used Chat GPT like any good geek to try and avoid fully understanding what I am doing and it got fairly close. In the end the learning from trying to get Chat GPT to do it allowed me to manually muck around with the data and come up with the formula.
  • Good job if you are still reading :D I won't keep you in suspense any longer, the calculation is (the cool shades guy is an 8 then a right bracket hah):
    •         int raw_value = (buf[4] << 😎 | buf[5];
              float voltage = raw_value / 200.0;
    • If we take our value of 4.26v buf[4] is 0x03 and buf[5] is 0x54 this would be effectively concatenating the hex values to get 0x0354 (in hex) which is 852 in decimal ... 852 / 200 = 4.26 ta daaaaaaaaa !!

Anyhooooo some pictures are below and my source code can be had at the link below also ... its starting to get pretty wild, needs a big refactor at some stage !!

https://github.com/david-morton/BMW_E46_Gauge_Cluster_Control

2023-02-26_21-37-05.jpg.9c5242cacd7b43ca2d8c0aeab0b926dd.jpg

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Got all of the data on screen now, just with fake readings for the soon to be converted gauge sensors. Got to get a bit of wire and related items to get the sensors supplied with 5V and then plumbed in to the Arduino.

Have the console apart again to start looking at the screen mounting also.

2023-03-04_14-15-19.jpg.bf7b26e836062ac22edc621173961319.jpg

  • Like 3

Share this post


Link to post
Share on other sites

Got the wiring all sorted now and there is no more dummy data going to the screen ... just have to sort out the vacuum sensor I have on the crank case as its readings are bogus.

Used 1500 ohm resistors to make voltage dividers for the two temperature sensors. This selection is based on wanting a fairly linear relationship (resistance to temperature) around the 90 degree mark.

The pressure / vacuum sensors all output a voltage which I can happily read with the Arduino so no issues there. I took the standard sensor wiring that was previously going to the gauges and added a separate 5V supply so things are more self contained where the wiring terminates and to reduce the load on the Arduino itself.

2023-03-09_20-12-00.jpg.ee65b597797914b29e31775188d1704f.jpg

Working on the screen mounting also and it should work fairly well. Need to order some slim line right angle HDMI and USB cables from Amazon to make it functional. Will 3D print some end caps so the screen has a flush look once finally installed.

2023-03-12_15-29-38.jpg.2e5e1682b234e4f75d9a03a4d74e5299.jpg

The update frequency is a little sluggish (maybe 2 or 3 Hz ?) due to the Raspberry Pi not having enough juice to drive the Grafana dashboard in the browser. I will likely look to switch to something with more spice like the Orange Pi 5 which should be multiple times faster. Also still have to integrate the screens touch capability so I can switch between multiple dash views. Maybe throw a backup camera in the mix ? Who knows ...

2023-03-12_16-10-26.jpg.e917fbc1aca6e879f76498a57cce604a.jpg

  • Like 4

Share this post


Link to post
Share on other sites

Not a whole lot to report on this project of late in terms of pictures but have been chipping away:

Share this post


Link to post
Share on other sites

Got the new Orange Pi and cables etc, completed the mounting of the screen into the console and its all looking good. The Pi with NVMe SSD and 8 faster cores is so much faster than the Raspberry Pi ... loads quickly and the dashboarding is really responsive now. Might even need to slow up the update frequency or apply some moving average to chill it out a bit.

Still plenty to do in this space:

  • Make some filler panels for the sides of the screen
  • Wire up the back lighting brightness to the OEM cable that used to go to the auto trans indicator lighting
  • Connect up the screens touch feedback so I can switch dashboards with a touch or swipe (overview, detailed, performance etc)
  • Configure a button or switch to tell Arduino if it should be polling the ECU for metrics over CAN or not (only needed for some dash types)

IMG_20230402_122840.jpg.0256772928866614544576c171b54d88.jpg

IMG_20230402_122854.jpg.03c4ac3c96fa1c2928910dacbd55173e.jpg

IMG_20230403_203156.thumb.jpg.581d03da0cefce004129df74b8ffbd04.jpg

IMG_20230403_203146.jpg.2489a11d155df705556f6e088de608f9.jpg

Share this post


Link to post
Share on other sites

Just wanted to say hats off to you, its something I pondered too, for my old E28 were I ever to put an electric motor into it. Though I would try make a more 80s retro digital look in that case!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...