Cement 876 Report post Posted February 8, 2023 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. 7 Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted February 13, 2023 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. Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted February 22, 2023 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). Arduino and 3x shields now plus power distribution to the side. Getting things up and running USB power adapters for screen and Pi 2 Quote Share this post Link to post Share on other sites
Neil McCauley 394 Report post Posted February 23, 2023 Awesome wee project! Very keen to follow along with pretty pictures and technical details as well. Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted February 26, 2023 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 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 3 Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted March 5, 2023 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. 3 Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted March 12, 2023 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. 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. 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 ... 4 Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted March 23, 2023 Not a whole lot to report on this project of late in terms of pictures but have been chipping away: Simplified the dash to not include the CAN derived metrics so I get faster updates Ordered an Orange Pi 5 to replace the Raspberry as its not grunty enough to update more frequently Ordered some right angle plug ribbon cables so I can get the screen mounted in the console https://www.amazon.com/gp/product/B071G7P33P Ordered some really neat power control modules designed for automotive use, this will signal the Pi to shutdown cleanly and then remove power when ignition goes off https://www.tindie.com/products/picotouch/raspberry-pi-automatic-onoff-v30-new-version/ Quote Share this post Link to post Share on other sites
Cement 876 Report post Posted April 4, 2023 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) Quote Share this post Link to post Share on other sites
Kodachrome 151 Report post Posted April 6, 2023 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! Quote Share this post Link to post Share on other sites