Sunday, November 15, 2015

Raspberry Pi - Tools to Program on a Headless Raspberry Pi Remotely in Python!



I've found some very useful tools to help me program on my Raspberry Pis.  Most all of which are not connected to screens, unless you count the Picture Frame Pi which is on the wall and would be impractical to connect a mouse and keyboard to and start coding.  Here are the tools I use for Mac and PC operating systems.

IDE

PyCharm Community Edition


PyCharm is Available for Linux,Mac, and Windows environments.  With the next tool you can mount your Raspberry Pi's as a network volume using sshfs or winscp (Window's)



Mounting your Pi on Mac

Here there are a couple of options. Installing and setting up a samba share or use the currently built in features of ssh and scp.  I decided to go the ssh route and used the following tools for that on my Mac
First you need to install Macfusion. Macfusion allows you to mount various filesystems on your Mac including network filesystems with a couple plug-ins.  Without installing samba on your raspberry pi you can mount your filesystem using the sshfs plugin. Notice in the link to install the dependencies before installing Macfusion.

Mounting your Pi on Windows

There's also a couple options but again if you don't have samba setup and don't want to go through the hassle you can do the sshfs or scp mount in windows as well with a couple tools:
  • A great post for mounting is found here: SSHFS For Windows. This makes the sshfs share appear as a mounted network drive.  
  • Another way is to use WINSCP. You are able to browse through your Pi's filesystem and modify, copy, move, and delete files.  If you go to your settings within winSCP you can modify the editors for each filetype.  You will want to choose PyCharm for your .py extension filetype.  When you edit a file from winSCP it creates a temporary file in a temporary directory within windows.  It then checks for file changes and syncs it back to the pi  (or whichever ssh file system you mounted).   

Mounting your Pi on Ubuntu/Debian

Since Ubuntu and Debian are similar you can follow the basic procedure here.  You can mount using the "Connect to Server" tool for mounting the SSHFS.  

Opening your project


After mounting you can open a current python project folder or create a new one.  Since I'm on my Mac you'll see the open dialog screen similar to that.  


Debugging your Project

PyCharm is an awesome tool with debugging. I found this article( which I couldn't have explained it better) on how to debug remotely http://www.codeproject.com/Tips/987276/Remote-Programming-of-RaspberryPi-using-PyCharm 


Hope this has been helpful.. If you don't like writing in nano and running.  Or opening up a VNC viewer and running the PyCharm IDE on the Pi..

Please Share if you found this helpful!!

No comments:

Post a Comment