VPT workshops

Well, it´s no secret that a shiny new version of VPT is just around the corner.

The first people who get to try this version are the participants of the upcoming VPT workshop in Bergen, hosted by BEK.

The workshop takes place December 6th-9th.
Sign-up information.

As part of the Lux festival in Oslo I will give a workshop hosted by Atelier Nord January 22nd-23rd 2011.
Sign-up information.

In april 2011 IMAL in Brussels will host another workshop. Sign-up information will come later.

VPT forum

I have set up a simple forum for Video Projection Tools to eventually make it easier to share and find useful information. There are different sections for bug reports, troubleshooting, wishlist for new features, examples of what you make with vpt etc.

Head on over to the forum, register and start using it:

http://www.nervousvision.com/vptforum/

ps. yesterday the blog passed 200000 visitors, hurrah.

makerbot #508

One of the things I was planning to work on during my New York residency was to construct a makerbot, a 3D printer that comes as a kit, based on the reprap which I have written about before. The cupcake cnc, which is the official name, is made by a Brooklyn based company Makerbot Industries that came out of NYCresistor. The first model came out late spring last year, and they continually improve both the mechanical,electrical and software parts for each batch they send out. For about $1000 you get all you need to make your own desktop 3D printer, which sounded like a good way of getting started with digital fabrication.

For me, one of the entrypoints into fabbing has been through reading some of Mitchell Whitelaws postings, for instance Transduction, Transmateriality and Expanded Computing. Chris Anderson wrote a very optimistic article in Wired in January: “In the Next Industrial Revolution, Atoms Are the New Bits“, which is nicely balanced by the maybe more realistic gizmodo article “Atoms Are Not Bits; Wired Is Not A Business Magazine“. A few days ago Thingiverse posted their take on this: “Atoms are Not the New Bits. Yet.

I ordered my kit in december, and in the beginning of february it arrived at my doorstep in Brooklyn. The construction took about a week. The instructions for assembling the makerbot are pretty good (although I had my IKEA moments), but to actually get the makerbot printing was a lot more complicated and frustrating than what I had expected. After trying different things for almost a month with plastic-spaghetti as my only visible result I got a replacement card for the extruder controller (the part which controls the flow of plastic), so last night I was finally able to print something which was very exciting!

The cupcake cnc is made from lasercut plywood and acrylic. It has three stepper motors: The x and y axis are moving the build-platform, the z-axis moves the extruder vertically in relation to the build platform. The printed object is buillt layer by layer:plastic filament is fed into the extruder, which heats it up and squeezes it out similar to a hot-glue gun. The controller is based on the seeduino microcontroller, which is an arduino clone.

To make an object you obviously need a file. The final file is basically a description of operations for the makerbot, controlling the position in the x,y,z axis, as well as temperature and flow of the extruder. You start off with a 3d object, made for instance with blender, sketchup or openscad. This must be exported/converted to the STL format, which can be read by the application that converts the 3D model into slices and produce the controlcode understood by the makerbot. This is done in python-based skeinforge, but some more intuitive tools have started to emerge. The makerbot comes with its own controller software, ReplicatorG, which is very similar to the arduino interface. You can choose to either save the object-code onto a SD-card, or to print the object directly from ReplicatorG.

A good place to start is Thingiverse, where people upload their 3d objects for other people to make. I find it fascinating that I can make my own version of an object somebody else has modeled. I also find the makerbot blog quite useful. Bre Petis, one of the makerbot team, gave a nice presentation(mp4) at Chaos Computer Conference in Berlin in January.

More images of #508

iphone serial communication

Apple has not made it easy to let the iphone communicate with external devices. Basically, you need a jailbroken phone to do anything. This post covers the current state of serial communication on the iphone.

A succesful example of making an application that uses the serialport on the iphone is xGPS, which let you connect to an external GPS.

There are two sites that kept showing up when I looked at solutions for accessing the serial port.
One solution described on ohscope, uses the mobile terminal app available from Cydia, in combination with a serial comunication program called minicom. Basically it lets you open a serial connection and you can send and receive data using the terminal window.
For simple monitoring of input this might be all you will ever need, and it is relatively simple to get working.

