Jump to content
mad_pete

Raspberry pi v3 dash display fit megasquirt

Recommended Posts

Car pc time again. Can someone recommend me a serial to USB cable for MS to plug into a Raspberry pi please ?

Share this post


Link to post
Share on other sites

I believe that the Raspberry Pi has a UART that is able to run as a serial port, so no need to Convert to and from USB
Just configure the OS correctly (e.g. not to run a console on the serial) and connect to the right GPIO pins

Note I've not done this myself but I'm sure a web search will tell you how.

Edit: I guess that megasquirt is full RS232 and running at 12V which will need to be converted to 3.3V for a UART connection

Share this post


Link to post
Share on other sites

As Zardos says, the GPIO header should have 3v3 (possibly TTL compatible) serial TX/RX pins. Your MS will be running "full" RS232 at +/-12v so you'll need whatever the 3v3 version of a MAX232 chip is. Best bet check the Pi forums etc. as someone's bound to have solved this one before. Likely a ready-made board on eBay from China for a few pennies. Something like this in fact.

If you do USB-Serial you want anything that uses an FTDI chip, although Linux seems to handle the rest more sensibly than windows ever did - if you only have one USB-Serial attached it is likely to always be /dev/ttyUSB0

Also - show us what you're making! :P

Share this post


Link to post
Share on other sites

...also these guys make a good point about turning off the system console on that port if you're using the serial port for other things, it could proper mess you up:

Quote

The UART is /dev/ttyAMAO, it defaults to output system log. But if user wants to use this UART to connect to other modules through UART, for example, GPS module, we need to change the configuration.

The detailed steps are as following:

We need to modify two files: /boot/cmdline.txt and /etc/inittab.

Modify /boot/cmdline.txt:

Replace the original content:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

With:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


Modify /etc/inittab:

Comment out the last line of /etc/inittab. To comment out, it simply addess a '#'.

 

$ sudo vi /etc/inittab

  1. T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Save the changes, and reboot. We will get an UART with baud rate of 115200.

 

Share this post


Link to post
Share on other sites

Okay. Update.

RPi v3 is very impressive.  Very fast, built in wifi and Bluetooth. Nice bit of kit.

Doesn't like 12v instead of 5.5v

But that aside I have working:

  • Power to the Pi from the car
  • In car monitor
  • TunerStudio (loads straight in, super easy) 
  • Auto shutdown from the car PSU

Not yet working :

  • Serial port - got the thing from ebay haven't it talking yet - I need to recheck the settings. Swapped controller fromthe Bluetooth to the serial 
  • Touch screen

 

 

IMG_3237.JPG.f2f7c33e16bab54d510a4eddd97605a1.JPG

IMG_3242.JPG.587958aafafaf81fd3b647c1f4d46a60.JPG

 

 

 

Share this post


Link to post
Share on other sites

Nice!

19 hours ago, mad_pete said:

TunerStudio (loads straight in, super easy) 

Did you configure TunerStudio to auto start? If so, how? I never managed to get that working.
Same with the auto shutdown, had some trouble with reading the GPIO pin for that IIRC.

Share this post


Link to post
Share on other sites

May be obvious but the Pi serial pins will be 3v3, whereas the MS RS232 output will be +/-12v. You'll need a MAX232 (possibly MAX3232 for 3v3 if memory serves) to convert levels. Plenty of ready-made boards for peanuts on eBay.

Share this post


Link to post
Share on other sites

Yeah, I converted it to 3v3, I think it was mostly due to Mono being a pain on the Pi back then (maybe it still is).

Share this post


Link to post
Share on other sites

To me, it's like Marsians talking.... :blush:

But looks interesting !

  • Like 4

Share this post


Link to post
Share on other sites
17 hours ago, elbekko said:

Nice!

Did you configure TunerStudio to auto start? If so, how? I never managed to get that working.
Same with the auto shutdown, had some trouble with reading the GPIO pin for that IIRC.

Auto start 

https://www.youtube.com/watch?v=-UnS-xxT0Aw&feature=youtu.be

Auto stop

http://www.instructables.com/id/Simple-Raspberry-Pi-Shutdown-Button/

My PSU gives me a latch on shutdown and then waits a minute before a hard power off.  I put the latch pins to the GPIO pins. I'll add some pictures.

I think for the serial port I might (and not for the first time) be forgetting to run Tunerstudio with a user that is allowed access to the Serial port.

 

 

Share this post


Link to post
Share on other sites

Can't get the serial port to work at the moment. Will go and find a rpi forum to post to. I've turned off the console and swapped the Bluetooth over.

if I loop the serial gpio pins thx and extra the tunerstudio minicomm sees the chars and if I connect a laptop to the megasquirt that works hmm.

Share this post


Link to post
Share on other sites

It seems like the serial gender changer may need to swap tx and rx, ordering a null modem one and see what happens.

if anyone has a db9 null modem cable or connector they don't want any more let me know please. :-)

Share this post


Link to post
Share on other sites

A long time ago I had a rs-232 jumper box, very handy. But long since lost it :-(

Share this post


Link to post
Share on other sites

Ok got a small null modem connector from eBay and it seems to mostly work. The dectect came back with msns or similar repeated for firmware and version and the port check fails but if I just run it the gauges do indeed spring to life. Maybe the null modem doesn't have all the loopbacks in place. So that's the most important bit. Just need to wire it in and maybe find a custom dash I like. :-).  Maybe I'll see if the firmware needs an update.

Share this post


Link to post
Share on other sites

You should only need 3 wires for the RS232 cable: Tx, Rx, Ground.

Any time a USB adapter is involved there's opportunity for problems as they can buffer data or have flow control / wrong speed etc.

You'd almost be better off using the Pi's GPIO UART pins and a stock MAX3232 driver.

Share this post


Link to post
Share on other sites

So mostly works, did corrupt one of my fuel cell values so it's not 100% yet.  Need to get the serial more reliable.

 

 

IMG_3372.JPG.1d03362174b31262940ff69abea01c28.JPG

IMG_3373.JPG.8944826d29951647d9d0f70b4caf72e8.JPG

IMG_3374.JPG.76bb71fe39e3a2b0821252a18ecbbdee.JPGIMG_3371.JPG.dba67d128b99481bf339ac023a613f4a.JPG

  • Like 1

Share this post


Link to post
Share on other sites

That looks very tidy!

Hope you get the last few gremlins ironed out.

Share this post


Link to post
Share on other sites

That's pretty neat (and rather bling), is it annoying at night?

Share this post


Link to post
Share on other sites

The pi is causing the megasquirt to reset every so often when it's connected. I think that's why I got a corrupted fuel cell. Need to fix that. I haven't tried night yet due to this.

Share this post


Link to post
Share on other sites

Very impressive.  If it's corrupting the MS, presumably there's feedback through the Rx/Tx.  Simple Diode help to stop it doing that?

 

Share this post


Link to post
Share on other sites

It’s causing the ms to reset I think when the serial is connected. I thought I might need to put the earths neaer each other. Where would the diodes go ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We use cookies to ensure you get the best experience. By using our website you agree to our Cookie Policy