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 :
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
32 Comments »
RSS feed for comments on this post. TrackBack URL
[...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way – Original Link. [...]
[...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way – Link. [...]
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!!!
Awesome work Massimo! I can’t wait to try this tonight!
Marcus
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.
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? :)
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 :)
thanks Massimo,
this is great :-)
[...] tinker.it » Blog Archive » Control your Mac from Arduino, the easy way (tags: arduino applescript mac remote roomware) [...]
[...] tinker.it encontramos un pequeño proxy que permite ejecutarAppleScripts en función de acciones hechas sobre Arduino. Esto permite [...]
Wow. So now we can tie Arduino projects to the Indigo/X10 home automation solutions via AppleScript. This rocks.
Massimo,
Great app. Do you think it will ever pass values to AppleScripts? For instance, values from a sensor reading?
[...] 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 [...]
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! :)
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
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.
[...] 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 [...]
[...] 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 [...]
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
My shellscript package (described above) now includes a GUI via the Xdialog command. Available 24/7 at http://user.cavenet.com/rolandl
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)
[...] 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 [...]
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.).
[...] 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 [...]
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?
i try tinker.it’s Applescript Proxy program, but with my arduino the app it doesn’t work. i have an w/ATmega168..
[...] 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 [...]
[...] 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 [...]
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
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!
Thank-you I’ve just posted there. Fingers crossed. xx
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,