Installing TunerStudio on Raspbian with autostart and push button clean shutdown!


  1. Raspberry Pi 3 or 4
  2. Raspbian Linux
  3. TunerStudio
  4. Header to plug into the GPIO pins
  5. Push button

Basic Concept:

  1. Start up the Raspberry Pi
  2. Boot into Raspbian
  3. Start TunerStudio automatically
  4. Exit TunerStudio clean with a push button
  5. Shutdown Raspbian clean after TS exits

Download Raspbian here:

Installation notes for Linux, Mac OS, Windows images to SD Card here:

In Linux, my command was below. Be absolutely certain that /dev/sda is the location of your SD CARD!!!

dd bs=4M status=progress if=2019-09-26-raspbian-buster-full.img of=/dev/sda

Download TunerStudio or copy it to your SD Card. You can also boot into Raspbian and do this. My example will use Raspbian to do all of the work.

Insert the SD card into your Raspberry Pi and power up. It may take a little bit to go thru the startup sequence for the first time. Once its booted up into Raspbian you’ll see the following screen, click Next and answer the questions. You’ll be asked for your locale, network config, change the password etc.

Once complete, head over to download TunerStudio. Click on the blue globe on the top left to open your browser and go to this URL. Scroll to the bottom and download the latest TunerStudio for Linux version.

Once the download is complete, open up a terminal session. Top left corner, looks like a >_ sign in a black box.

Now we need to install TunerStudio, so you’ll do the following commands to decompress the file. At the time of this article, the version is 3.0.28 and the filename is TunerStudioMS_v3.0.28.tar.gz. The below commands will get you to your Downloads directory and show you the contents. If your file has a different name, use that instead of the one I just typed.

cd Downloads
ls -lsrth

Lets move that file from our Downloads directory to the main directory and extract the contents.

mv TunerStudioMS_v3.0.28.tar.gz /home/pi
tar xf TunerStudioMS_v3.0.28.tar.gz
ls -lsrth

Now you should have a TunerStudioMS directory. Lets run TunerStudio and see if it works. You should see output saying something about it not being registered and then the awesome TS pops up. Once you do that, just exit. Time to get to work.

cd TunerStudioMS

You should be back at the terminal screen. Lets create a script that starts up TunerStudio. We will be using the editor called nano. Paste the EXACT commands in the file and then save. If you screw up you can delete the file “del” and start again.

nano /home/pi/

Put this in the script and then save:

cd /home/pi/TunerStudioMS

Make the script executable once you get to the prompt:

chmod +x

Now lets run that script to see if TunerStudio starts up.


You should see the same TunerStudio screen. Exit. More work.

Lets modify the boot up to start TunerStudio automatically. The following will change directory to the autostart directory where you will create a script to run TS.

cd /etc/xdg/autostart
sudo nano StartTS.desktop

In the editor type this EXACTLY and when you’re done, save.

[Desktop Entry]
Exec=/usr/bin/lxterminal -e “/home/pi/; read -n 1 -s”

At this point you should be able to reboot and then TunerStudio should start up automagically. You should be sitting at a terminal prompt. Type the following to reboot:

init 6

Once rebooted, a terminal screen will pop up and then TunerStudio will start. Exit TunerStudio, hit return and then the terminal session will disappear.

Lets set up the auto shutdown script. Click on the terminal icon which looks like a black box on the top left with a >_ in it. Then type the following two commands. The first copies the necessary commands you’ll need and the second installs it:

git clone

Now this is the interesting part. Once installed it runs some python code and starts waiting, listening for you to select the power off by hitting a button. Here is where it is on your Raspberry Pi, 3rd from the right. If you hook up a push button, once you press it, by default this will cleanly shut down the Pi but YOU’RE NOT DONE YET. The jumper was off of some old computer parts I had. You can do the same or make one. The other end of those two wires, I do not have a button on it yet. Need to order some since I lost my pack of buttons. If you’re like me and just want to test, expose the wire off of the red and black and then touch them together briefly. Your Pi will clean shutdown. Go ahead and power back on. We need to modify the python code and TunerStudio startup script that comes with TunerStudio.

Exit TunerStudio and open a terminal session. Lets modify the original startup script TunerStudio comes with. We’ll create a backup in case you have a typo.

cd TunerStudioMS

Here is the TunerStudio script. What is in BOLD RED is what you will ADD at the EXACT SPOT PICTURED!!! If you do this wrong you will screw up the TunerStudio startup script, but we have a backup. Scroll to the bottom of the script with your arrow keys and look for the line pictured. Add what is in BOLD RED. Once done, save.


cd “$BASE_PATH” && java -Djava.library.path=${SERIAL_DRIVER}lib -cp “.:lib:plugins” -jar TunerStudioMS.jar $1 &

echo $! > /tmp/
echo “kill -s TERM `cat /tmp/`” >/home/pi/
chmod +x /home/pi/

if [ -d “$LAST_PATH” ]; then

exit $RESULT

At this point you should be back at the terminal prompt. We should be able to run TunerStudio and it should still start up the same. Lets give it a shot. Exit TS after it pops up.


If TunerStudio came up, no typos, you’ve done well. Last but not least, lets modify the python code to shut down TunerStudio and the Pi.

Here is the original code:

#!/usr/bin/env python

import RPi.GPIO as GPIO
import subprocess

GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)[‘shutdown’, ‘-h’, ‘now’], shell=False)

Edit the file :

sudo nano /usr/local/bin/

Insert the lines in BOLD RED:

!/usr/bin/env python

import RPi.GPIO as GPIO
import subprocess
import os
import time

GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)

time.sleep(15)[‘shutdown’,’-h’,’now’], shell=False)

You can now reboot. Once booted into Raspbian, TunerStudio will start up and in the background you will have a process monitoring to see if you hit the “power button”. Once you do, TunerStudio will exit, 15 second time out, then the Raspberry Pi will shut down clean.

If there is a way to improve on this, do so and reply back. Here’s a video of this done with my instructions.

2 Responses to Installing TunerStudio on Raspbian with autostart and push button clean shutdown!

  1. hey man. great tutotial. i’m stuck on the auto start step. when i reboot, i get a box titled,; and it doesnt go past that. i used the commend to check and see that tuner studio does indeed start up manually. any chance you know how to fix it?

    • ok, it might take a while to debug via my website. I can remote in and look at it if you want, using AnyDesk. If not, go to a terminal and type the following


      …and paste what you have as a comment here. You might have a typo. Or you can also do the following command:


      ..from a command line. It should run TunerStudio. If not, it might spit out an error. Let me know what it is.