The other solution on devdot, dating back to 2007, is a serial communication application written in C, which is still the example that shows up in different forums. There has been a few changes since 2007, when Iphone was on OS 1.x.

My main interest in getting serial communication working is that it would be very helpful for some of my mobile installations like the Wind-up birds, a network of mechanical woodpeckers, where a lot of the work is setting up a network between several xbee radio modems. It also involves climbing in trees, and it would be very convenient to have small controller/monitor app on my iphone, instead of using my laptop.
I also think it would work well with my dimsun dimmers, being able to control the lights remotely.

Other options
When searching for solutions, some projects show up which claim that “the iphone controls my RC car/my garagedoor” etc, but actually the iphone is communicating with a pc which then again communicates with an arduino. This is ok for protyping, but I want to get rid of the PC part (Actually there was a project in 2008 which uses iphone-xbee to control a rc-car. The instructions are in Japanese, and it was made using python I believe).

There are some promising work being done on making the built in bluetooth work as a bluetooth modem (something that Apple has blocked). Currently the BTstack is only able to read serial data. There is a demo app showing how a wii controller controls a model of the wii on the iphone. There is also the HumanAPI project which has made an interface for a pulserate sensor, based on the BTstack and a programming environment called PhoneGap.

Maybe sometime soon it will be possible to access the serialport on the iphone without jailbreaking it. In the openframeworks forum a new serial adapter for the iphone was mentioned.

The physical connection
To get access to the serialport you need some sort of adapter from the iphone connector. I got mine here, and sparkfun stocks a few different models. You can find an overview of the pinout at pinouts.ru.

The physical connection is the easiest part. You only need three connections from the Iphone: rx,tx and gnd. Optionally you could also use the +3.3v connector, making it possible to power up your device from the iphone. I do this with my xbee connector, but you need to be careful with this, as you might break the iphone if your device draws too much current. I haven´t found a reliable source for how much  current you can draw, but have seen 80-100mA mentioned a few places. This works fine with the standard xbee, as it draws around 40mA. It would also work fine with a 3.3v based arduino, and also probably with the FIO (not sure how much current the combination of the xbee and atmega chip draws).

Using the xbee which runs on 3.3v I  connect tx_iphone to rx_xbee, rx_iphone to tx_xbee, and gnd_iphone to gnd_xbee.

If you connect the iphone directly to an arduino running on 5v, you need to have a 1 k resistor between tx_arduino and rx_iphone.

approach 1: Serial communication using mobile terminal and minicom

Before getting started I recommend installing a very useful addition to the iphone software called sbsettings, available on Cydia, which basically is like a control panel for “hidden” features on the iphone. You can also install addons like syslog, which is very useful when debugging. The mobile terminal app is also very useful.

The instructions from ohscope are pretty clear.
You need to know how to SSH to the iphone from your computer. I use a combination of fugu and terminal on OSX, Putty should do the job on Windows.  There is a good explanation on how to do this on a mac (and many other useful things) at hackthatphone.

It is much easier to configure minicom from a terminal on a computer than from the iphone terminal program. So I open terminal on my mac,
and enter ssh -l root 10.0.1.9 (ip of my iphone). The default password is alpine.

After I had updated my iphone to 3.1.2 I got an error message when trying to open minicom: “minicom cannot create lockfile. Sorry” This turned out to be a permission problem, so I navigated to   /var and changed the permission so anybody could write to lock: chmod a+w lock.

Some useful links related to mobile terminal and minicom.

mobile terminal wiki

I found some of the gestures not to be working, so I ended up mainly using the keyboard for navigation.
basic minicom commands

approach 2: make an app that can read and write to the serial port

Preparing for development on the iphone

Last saturday NYCresistor hosted an introductory openframeworks workshop with Zach Lieberman, one the creators.
Basically openframeworks makes it much easier to do interesting audiovisual programming than if you would have to write the code in C++, by wrapping low-level code in easier to use methods and functions.
I was new to both xcode, openframeworks and C, so there was a lot of new things to dive into, but it definetly helps having a background from programming with Processing.

The neat thing with openframeworks is that it is crossplatform: It runs on osX, linux, windows and iphone.  This was a perfect opportunity for me to move to step two: make my own serial communication program.

