Introduction: Control Stuff With Your IPod Touch/iPhone
PC running Windows XP or newer.
A Wi-Fi connection to your PC.
An iPod Touch or iPhone. I used a iPod Touch 4G.
Step 1: Install Control From ITunes
Install the FREE app, Control, available from iTunes.
Step 2: Run the App
Start Control . The program should automatically start at the “Interfaces” screen. If not, use the lower menu bar to navigate to the “Interfaces” screen.
Tap “+” to add the OnOff control. Enter the URL:
Note the last entry on the “Interfaces” screen is now “OnOff”. I've found it is hard to navigate to new menu items. If you have trouble, simply stop Control and restart it.
Step 3: Run the PC Host Program
Download the OnOff.zip file from this location:
Extract the onoff.exe file from the zip and run it. Click the Start button. The program will tell you the IP of your PC.
On your iPod Touch, select “Destinations” from the menu. Tap “+” and enter your PC's IP in the “Enter Destination URL” (just the IP, no “http://”). Enter 10000 as the port number, then tap “Add”. Your IP address and port will appear in the list. Select it and it will turn grey.
Select “Preferences” from the iPod Touch menu. Enter 10000 for the OSC Receive Port.
Your iPod Touch is now ready to communicate to your PC.
NOTE: Every time you start Control, you will have to select your URL from the “Destinations” screen.
Step 4: Run the IPod Control Screen
On your iPod Touch, go back to the “Interfaces” screen and select the OnOff interface. Notice both the ON and OFF buttons are not lit. This is because as of now, your iPod Touch is not communicating to the host. Tap ON. If you have communications, the ON button will turn red, the data “127” will appear in the upper left corner. On your PC, the screen will display the data from the button and the radio button will change.
At this point, you are now communicating in both directions. The iPod Touch sent the value of the ON command as 127. The PC received the datagram, detected the originating IP, and begins updating the iPod Touch at 2Hz with the current value.
Press the OFF button on the iPod and it will change the state on the PC and on the iPod Touch.
Click the radio button on the PC’s dialog box and the iPod Touch buttons will change state.
The loop on the PC runs at 500ms, so don’t be harsh about the update speed.
Step 5: Bonus Step: Control Something
If your PC has a serial port at COM1, you can wire something up between pins 4 and 5 on the 9-pin D-sub connector. I connected a solid-state relay, and turned on and off a lamp. DO NOT USE AN ELECTRO-MECHANICAL RELAY! There is not enough drive current from the serial port.
The relay I used is a Crydom D1240, which I had in my junk pile. I see they are available from Digi-Key for about $40 US.
If you don't have anything like this, then try turning on and off a LED.
Step 6: What Next?
Now that you have the basic communication working, you may want to create your own screens. The best way to get started in this is to learn by example. The JSON source codes for the examples provided with Control are located here.
Use a text editor (notepad or write) to experiment. Be sure to have the documentation for the widgets open in a browser window for reference. http://charlie-roberts.com/Control/?cat=4
The zip file you downloaded contains the C++ code (Visual Studio 6) for OnOff.
The zip file also contains JSON and C++ programs for analog controls using a slider. There is also a LabView 2009 implementation of OnOff .
The communications between Control and the host uses the OSC (Open Sound Control) protocol. For more information on the message formats, see http://opensoundcontrol.org/spec-1_0
10 years ago on Step 3
Your router or firewall may have those ports blocked. Set your router to allow port 10000.
10 years ago on Step 3
i have been trying this experiment on my iphone 3gs but my onoff.exe file which i dowloaded says "couldnt bind" when i click on START
10 years ago on Step 5
What if my pc doesn't have port COM1?
Reply 10 years ago on Introduction
Buy an usb to serial TTL converter, in the controlpanel - system - device manger: you will see an virtual comport when you have installed the correct VC driver. If needed you can change the com port number, there too. Mine was 20$. TTL-232R-PCB, there are 3.3 volt and 5 volts editions, so look out. but there are many other models.
10 years ago on Step 5
Correct me if i'm wrong, but an arduino would work great for this project.
11 years ago on Introduction
This is epically epic!Only if I had an iphone!
Have a look at my ibles as well!