Apr
26
2007

Control your Mac from Arduino, the easy way

A while ago I wrote a small app that would execute AppleScript commands depending on the data send from an Arduino board connected to my mac. I’ve been asked a few times to release it but it was just a quick hack. Now thanks to HyperWerk in Basel, I’ve had the time to fix it a bit for a student project. I’m releasing it to see what people do with it.

Here is a screenshot :

AppleScript Proxy Screenshot

and Here is a piece of code for Arduino

// Applescript Proxy test
// Skip to the next song on itunes every 10 seconds
void setup() {
Serial.begin(9600);
}

void loop() {
Serial.print("A");
delay(10000);
}

What this does is that arduino sends an A every 10 seconds and that A is processed by AppleScript proxy that tells iTunes to skip to the next song…

I’m sure that there are million of uses for this… like controlling the DVD player using a light sensor or something similar… If you use it send me some feedback

This is part 1 or a bigger app I’m writing that maps a lot of events on the mac with a number of actions…

stay tuned

Download the app here

PS: It’s worth mentioning that we’re available to customise this application for your needs or build something new based on this  :)

Massimo

Written by Massimo Banzi in: Arduino, Physical Computing, hacks, programming, software, tinker.it |

32 Comments »

  • [...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way – Original Link. [...]

    Pingback | 27 April 2007
  • [...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way – Link. [...]

    Pingback | 27 April 2007
  • Max Wooden

    Any chance of being able to run this as a background process or something? Any chance of releasing the source? This is really great! Thanks a lot!!!

    Comment | 27 April 2007
  • Awesome work Massimo! I can’t wait to try this tonight!

    Marcus

    Comment | 27 April 2007
  • Rob

    Thanks Massimo, So this would mean i’d be able to command something like Quicktime with this also?! This sounds great, can’t wait to check it out.

    Comment | 27 April 2007
  • Hello Rob
    yes….
    almost any application on the mac supports AppleScript

    see this page for quicktime http://www.apple.com/applescript/quicktime/

    quick snippet

    tell application “QuickTime Player”
    activate
    open “Macintosh HD:Users:massimo:Desktop:hello.mov”
    present movie 1 scale screen
    end tell

    cool eh? :)

    Comment | 27 April 2007
  • Max

    You can hide the window and it will run in the background no problem… it’s not listening for keystrokes but serial port characters therefore it doesnt need to be in the foreground

    The source stays with me. It’s developed with a commercial development environment anyway.. I can’t release everything I do as opensource… I have to pay rent too :)

    Comment | 27 April 2007
  • boppyer

    thanks Massimo,

    this is great :-)

    Comment | 27 April 2007
  • [...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way (tags: arduino applescript mac remote roomware) [...]

    Pingback | 28 April 2007
  • [...] tinker.it encontramos un pequeño proxy que permite ejecutarAppleScripts en función de acciones hechas sobre Arduino. Esto permite [...]

    Pingback | 7 May 2007
  • Crosius

    Wow. So now we can tie Arduino projects to the Indigo/X10 home automation solutions via AppleScript. This rocks.

    Comment | 21 August 2007
  • Massimo,

    Great app. Do you think it will ever pass values to AppleScripts? For instance, values from a sensor reading?

    Comment | 26 October 2007
  • [...] Here is a modification of this code illustrating the principle of edge detection, just sending out a value whenever the state of the switch changes (and not everytime the arduino checks the state of the input pin). This would be useful for instance if used together with tinker.it´s applescript proxy [...]

    Pingback | 30 October 2007
  • MacDub

    I’m installing a mac mini in my car as a “carputer” running front row for accessing music and video. I’ve been working on a way to take my steering wheel controls and map them to keypresses over usb for front row. This, combined with the Arduino, will be perfect. Thanks! :)

    Comment | 21 November 2007
  • Roland Latour

    I have developed a method of communicating with
    Arduino Diecimila via USB using shell scripts under
    linux. The scripts look odd because they contain
    embedded ^M’s. Not complete yet, but functional. Try it:
    wget http://207.14.167.161/SMS1.tgz

    Comment | 11 February 2008
  • Roland Latour

    My script package has advanced considerably since
    the above post. Full IO & PWM control. AD is scaled
    to milliVolts and formatted for import to most spread-
    sheets. No more embedded ^M’s. Same wget command
    as above. Also reads IO pins, all at once. It’s a limitation of SimpleMessageSystem (IMHO a bug). Reading IO
    pins while doing PWM stops the PWM.

    I think it’s time to expand SimpleMessageSystem to
    include the servo/motor library, and fix the readIO
    problem. Meanwhile, it’s quite usable. Give it a try.

    Comment | 29 March 2008
  • [...] combine projections that react to the music. Their latest project includes one Arduino board, the Tinker.it software to communicate to Flash and a shield designed by K3-alumni Markus Appelback aka [...]

    Pingback | 28 May 2008
  • [...] po di tempo fa ho scritto un’applicazioncina per il mac che permette ad Arduino di lanciare degli AppleScript e cosi prendere il controllo del [...]

    Pingback | 5 June 2008
  • Hey
    There is another web proxy called “ASProxy”. This proxy is active since two years ago.
    I think it’s better to don’t call your application name “ASProxy”. It conflicts.

    http://asproxy.sourceforge.net/
    http://www.codeproject.com/KB/aspnet/asproxy.aspx

    Comment | 14 June 2008
  • Roland Latour

    My shellscript package (described above) now includes a GUI via the Xdialog command. Available 24/7 at http://user.cavenet.com/rolandl

    Comment | 21 September 2008
  • Great app! is it possible to control ASproxy itself with applescript? (IE to do something like have it automatically load a file containing needed mappings when the app starts up)

    Comment | 11 October 2008
  • [...] po di tempo fa ho scritto un’applicazioncina per il mac che permette ad Arduino di lanciare degli AppleScript e cosi prendere il controllo del [...]

    Comment | 30 November 2008
  • spycake

    Nice application! I second the suggestion by Sean above for AppleScript control of the ASProxy program. Ideally, I would like to be able to automate launching the ASProxy application, loading the correct mappings, and opening the port.

    Any chance you could release the AppleScript source for this thing? I’m unfortunately not a serial port expert, but with that code finished, I could probably implement more AppleScript features on top of it (scripting, dictionary, etc.).

    Comment | 22 December 2008
  • [...] a comment I just ordered a Arduino USB Board from Spark Electronics. I plan to use it with tinker.it’s Applescript Proxy program to use with Indigo and my home automation system. I have a Weeder board, but I’ve been too [...]

    Pingback | 8 January 2009
  • Sam Grosset

    Hello. I’ve tried this with no luck so far in connection with my arduino. It seems while the arduino app is open, it takes the serial connection, so asproxy cant read from the serial because the arduino program is running.

    Can i share my serial with more than one application? How did you solve this problem?

    Comment | 23 February 2009
  • Pierangelo

    i try tinker.it’s Applescript Proxy program, but with my arduino the app it doesn’t work. i have an w/ATmega168..

    Comment | 24 February 2009
  • [...] calls and having them control the applications was harder than I expected. My first plan was to use ASProxy, a program which runs different AppleScripts based on a character received over serial. Sounds [...]

    Pingback | 16 May 2009
  • [...] on this topic. I just ordered a Arduino USB Board from Spark Electronics. I plan to use it with tinker.it’s Applescript Proxy program to use with Indigo and my home automation system. I have a Weeder board, but I’ve been too [...]

    Pingback | 22 May 2009
  • Hi there I’m fairly new to programming but have had a play about with this and it’s great. I’m trying to develop a sketch that activates quicktime, plays a .mov and initiates a sequence of servos at the same time …. Using the advice from this page and a sketch I’d written for the servos. I have got it to work except that —

    I need a serial.print “A” sent to asproxy once in every loop without pausing, at the moment it is sent every few seconds and restarts the video. I would like it to run once at the beginning of the void.loop — with no delay so that the action of the servos follows immediatly.

    I’m trying to ’sync’ the servos to the movement in the videos.

    Thanks again, I’d really appreciate any help with this. xx

    Comment | 17 July 2009
  • designswarm

    Hi there,

    The Arduino forums are the best place for any support questions these days.
    http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl

    Good luck!

    Comment | 17 July 2009
  • Thank-you I’ve just posted there. Fingers crossed. xx

    Comment | 18 July 2009
  • Moustic

    Hello,

    Is there any chance to see the source of this proxy on the net ?
    on http://code.google.com/p/tinkerit/ for example ?

    I often use this proxy but i’m afraid to see it broken one day on a new version of OSX. so maintainability is a good reason.

    Another good reason is that is it not so easy to find tutorial how to interface an arduino with a osx application. it could be a good example how to do.

    regards,

    Comment | 14 January 2010

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | © 2008 Tinker.it! Limited | London & Milan