The drawback with writing code for the iphone is that you are supposed to pay $99 to be a developer. Since I am mainly interested in developing programs for using the serialport on my own phone I wasn´t so interested in paying for it. Fortunately there are ways around this, but it is rather complicated.
One way is to use the free toolchain.

I felt more comfortable using Xcode combined with openframeworks, so I searched for ways of making Xcode compile, install and debug to the iphone.
First of all, you need to register as a developer at apple and download the Iphone SDK.
Then you have to do some modifications to get around signing process. There are several ways of doing this, some of them extremely complicated. I think I found a good solution that is not too hard, and which works on iphone os 3.12 and xcode 3.21.
The basic instructions are found at the networkpx project blog. First you need to create a code signing certificate, and update your xcode target accordingly. If you only want to compile in xcode, it is very simple, you only need to change a few lines in a file (I found three places that should be changed, the instructions only mentions two).
To be able to install and debug it gets more complicated.
I used a combination of Appsync 3.1, available from hackulo.us repository on Cydia, and some of the instructions from the networkpx project blog. Basically Appsync makes steps 5-10 in the install-debug section unnecessary.
It is important to set the -gta flag in the options for your xcode project (found in the code signing section, other code signing flags).

Now I am able to use the iphone with xcode like a normal developer: I can run and debug on the iphone simulator, or install, run and debug on the iphone, which is very convenient when developing. Sometimes debugging from the iphone doesn´t work, then I activate syslog which creates a log on the iphone that I can read on my computer later.

Setting up the serial port

The port name is the first thing to know: /dev/tty/iap

The serial code itself is quite standard, so the example from devdot would probably still work, basically doing
fd = open(“/dev/tty.iap”, O_RDWR | O_NOCTTY | O_NDELAY);
to open the port.

Using openframeworks, I modified the oFserial example found in the mac distribution (this example is not in the iphone distribution).

the only thing I need to open the serial port using openframeworks is to specify portname and baudrate: serial.setup(“/dev/tty.iap”,9600);

