DIY iPhone controller for Raspberry-Pi (OSC)

To start off this project I would like to explain how all this will work. We will be using a form of communication called OSC (Open Sound Control) and an app called “TouchOSC” which is available on the Google Play and Apple app store, along with pyOSC. What we will do is the following:

DIY iPhone controller for Raspberry-Pi

– Create a suitable layout for the Touch OSC app to control the Raspberry Pi (will explain further as we go)

– Upload the layout to the app

– Install pyOSC on your Raspberry Pi (I assume you already have your Pi setup and connected to your Wifi / Ethernet)

– Write a simple script in Python to handle messages from the TouchOSC app, and output the values it recieves

REASONS WHY I CREATED THIS LITTLE PROJECT:

– To show the world how easy it is control your Pi without a big hassle

– To establish an easy and legitimate tutorial (I figured this out from bits and pieces here an there, so I don’t want other people to struggle with creating a simple OSC project like I had to)

I hope you enjoy this project!

BIG, BIG THANKS TO:

www.playwithmyled.com for the main image and inspiration for this tutorial!

Step 1: Gather your materials / create OSC layout

In this step we will basically have you get yourself prepared for the project by gathering all of our resources that we will require:

1. Download the TouchOSC app:

The app (last I remember) costs $5. Really, you can get it for free if you pirate it (I suggest not to pirate the app, even though it will still work).

Google Play Store Link (CLICK HERE!)

Apple App Store Link (CLICK HERE!)

2. Download the TouchOSC layout creator (to create your own GUI for your phone):

Go to this link here , scroll down to the bottom of the page and download the TouchOSC editor that suites you

3. To start building your own layout open the program you downloaded in step 2 above:

– You want to begin selecting the proper layout options for your device / phone/ tablet. iPhone screen already come with pre-configurations, but for Android devices you must select the CUSTOM layout options and put in your screen resolution. In my case I am using a Samsung Galaxy Tab 3 which is 600×1024.

– Next, you want to add in all sorts of widgets into your UI by “right-clicking” on the black screen. Once you select one, look at it’s setting on the left hand side and set it up to what you want to do.

SUPER, SUPER IMPORTANT INFORMATION:

When you are creating your UI, please make sure to jot down the name of your widgets and their value ranges, you will need this for future reference, also SAVE your layout file!!!

– After you create a UI that you like, turn on your smartphone / tablet and open the TouchOSC app. (Make sure you device is connected to the same Wifi network as your computer)

– On your computer: click on “Sync”

– In the app, click on the “Layout” button and your computer should appear. Click on your computers name and it will ask you if you want to download the UI file you created. Hit “Yes”, or whatever comes up.

– Then, in the app, select your layout you just made and go back to the home screen

– Press “Done” to then view your layout that you just created to test it out and see how it works

THE IMAGES WILL GUIDE YOU THROUGH ALL THE STEPS!

Step 2: Boot up your Raspberry Pi and install pyOSC

Now that we have our UI (User Interface) setup, we next need to install pyOSC for python so that our R-Pi can easily communicate with our device using the code we write.

In this step I assume that:

– You already have an SSH connection to your Pi

– You have an established internet connection the your Pi

– And, that you know a little bit of python (I’m more of a Java guy, so python is a little different for me, so you should be fine…(BTW: You actually don’t need any good programming abilities to be able to do this))

WE WILL BE USING THE FOLLOWING PROGRAMS IN THIS STEP AND THE NEXT:

Putty — or any other SSH client

FileZilla, so that you can copy the files over to your Pi

INSTALLING pyOSC:

1. Open up Putty and connect to your R-Pi via SSH (you will need it’s IP address and connect through port 22)

– To get the IP address, simply download FRING — from the Google Play and Apple app store, it will list all the devices on your network. So from there you can get the IP of your Pi.

2. After you have established a connection, login with the Username: ‘pi’ and password: ‘raspberry’ (do this if you haven’t already changed the Username and Password)

3. Once you are logged in, begin by typing the commands below to install pyOSC

sudo apt-get install git

Next, type in this:

cd /tmp —————–This will change the dierectory

git clone git://gitorious.org/pyosc/devel.git ——————–This will download the pyOSC package

cd devel —————-This will change the directory

sudo ./setup.py install —————-This will run the install script for pyOSC

Now Were Done! 😀

IN THE IMAGES YOU CAN SEE THE ENTIRE PROCESS

Step 3: Making the python script (more like transferring it)

THE SCRIPT IS ATTACHED TO THIS STEP!!!!!

DIY iPhone controller for Raspberry-Pi

In this last step we will be editing a script that I wrote, to suit your needs with your UI that you created in Step 1. I have attached a simple version of the script so that it outputs the data it receives from your Android / Apple device.

 

For more detail: DIY iPhone controller for Raspberry-Pi (OSC)


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top