GPS and TunerStudio with a Pi Dash
Posted: Tue Jun 20, 2017 12:19 am
by VLC-05L
I have made a Raspberry Pi dash and am trying to use a GPS module for speed. I bought the Adafruit Ultimate GPS module and a cheap USB to serial converter.
I basically plugged them all together and hoped for the best. I set up the GPS configuration in Tunerstudio with the port being ttyUSB0 and a baud rate of 9600. Apparently this is what the module uses as standard. When I go to the mini-terminal in tuner studio, when I can open the port it shows the GPS data being received, even when I was inside and not getting a fix. With the module installed under my dash, while I drive around the speed doesn't show up on the dash.
My thoughts are that even if it is not getting a fix due to being under the dash, it should still show changes in speed, even if they are not all that accurate. Or is this not correct? Should I be buying a GPS antenna?
Or if this is not required, is there something else that needs to be done on tunerstudio or the Pi to help them interpret the signal. I thought I read that there are a couple of different messaging types and that I might need to tell the Pi what sort of signal I am receiving, but I haven't done anything like that.
Any help would be most appreciated.
Glen
PS. (Another problem I am having) When I accelerate the car hard, the Pi turns off... I am still testing to try and find why this happens but if anyone has any theories, happy to hear them.
Re: GPS and TunerStudio with a Pi Dash
Posted: Sun Jul 23, 2017 12:00 am
by VLC-05L
LT401Vette wrote:Open a terminal to it. The messages start off with what they are.
So you should see rows starting with $GPGGA and $GPRMC
Some GPS's can be configured for specific messages, but most have the above by default.
Thanks for that!
I ended up buying an antenna that suited the GPS module. It has a magnetic base so it can be put on the roof of the car to maximise the chance of getting a fix.
After driving the car today, it would not get a fix for any time longer than a few seconds. The GPS Active box would light up for a few seconds then turn off. It wouldn't get another fix for a few minutes and again it would only be for a couple of seconds. Not long enough to update the speed on the dash.
I looked at the default messaging format for the GPS module and it is NMEA 0183. I read that there are different forms of NMEA. Will the one I mentioned work fine?
Why else might this be? I'm unsure what I can do to test things to get this working. I kind of need this to work as I have put the fuel gauge as an input to the ECU and that doesn't work as it should, so I was going to try and rely on the fuel used calculation combined with the odometer calculation. I assume that the odometer calculation uses the speed input.
Re: GPS and TunerStudio with a Pi Dash
Posted: Sun Jul 30, 2017 9:36 pm
by VLC-05L
I don't know a whole lot about Linux, part of the reason I got the Pi, was to learn a bit. I know that permissions are something to keep in mind. Could it be that I have not given permission for Tuner Studio to access the port that the GPS is connected to? Do I need to be running TS as an administrator or something like that?
Re: GPS and TunerStudio with a Pi Dash
Posted: Mon Jul 13, 2020 5:31 pm
by Turbo6inKY
I'm attempting the same thing with the Adafruit module.
I have TunerStudio set up, it sees the module. I even managed to figure out how to command the module to only send the $GPGGA and $GPRMC (suppressed all other output), and I got it up to 115200 with 10Hz updates. I can verify all of this via a terminal:
$GPRMC,210630.100,A,3811.3158,N,08546.2441,W,0.21,8.77,130720,,,A*7F
$GPGGA,210630.200,3811.3158,N,08546.2441,W,1,07,1.07,169.4,M,-33.2,M,,*56
$GPRMC,210630.200,A,3811.3158,N,08546.2441,W,0.21,9.18,130720,,,A*74
$GPGGA,210630.300,3811.3158,N,08546.2441,W,1,07,1.07,169.4,M,-33.2,M,,*57
$GPRMC,210630.300,A,3811.3158,N,08546.2441,W,0.21,9.56,130720,,,A*7F
$GPGGA,210630.400,3811.3158,N,08546.2441,W,1,07,1.07,169.4,M,-33.2,M,,*50
$GPRMC,210630.400,A,3811.3158,N,08546.2441,W,0.21,9.88,130720,,,A*7B
$GPGGA,210630.500,3811.3158,N,08546.2441,W,1,07,1.07,169.4,M,-33.2,M,,*51
$GPRMC,210630.500,A,3811.3158,N,08546.2441,W,0.20,10.08,130720,,,A*4B
$GPGGA,210630.600,3811.3158,N,08546.2441,W,1,07,1.07,169.4,M,-33.2,M,,*52
Just to get this information out there, if you're running Linux/Unix and have the module attached, the commands you can send to it to raise the update rate are:
Set the baud rate on your serial port (replace ttyUSB0 with whatever port your dongle's on):
stty -F /dev/ttyUSB0 9600
Send command to raise baud rate to 115200
printf "\$PMTK251,115200*1F\r\n" > /dev/ttyUSB0
Raise the baud rate for the port on the OS device:
stty -F /dev/ttyUSB0 115200
Now, set the update rate
printf "\$PMTK220,100*2F\r\n" > /dev/ttyUSB0
You need to use printf instead of echo because of the \r\n, the module expects a carriage return and a linefeed at the end of the command, or it won't recognize it, and it's hard to get echo to do that. Printf does it nicely.
The command to suppress all data fields except GPRMC and GPGGA:
printf "\$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" > /dev/ttyUSB0
So that's how to set up the module to do what TunerStudio is expecting it to do. And for me, TunerStudio is showing GPS Active and GPS updating, but I have no GPS related fields available to me in the logger.
There's no debugging information in the TunerStudio app log beyond it showing the GPS module detected and GPS functions going online.
7/13/20 5:05:01 PM :Info: Initializing GPS.
7/13/20 5:05:02 PM :Info: Read file mainController.ini: 553.58417ms
7/13/20 5:05:02 PM :Warning: No values set for GPS setting: 2nd Com Port
7/13/20 5:05:02 PM :Info: Initializing GPS Interface: RS232 Serial Interface
7/13/20 5:05:02 PM :Debug: GPS started
7/13/20 5:05:02 PM :Info: Ready