Monday 15 April 2013

Autostarting a Python program when a Raspberry Pi is powered up

When developing an application using Python, it is essential to have the Raspberry Pi connected up with keyboard, mouse and monitor. However in most control applications, once it has been debugged and is working OK, one does not need these peripherals to be connected. This blog pots outlines how to do this.

I initially tried to Google a solution for this. However there did not seem to be a defintive way of doing this. Thanks to Simon Monk in his book "Programming the Raspberry Pi" I came across a solution.


The raspirobot project uses a Raspberry Pi to control a robot. There is no need in this application to have trailing leads connected to a monitor or a mouse. The author describes how to configure the Pi so that the Raspirobot application starts up automatically. There is a summary below.

Step 1: Make sure that the Pi starts up desktop on power up

Step 2: Check for Auto start file and if necessary create one

Step 3: Create desktop file for Python program

Step 4: Place this in the Autostart directory

Step 5: Test it out


See the tutorial here for more information.

I have tried this out on a couple of simple Python programs and it works just fine. Hope readers find this post and tutorial useful.

There are other tutorials on the Raspberry Pi here.

1 comment:

  1. I will defiantly try myself when developing an application using Python. Your giving steps is really helpful for me for making this applications

    ReplyDelete