In v0.60 of openframeworks for iphone, the iphone is not included in the serial library, so you need to manually add “|| defined(TARGET_OF_IPHONE” to each #if section in ofSerial.cpp which refers to osx and linux, so it would look like this:
#if defined( TARGET_OSX ) || defined( TARGET_LINUX ) || defined(TARGET_OF_IPHONE)
This will most likely be included in newer versions of openframeworks.

So, by modifying an existing serial code example I was able to compile and run the program but got an error saying that it was unable to open serial port.
After a hint on the GPSserial forum, I understood that my problem was related to permissions of the application. The application needs to be run as root.
I spent about two days learning about permissions and trying with setting different permissions, without any luck.
Why was I able to open the serial port via minicom and terminal and not from my application?
After some more research I discovered that in the early Iphone OS days, applications were installed as root, this was later changed as it could be a security risk. Maybe this is why the example from 2007 worked back then, because it was automatically installed as root?
Appstore apps are installed in a different location (/private/var/mobile/Applications) than Cydia apps like Terminal (/private/var/stash/Applications), and these places have different permissions. Xcode automatically installs programs in the appstore appsection, inside a folder with a long number as name, such as 03A7764B-DDE0-4A60-A56B-CF2ADBB0213F. So what would happen if I moved my app to the the other applications folder?
I was able to connect to the serialport!

There might be an easier way to move the application, but this is how I did it:  The easiest way to find the folder installed by xcode is to find the last created folder in the /var/mobile/Applications folder. Open this folder, and just copy the yourapp.app to the desktop. Then delete the folder using ssh from a terminal program. If you are in the Applications directory the command would be: rm -r 03A7764B-DDE0-4A60-A56B-CF2ADBB0213F (replace with your own folder name). Copy your.app into the /var/stash/Applications, respring the springboard (using sbsettings) on your iphone and you should be set. If you need to install a new version of the app from xcode you need to first delete yourapp.app and respring the springboard or else you will receive an error when trying to install the app.

Two demos
To show that it actually works I have made two simple demo videos showing serial input and output.


The serial output example was my first attempt at integrating Interfacebuilder with openframeworks. There is one example of how to combine openframeworks and InterfaceBuilder from ITP.

The ITP example doesn´t include any interaction between the GUI elements and the code. I found the tutorial from switchonthecode to be quite helpful for this part.
I struggled with passing data from the interface part of the code to the serial communication part of the code, but solved this the dirty way by declaring some variables as extern, as described here. The supposedly more correct way is described here.

I was not able to find a good way of updating the interface elements based on incoming serialdata, so I decided to do that in openframeworks by making a simple line that moves vertically based on data read from a photocell attached to the arduino.

If I could have written this in Processing it would have taken me a few hours. Instead it took me two days, mainly because it was a new programming language and IDE for me, but also because Openframeworks/obj C is a lot more strict on how to write the code.
It would be great if iProcessing, a javascript version of Processing that runs on the iphone, would work with the serial port. But I assume since it is a web application I wouldn´t be able to run it as root.

Ideally, it would be nice to have a way of customizing the interface according to the need of the application. mrmr (not being developed anymore I think), one of the first OSC applications for the iphone, has a nice way of letting the user create a interface template and then upload it to the iphone. It could be interesting to integrate this with serial communication, especially when working with a microcontroller like the arduino. You could then have different templates depending on the functionality of the current setup, without having to create a new program each time.

It could also be interesting to incorporate firmata, which is already supported in the desktop versions of openframeworks. This has now been done by another openframeworks user, check the openframeworks forum thread.

Here is my openframeworks code.

dimsun

The last half year I have been working quite a lot with lights and shadows, and this summer I decided to build my own lighting system, which I called dimsun. The first use of it was for my blink installation consisting of 24 leds placed in a circle.

It consists of dimmers based on the TLC5940 led controllers. Each of the dimmers can control 16 channels, up to 5w each, and are intended for power LEDS, very bright leds up to 5W. The dimmer is controlled by an arduino microcontroller, and up to 6 dimmers (96 channels) can be controlled from one arduino.

more images of the dimsun system.

The schematics will be made available soon.

The lamps are based on starshaped LED´s combined with a lens mounted on an aluminum profile.

VPT 4.1 available

Play Alter Native, originally uploaded by am4ndas.
An updated version of Video Projection Tool is now available.

Version 4.0 had a lot of under the hood changes, which unfortunately introduced some bugs. Hopefully most of them have been taken care of with this update.

There are also a few new features: different blend modes and a global moviesource drop zone.
Read the list of updates on the VPT page.

The image is taken from a project Amanda Steggell is doing for the theatre company Verk, where she is using the new blend mode feature for her beautiful emoticons video design.

VPT (Video projection tool) v4.0 released!

I am happy to announce the new version of VPT for osX and Windows xp/vista with lots of new features:

16 layers (previously 8 )
2 live sources (previously 1)
8 A-B mixers (previously 0)
greatly improved MIDI and OSC capabilities
enhanced interface
monitor preview for 2ndmonitor (single screen, matrox 2x or 3x),live camera.
lot´s of bug fixes and more efficient code.

And as always, it is free.

The sourcecode is also included, (GPL 3 license)

There is a new manual and new video tutorials covering the new features, everything available from the VPT page.

New manual for Videoprojectiontool

I have made a new manual for the Videoprojectiontool, documenting the latest improvements including cornerpin keystoning and OSC support. There is also a slightly modified version of the application, v3.1c, with some bug fixes and increased OSC support.

All available here.

videoprojectiontools v3.1: OSC

projectionlab

I have added rudimentary Open Sound Control (OSC) and MIDI functionality, and provided maxmsp templates for osc/midi for people to develop this further.

This makes it possible to sync several computers, and control the videoprojection tools from other applications that support OSC.

more info and downloads

videoprojection tools v3.0

videoprojectiontool v3.0

Announcing the latest version of the videoprojection tools, now with 8 layers with cornerpin distortion, advanced masking ++. Also there are now 8 individual video sources, 1 live video source and 1 draw source.

As before it also has a quite extensive preset and sequencing system.

It is available for free for osx and windows xp/vista.

Download application and documentation

Follow

Get every new post delivered to your Inbox.

Join 168 other followers