Raspberry Pi custom dash (without tuner studio)

Do you need some help in using the forums? Any questions about using the forums can be asked here.
Contact a: System Administrator

Moderators: jsmcortina, muythaibxr

Post Reply
eiton
MS/Extra Newbie
Posts: 5
Joined: Fri Feb 17, 2017 8:50 am

Raspberry Pi custom dash (without tuner studio)

Post by eiton »

Hi guys, hopefully this is the right place for this.

I have a dream, that one day I can have a custom dash running on a raspberry pi without having to use tunerstudio or some other premade solution.

My goal is to write a program in C++ for the raspberry pi to listen to CAN broadcasts and display some "gauges" on a connected LCD.

I'm using SDL2 so I don't have to load up the x server and keep the cpu overhead low / minimal boot times. I've got the graphics side of things for the most part sorted and managed to make a little gauge "demo" to get an idea of how things would look and work.

The part where I'm stumbling is connecting my ms3x to the pi and listening to the can broadcasts.

I was planning on having my connection from the ms3x to the pi be db9 serial out > rs232 to usb converter > usb port on the pi. Going straight usb to usb from the ms3 is an option as well but I was hoping to leave that port open for laptop tuning.

Here's where my problem begins and my ignorance is revealed. I'm having trouble figuring out how to read the can frames from the serial connection. The ms3x shows up as /dev/ttyUSB0 and I'm not sure how to take that serial device and turn it into something useful.

If anyone has any links to some resources that break it down barney style and has some code examples it would be greatly appreciated.

Extra info, mostly unrelated:
I'm not 100% against getting some sort of CAN board for the pi but it seems like a waste of money if other software can communicate to the ms3 without it.
This dash is just for display purposes. I don't plan on using the pi for tuning.
I plan on having the pi turn on and off with the car. I haven't yet figured out how I'm going to make the pi shutdown safely when the car is off but it'll probably involve a battery and looking for voltage on gpio pins.
grom_e30
Super MS/Extra'er
Posts: 4451
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Raspberry Pi custom dash (without tuner studio)

Post by grom_e30 »

on the megasquirt the serial port and the usb share the same uart so only one can be used at a time. if you used a dedicated can interface on the raspberry pi and connected that to the ecu canH and canL that would leave you still able to plug a laptop in and tune while still using your display.

as far as im aware you dont get the same can frames from the serial port as you do over the can bus.
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9128
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Raspberry Pi custom dash (without tuner studio)

Post by racingmini_mtl »

grom_e30 wrote:on the megasquirt the serial port and the usb share the same uart so only one can be used at a time. if you used a dedicated can interface on the raspberry pi and connected that to the ecu canH and canL that would leave you still able to plug a laptop in and tune while still using your display.

as far as im aware you dont get the same can frames from the serial port as you do over the can bus.
Not only that but CAN broadcast is only available on the CAN bus hence the name.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
eiton
MS/Extra Newbie
Posts: 5
Joined: Fri Feb 17, 2017 8:50 am

Re: Raspberry Pi custom dash (without tuner studio)

Post by eiton »

Thanks for the replies.

So essentially I would need to solder two wires to the can high and can low holes on the main ms3 board and then connect that to something like a PiCAN2? (http://skpang.co.uk/catalog/pican2-canb ... -1475.html)
grom_e30
Super MS/Extra'er
Posts: 4451
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Raspberry Pi custom dash (without tuner studio)

Post by grom_e30 »

eiton wrote:So essentially I would need to solder two wires to the can high and can low holes on the main ms3 board and then connect that to something like a PiCAN2? (http://skpang.co.uk/catalog/pican2-canb ... -1475.html)
yeah pretty much
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Raspberry Pi custom dash (without tuner studio)

Post by elaw »

Yep!

Then of course do a bunch of programming. 8)

The CAN broadcast protocol is here: http://www.msextra.com/doc/pdf/Megasqui ... adcast.pdf - make sure you're using the latest MS3 firmware.

I'll be interested in seeing how this works out for you... I actually considered doing something similar but decided the Pi took too long to boot up and went with a self-built (okay, friend-built) custom platform instead.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
eiton
MS/Extra Newbie
Posts: 5
Joined: Fri Feb 17, 2017 8:50 am

Re: Raspberry Pi custom dash (without tuner studio)

Post by eiton »

Well, I haven't done anything special outside not automatically starting the x server on the pi yet so I imagine I can speed up the boot times a bit but as is, it's pretty quick to get to the command line. I'm not too overly concerned about a delay between the car being turned on and the dash actually giving useful information. My thinking is how often do you really need to see some sort of information on your dashboard within the first minute or two of turning the car on?
racingmini_mtl
Super MS/Extra'er
Posts: 9128
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Raspberry Pi custom dash (without tuner studio)

Post by racingmini_mtl »

elaw wrote:I'll be interested in seeing how this works out for you... I actually considered doing something similar but decided the Pi took too long to boot up and went with a self-built (okay, friend-built) custom platform instead.
Eric,

Is that a Nextion display? And how does it look in daylight inside the car?

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Raspberry Pi custom dash (without tuner studio)

Post by elaw »

It's a Nextion but I can't say about brightness because it's not installed in the car yet!

Honestly I don't have very high expectations for the display... it's certainly nothing special in terms of brightness. I might fabricate some kind of small "visor" for the enclosure if it's much of a problem.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
racingmini_mtl
Super MS/Extra'er
Posts: 9128
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Raspberry Pi custom dash (without tuner studio)

Post by racingmini_mtl »

Well, I'd be interested in seeing more when you do get it in the car. But I also have my doubts from my own experience bench testing one.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
cervan
Helpful MS/Extra'er
Posts: 77
Joined: Sun Apr 17, 2016 8:08 pm

Re: Raspberry Pi custom dash (without tuner studio)

Post by cervan »

Im actually in the process of doing something similar to this, only instead of going the raspberry pi route, i took the full on x86 route. I wanted to be able to control my multimedia, tune and broadcast my dash all from one computer. So i built a mini-itx intel G4560 with one display port output and one hdmi. From the HDMI i will be controlling with an 18'' touchscreen monitor the tuning/radio portion in the center console, i also have a 14'' monitor ill be mounting to my instrument cluster and using it as a dashboard.

So ill have a couple of hurdles to overcome, but in a couple of ways this kills two birds with one stone. Since only one computer can be connected to the ms3 at a time, ill be able to tune/show dashboard all from a single computer with two different monitors. My biggest issue with this setup is going to be getting the startup sequence time down, and the proper windows in the correct screens/orientation automatically without dragging/dropping screens every time it boots up.
Post Reply