Archive for October, 2013

22
Oct
13

Fun with the Apple IR Remote, Part 2: Modifications

In the first part of this series of posts, I described the Apple infrared (IR) Remote system and some software which allows you to use the IR signals for controlling apps on the Mac.

In this post I take a closer look at the Remote controller itself, and describe the way I modified mine.

I must say that I’m not familiar with the silver aluminium remote, although I have no reason to believe it’s substantially different on the inside from the original white remote.  This is the one I have experience of.

What’s good about the white remote is also what’s bad about it – it’s very tiny.  This is great if you just want to tuck it away somewhere and not have a bulky TV/DVD player-type remote to lug about, but not so good from the point of view of it easily being overlooked or mislaid.

So, one reason you might want to modify the remote is to make it larger and more suitable for the human hand.

Frankly, the most cunning solution to his problem is the one described here by Brad Moon.  I hope he won’t mind me using his picture:

Remote wood block

Yes, what Brad has done is simply to glue his Apple remote to a hand-sized piece of wood.  Job done!  As he says in his blog post: ‘Too big to lose, too big to slip behind a cushion or slip into a pocket . . . The Apple TV remote hack has been in place for roughly a month.  In that time, the remote has been lost exactly zero times.’

This certainly takes care of the problem of the unit itself being rather small, but to address the problem of the size of the buttons themselves and their awkward layout, the unit has to be taken apart.  At the time of writing, you can still get hold of these white remotes on eBay for about £3, so if you want to try this, there’s no need to sacrifice the one that came with your Mac.

This is how it’s done:

1_IMG_1533

The picture above shows the unit and the tool (or maybe one of the two tools) you need to open the remote unit.  This is a small Philips or crosshead screwdriver.

As well as being used in a moment for taking out screws, the first thing you can do with it is poke the small depression on the right-hand side of the base of the remote unit.  This releases the battery tray, which pops out on a spring:

2_IMG_1534

Next, you have to undo a screw which is right down inside, next to the release button:

3_IMG_1536

Undo the screw and take it out:

4_IMG_1535

The next bit is the most difficult.  On the opposite side – the lower side in these pictures – is the spring which pushes the battery compartment out.  The spring is firmly attached to the bottom of a small piece of plastic, and you have somehow to grab this piece of plastic and pull it out, with the spring on the bottom of it.

The next picture shows what the spring and the plastic piece look like.  You might reach in and grab it with tweezers or narrow long-nosed pliers, but it’s right up against the edge of the case, and hard to get hold of:

6_IMG_1538

If you look at the full-size version of the picture, you can see that the piece of plastic has tags on it, so I was able to poke the screwdriver under a tag and drag the plastic and spring out.

Underneath where the spring was is another small screw.  Unscrew this and take it out:

7_IMG_1539

You can then pull the battery compartment out.  I did this with a pair of narrow pliers, gripping the white release button, which you can see in this photograph.

8_IMG_1540

Then you can push out the remaining parts left inside the case.  I did that by inserting the screwdriver here:

9_IMG_1541

The circuit board, with the springy battery connectors behind, slid out very easily:

10_IMG_1542

You can carefully detach the end  piece from the circuit board, clicking it off the tabs which hold it in place over the end of the board and the IR LED:

11_IMG_1543

This an exploded view of the remote, with all the parts visible:

11B_IMG_1547

Putting it back together, of course, is the reverse of this procedure.  The trickiest part is undoubtedly getting the spring and its plastic top back in.  This video by Andrew Williams, to which I’m greatly indebted: http://www.youtube.com/watch?v=vuP6CH770NM shows a remote being put back together, and explains the direction in which the tabs must face – front and back – for the plastic piece to go back in the correct position.

*

I wasn’t interested in putting it back together again, so I looked more closely at the circuit board:

12&13_IMG_1545&6

You can see in the top part of the picture the infra-red LED and the 6 buttons.  You can also see 4 screws which attach the circuit board the the plastic fitting.

The first thing to do was take off the six silver ‘domes’ which make the contacts when the buttons are pressed, and see what connections they made.  These are often, in my experience, attached together to a transparent sticky sheet which peels off, and so it was in this case.

Remote PCB IMG_1554

As you can see from this photograph – taken after I’d removed the four small screws holding the PCB to the plastic fitting – each button makes a contact between an outer ring and a centre spot.  All the outer rings were connected together, to what looked like +V, while the six centre spots were separate.  What I wanted to do was transplant the board into a larger unit, so I needed to solder seven wires to the board, and connect them to buttons in the new unit.

The larger unit I’d chosen was this one:

vtech_tinytouch_phone

This is a vtech Tiny Touch Phone: it’s powered by two AA batteries – 3v, same as the Apple Remote; has 12 buttons – exactly twice as many as the Remote, which could be handy for dissociating short, long or double presses; and has flashing lights – which is always good.  It also makes sounds, and under normal circumstances I would be looking to ‘bend’ these, but in this instance making noises wasn’t what the project was all about, so I decided I’d remove the sounds completely by taking out the speaker.

The Phone also has a hollow plastic ‘antenna’, which was perfectly placed for installing the IR LED.

aerial

This is what it looked like inside.  In  this picture the large mechanical unit, which looks like the film sprockets in an old 35mm film camera is obscuring the speaker housing.  With the speaker removed there looked as though there’d be plenty of room for the small Apple Remote PCB there.  The wires for the LED could easily pass from there up into the antenna.

Phone inside IMG_1552

The general idea would be to rewire the button connections on the Apple Remote PCB to the Tiny Touch Phone buttons.  The Phone buttons (visible in the first picture above) are, however, hollow, and make connections with a membrane, rather like  QWERTY keyboard, via their edges .

I wanted to leave the membrane intact, to operate the flashing lights, so I decided to add small tactile switches with longish 3.5mm actuators which would be glued in the hollows with the actuators sticking out through a hole in the top of the Tiny Touch buttons.  It was these switches which would actually operate the IR remote.

Gluing these in without gluing them together so they wouldn’t function proved difficult.  Letting superglue anywhere near them – even the gel type which I usually use – could prove fatal, as it has a habit of running everywhere.  In the end I used epoxy, which is stickier and less runny, and tiny pieces of tissue paper soaked in epoxy to keep the switches in place.  The moon and star buttons aren’t hollow, so I stuck tactile switches with short 1mm actuators to the top of them, on the outside, with wires running in through a small hole.

In the end I only connected up the star: it would have been difficult to make the hole in exactly the right place in the moon and route the wires inside without disturbing the membrane too much.  The star operates the ‘Menu’ button, which is less important than the others and doesn’t require more buttons to distinguish types of presses.

Buttons IMG_1550

In the event, all but one of the tactile switches worked after this treatment, which was OK, as there were two new buttons for each button on the original remote, so all functions would still be available.

To modify the new unit, I first removed the speaker and replaced it with a resistor (two 22Ω resistors in parallel, actually, as I had these lying about.  I didn’t have any 8Ω resistors to match the speaker, but 11Ω, I reasoned, was close enough).

This created enough space in the top of the unit for the small Apple remote PCB.

I reinstalled the buttons in their places and connected the tactile switches together.  One side of each switch was connected to +3v, the other sides of the switches were connected together in pairs (except the moon, as explained above).  This made 7 extra wires running down to the bottom of the unit.  The presence of the wires might have an effect on the operation of the TouchPhone’s original buttons, but this wasn’t important as their only function now was to light up LEDs when the remote was operated, a feature which Apple neglected to provide in the original.

Buttons_connector_IMG_1574

As can be  seen in the above picture, there was just about enough room for a 9-way D socket in the base of the unit.  I put this in partly because it would allow for external operation of the 6 remote buttons – perhaps by means of a footswitch – and partly because it provided a handy link point between the tactile switches and the Apple remote PCB.

To attach the remote PCB, wires were connected to the centres of the 6 switch points, and one of the outer rings, which were all connected together on the board.  3v and 0v power cables were connected to the springy metal pieces which formerly connected to the coin-battery in the original remote housing.  These connectors were shortened in order to fit the PCB neatly in the space where the speaker had been.

PCB_LED_IMG_1577

At the same time I detached the infrared LED and put it on the end of a longer lead, so it would reach to the front of the unit when in operation.

At this point everything was connected up, although not back in place, so I made a quick check, using iChat and the laptop camera in the way described before.  I pressed all the buttons in turn, pointed the unit at the camera, and watched for the infrared LED to come on.

When I was satisfied that it did so, I replaced the membrane and the TouchPhone PCB, as this would make pressing and testing the buttons a great deal easier.

*

For the next step I needed a way of thoroughly testing if the remote worked as intended.  I did this by creating a Tester program, using iRedLite.

It takes quite a few steps to create a ‘Layer’ – a set of instructions for each remote button – in iRedLite, but this is how I created a ‘Remote Tester’.

The ‘Menu’ button has special functions in iRedLite, but the other 5 buttons respond to short presses, long presses and double presses, so 15 separate instructions would be required.  What I decided to do was use Text Edit, and simply have it print the numbers 1 – 15, according to which remote button was activated.

Step 1 was to open iRedLite.  You can set it up in various ways in the preferences, but I have it set so it just opens an icon in the menu bar:

1 iredlite menu bar

The first step is to select the Editor from the drop-down menu:

2 Show editor

This brings up the Editor screen.  The top half of the window is a copy of what iRedLite calls the OnScreen Display (OSD).  The bottom half allows you to edit Layers and Buttons, and select the actions the buttons perform.  I began by creating a new Layer for my Text Edit actions:

3 New Layer

Then I entered the details of this Layer:

4 Name new layer

I typed a name for my Layer into the ‘Title’ box, and then made choices about what would happen when the Layer was selected.  I chose not to have the Layer activated when I switched to Text Edit, in case I wanted to type some text while using iRedLite with another application; but I did choose to have Text Edit activated when I switched to this Layer, because the actions all required text to be typed in it.  I have several remotes, so to be certain which remote was being tested, I set it to respond only to a particular one: in this case, the one with the ID No. 214.

Having finished creating the Layer, I clicked on the small arrow in the bottom right-hand corner of the Editor window.  I believe they call this the ‘Expert’ button, but it’s simply for accessing the section where actions are created and organised.

5 Editor window

Clicking this button opens the right-hand side of the Editor.  In here, if you look in the ‘Application’ column and can’t find the application you intend to use the remote with, click the ‘+’ button at the bottom of the column to add it to the list:

6 New Application

Type the application name in the box which appears.  The program will be recognised if its name is written the same as it would appear if you moved your mouse over it in the Dock.  Text Edit is actually written ‘TextEdit’, so that’s what I typed in the box:

7 Type New Application

Next you have to create a ‘Group’ – not for any special reason, I don’t think: it just works that way.  If you create a lot of actions for one particular application, this allows you to put different types of actions together, i.e. Keystrokes in one Group, AppleScripts in another, and so on.

I just wanted keystrokes, so I created a group called ‘Keys’.  Group names are your personal choice.  Once again, I clicked the ‘+’ sign under the ‘Groups’ column, and typed ‘Keys’ in the box which appeared.

8 New Group

Then it was time to create some actions.  Each action is entered individually, so I had to click on the ‘+’ sign at the bottom of the ‘Actions’ column 15 times, name the actions in the boxes which appeared, and specify what was to be done.

They were all more or less the same, and this is an example:

9 Create actions

Click the ‘+’ sign; name the action – again, this is entirely your choice: I just called them ‘1’ to ’15’; type the name of the application, or choose it if it appears in the drop-down list; check the box if you need the application to come to the front – which I did, because I wanted to read what it had printed; and type in what keystroke or keystrokes should be made.

Allocating the actions to the buttons is just a matter of dragging and dropping the action onto the appropriate button, and clicking ‘Assign Action’:

10 Drag and drop

The button will be given the name of the action – in this case ‘1’, which is the name I had given to the first action, which was to print the number 1.

11 Button number 1

You can rename the button, and I did, calling it ‘1/2’.  This is the reason why:

iRedLite shows the pattern of buttons in the way that it does to indicate that the button nearest the centre performs the short press action (which they call ‘Action on click’), while the button on the outside performs the double press action.  In reality, of course, these actions are performed by pressing exactly the same button on the remote, but it makes it clearer to see which number of presses produces which action.

So the ‘short press’ and the ‘double press’ are specified, but the ‘long press’ action (which they call ‘Action when holding’) remains to be allocated.

I decided to add the long press action to the instructions for the inner buttons, so in the example below I selected the appropriate inner button (Action 4, the ‘+’ button on the remote) and the ‘Advanced’ tab.  This allowed me to drag and drop the action I wanted to be performed as the long press action, printing the number ‘5’.

12 Button 4_5

I added a long press action to buttons 1 (the ‘Left’ button on the remote), 4 (the ‘+’ button), 7 (‘Right’), 10 (‘-‘) and 13 (the centre button) and renamed the buttons in iRedLite accordingly (‘1/2’, with ‘3’ being the double press action for that button on the remote; ‘4/5’, with ‘6’ as the double press, and so on).

When I’d finished, the set-up looked like this:

13 Finished

Note the button in the top right-hand corner,  marked ’15’.  There are 12 more places in the grey area of the button window where you can drag and drop actions, 6 on the left and 6 on the right.  If you drag and drop an action somewhere in the grey space, a new button will be created there.  This might come in handy if you had a modified control with differently positioned buttons.  In this case, I used one of the spare places for the double press action associated with the centre button.

Removing buttons, should this be necessary, is one of the functions on the drop-down menu where I chose ‘New Layer’ at the beginning.

I opened Text Edit and pressed all the buttons in order, single press first, then long press, then double press, hoping to see the numbers 1 to 15 displayed.  This what I saw:

14 Text Edit Numbers

The numbers were all printed out in order, so the combinations of short press, long press and double press all worked as predicted – but the long presses produced a continuous stream of outputs, even though I tried to take my finger off the button as quickly as possible.  The exception was the Centre button, which produced a single output of the number ’14’, no matter how long I held the button down.

This behaviour might not be what you require if, instead of printing numbers, you want a single specific action to be performed.  You might find the action repeated many times unless you’re able to take other steps to avoid this.

However, for testing purposes, this was fine, and I had established that the remote should, with iRedLite, be able to distinguish between 15 separate actions, despite only having 6 buttons.

*

The final stage of the project was to try out the new Tiny Touch Apple IR Remote to see if it would function correctly, using the iRedLite TextEdit Tester.

I quickly opened Joystick and Gamepad Tester to check the ID number of the new remote, which was 211.  I then opened iRedLite, went to the correct Layer for my Tester, and changed the remote number to which it would respond from 214 – the remote I had originally use to create the Layer – to 211.

The TouchPhone has a Power switch, but in fact the IR Remote worked even when it was in the ‘off’ position; in the ‘on’ position it worked with added lights.  As before, I pressed each button in turn with a short press, a long press and a double press, checking to see that the correct numbers were printed in Text Edit.

They were, so now it was safe to put the unit back together.  I glued the IR LED into the ‘antenna’:

top IMG_1580

fixed the 9-way socket in place:

bottom IMG_1584

and  wrote the ID number on the back.  Now I had the world’s most colourful Apple IR remote!  It could have been the world’s noisiest, had I not removed the speaker, but I felt this would be gilding the lily – and would probably have been a distraction, given that I had conceived of the remote as being part of a sound-modifying system, not a sound-producing system.

Alternative Remote

I was a little upset as, just as I was putting it back together, I broke the plastic link behind the ‘telephone’ button that mechanically ‘winds the film’ and changes the picture on the screen.  However, this only deprived me of more ways of turning LEDs on, and didn’t in any way affect the IR  controls, so ultimately I was satisfied with my achievement.  I didn’t want to spend more time on it at this stage as I wanted to move onto the next part of the IR project.

[Edit: I’ve since managed to get hold of another Tiny Touch Phone and replace the broken film winder, although I haven’t yet had time to change the tactile switch that got glued together].

For this, see Part 3: Additions.

07
Oct
13

Fun with the Apple IR Remote, Part 1: Making it work

This article, by and large, is for Mac owners, as it describes the Apple infra-red (IR) remote control system that’s been used on and off in Apple machines for about 7 or 8 years.  There is an article here which describes the remote being used on a Windows PC, and here on a Mac running Windows, but I imagine these are not common usages for this system.

In fact, I don’t believe the Apple IR system is well known at all amongst Mac users, and I hope this study will show that it can be more useful to music makers than was previously thought.

*

From about 2005, Apple began adding an infra-red remote capability to their machines, which came with an attractive little remote control like this:

Remote IMG_1519

It’s not clear from the picture, but if you haven’t seen one, it’s quite tiny – about 8cm by 3cm.  I’ll be returning to that point in Part 2.

The IR system began with the iMac G5 and quickly spread to the white Macbook, Macbook Pro and Mac Mini.  A slightly larger silver aluminium version of the remote came out in 2009, but also in that year Macbooks stopped being made with IR capability.  It remained as an option on the Macbook Pro, but the remote itself wasn’t being bundled with the laptop.

This is the silver remote.  Note that the ‘Play’ button has been moved from inside the ‘+’, ‘-‘, ‘Left’ and ‘Right’ buttons, and placed separately, to the right of the ‘Menu’ button.

Aluminium remote2 MC377

At the time of writing, the Mac Pro and Mac Mini seem to have built-in IR capability.  It’s difficult to keep track of what does what, however, as newer models of computer seem to be dropping this feature and users are being encouraged to use an iPhone app which does a similar job; but if it has one of these on the front:

IR Sensor IMG_1521

then it’s got IR built in.  The one area where the control seems to have remained popular is with the Apple TV/Home Theatre users.  There was an application called Front Row, which used the remote to control films and music, but I don’t believe this has been in use since OS 10.7.

All of this is a shame, as the ability to control your computer wirelessly can often come in handy, and several companies produce excellent software which greatly expands the ability of the Apple remote to control pretty well any application in any way you want.

Of course, if you have a Mac, then you very likely have the luxury of Bluetooth as well, and I have blogged, or will be blogging, about various uses of Bluetooth.  However, it could be that your Bluetooth system is fully occupied with, say, your wii controller, and this extra way of passing information to your computer becomes a vital necessity.

Although most of the following is based on my experience with my MacBook, which has IR built in, I’ll be speaking about things one might do to add IR capability to a non-IR Mac.

*

First of all, then, the controller and getting it to work:

There are three things to do to make sure your IR remote is potentially going to work.  The first is to ensure that the battery is OK; the second is to confirm that the infra-red LED is lighting up; and the third is to make sure the computer’s IR capability is turned on.

The remotes are powered by a CR2032 coin battery.  Apple designers, as we know, live in a world where bent paperclips are always to hand, so with the white remote – like the method of ejecting stuck CDs – there’s an indentation in the bottom of the case which can be poked with a bent paperclip to eject the battery tray.  In this case it isn’t inside a small hole, so a pen, pencil, or a 3.5mm headphone plug will also work perfectly well.

As illustrated, the silver remote has a different method: a battery compartment which is opened by twisting a small coin in it.

Battery change2

As for checking that the remote is functioning, the essential problem with this is that the light it gives off is infra-red, and therefore you can’t actually see it.

Fortunately, though, cameras can!  So if you have a laptop with a camera at the top here:

Camera IMG_1523

all you have to do it open something like iChat, go to Video > Video Preview and film yourself pointing the remote at the camera and pressing buttons.  If you can see a light like this:

Battery test

then the unit is working.

Finally, you just have to make sure the IR capability isn’t turned off.  Do this by opening System Preferences > Security, and look for this:

Security preferences2

Make sure the box isn’t checked and it says ‘The computer will work with any available remote’.

While on this subject, it’s worth noting that this might not be the situation you want.  If you’re in an environment where there are several remotes in use, you might want  your machine to respond only to yours.  Under these circumstances, the ability to ‘pair’ your remote and computer might be very useful.  Clicking this button:

Pair3

will enable you to do that (provided you’re logged in as an Administrator).

When you click it, it tells you how to do the pairing:

Pair2

Rather like a wii controller, you point the remote at the computer (but in this case it must be from just 3 or 4 inches away) and press the ‘Menu’ and ‘Next’ (‘Right’) button at the same time.  After a few moments (maybe 5 seconds), the following large icon will appear on the screen, with the ‘link’ sign flashing:

Pair icon IMG_1523

The remote and the computer are now paired; the ‘Pair’ button changes to an ‘Unpair’ button, and the text now says ‘This computer will work with only the paired remote’.

The process of unpairing them is simply a case of clicking that button:

Unpair2

Using the remote itself, you can unpair it by pressing ‘Menu and ‘Left’ at the same time, for about 5 seconds.

According to Apple, the remote works up to 9 meters (30 feet) from the receiver.  Unlike Bluetooth, of course, we’re talking about light here, so there can’t be anything in between the remote and the receiver that would block the signal – although you might be lucky and able to bounce the signal off a wall on on its way to the receiver.

*

So, now the remote is working, what can you do?

The answer is, not a lot.  You can use Front Row to watch films or listen to music, unless you have a modern operating system, 10.7 or later; you can remotely control iTunes, or you can make your computer go to sleep and wake up.  Not very practical for making music, which is, after all, what this blog is about.

[Edit: since writing the above, I’ve installed OS 10.6 and a newer version of the program VLC, from Videolan, an excellent free audio, but predominantly video, file player.  Some of VLC’s functions can be controlled with the Apple Remote, which is handy.  I don’t know if this can be done with earlier versions of Mac OS].

So, an important part of making the remote work would be to find some suitable software to interpret the input.

The first thing I looked into when I got my remote out of the cupboard and got it working was whether it would work with PureData (Pd).  Many types of HID (Human Interface Device) will act as musical instruments or effects devices – as I have described in the blog before – and so can the Apple IR Remote, although only to a limited extent.

I used a generic ‘HID Tester’ patch which I had created for investigating different devices, and determined first of all that the IR system was recognised by Pd – in this instance as Device 0:

Pd device no

I activated Device 0 and pressed all the buttons in turn, but this is all I got:

print desktop2

So unfortunately Pd was only able to recognise two of the buttons on the IR Remote, ‘+’ and ‘-‘.

*

This was of limited value, so I needed to see if there was any software which could expand the usefulness of the device.

Luckily, there was.  There are several programs, in fact, which can greatly extend the range of control  the Remote can give you.

Andreas Hegenberg’s BetterTouch Tool (BTT) has a section for the Apple Remote, although is generally more aimed at the Magic Mouse and trackpad

bettertouch2

Nowadays, in fact, Andreas seems to be concentrating on the amazing Leap Motion Controller, which is going to deserve its own blog page one of these days.

I wasn’t able to test out the BetterTouch Tool: it’s free, so there’d be no problem for you downloading it (from here, for example) and trying it out, but only supports OS 10.7.  There might be a legacy version still available for 10.6, but I couldn’t find one for 10.5, which I’m still using.

I did find a screencap, though, which shows that button presses are known as ‘Gestures’.  This is an example of the window in which button presses are assigned different actions:

BTT Gesture setting

*

Mira is a dedicated Apple Remote app which, when installed, is controlled from System Preferences.  The opening view shows the remote buttons in the centre: you click on each button to assign a function to it, which may be a keystroke, system action, or instruction open a program (including AppleScripts).

mira windows

Mira supports short presses and long presses, effectively doubling the number of actions available from the 6 buttons, and provides a number of combinations of short press/long press combinations.  A comprehensive Help menu is available by clicking the ‘?’ button in the bottom right-hand corner of the Mira window.

Duo Press_Help

Mira is available from Twisted Melon in versions for OS 10.4+ and 10.5+.  Also available, for the deprived Mac with no IR receiver, they offer the Manta TR1 plug-in USB IR receiver.  At the time of writing Mira costs $15.95 (Canadian) for single licence and $29.99 for 3 licences; the Manta TR1 costs $19.99; and a bundle of 1 Mira licence and a Manta costs $29.99.

*

Remote Buddy looked particularly promising as it also offered control of wide array of remotes, not just the Apple remote, but other makes from the likes of Griffin and Sony, iPhone and iPod Touch, and even Nintendo wiimotes.  OS 10.4.6 and above are supported.

Remote Buddy also installed its driver, Candelair (also available as a free stand-alone).

Configuring the remote’s buttons consists of specifying an application – although ‘Default’ and ‘Virtual Remote’ options are available – and defining a group of actions called ‘behaviours’.

Picture 2_2

There are appropriate suggestions for each application, and you can create your own Custom actions.  Like Mira, Remote Buddy supports short and long button presses and allows the same kinds of action choices; Help is available from the Remote Buddy menu.  It costs €19.99.

As a matter of fact, once I had installed Remote Buddy/Candelair, the following entries showed up in PureData:

Pd Remote Buddy_Candelair Devices2

Opening these device numbers, I was able to see two more actions displayed:

Pd long press l & r2

However, I wasn’t able to use these with the [Route] object, as one normally would.

Even if you don’t use Remote Buddy, I’d recommend installing Candelair, as I’ve encountered a number of instances like this where the presence of this alternative driver allows you to do things that can’t be done otherwise.  It can be controlled – even uninstalled – in System Preferences:

Candelair Screens

*

Undoubtedly, the be-all-and-end-all of infrared applications is iRed.  Designed to work with the iTrans infrared module – which transmits as well as receives  – this system can, in a nutshell, allow you to control your computer with any infrared control and allow your computer to control any device with an infrared receiver.

Possibly slightly extravagant for present purposes – and it doesn’t work with the standard Apple IR receiver, of course (which doesn’t transmit).  However, iRed Lite is much more the sort of thing I’m considering here.

In fact, for several reasons, this is the one I chose to use, partly because it’s free, partly because I liked the flexible onscreen display window, partly because it recognises short presses, long presses and double presses.

When opened, all that appears is an icon in the menu bar.  Clicking on this icon brings up a choice of actions, including opening the Onscreen Display or the Editor window.  This view of the Editor windows shows some of the important features:

Edit window

1.  This panel replicates the Onscreen Display.  The buttons are laid out here in the same format as the buttons on the remote.  The ‘extra’ button at the end of each row is for the ‘double-click’ action.

2.  This section, when the ‘Button’ tab is selected, allows for changing the style of the buttons.

3.  In this section the action performed by the button can be changed.

4.  This drop-down menu, as the name suggests, allows the settings for different Layers to be displayed.  A Layer is a collection of actions, usually applying to the same application.  When a Layer is active, the actions described in that layer are the ones which will be performed when the remote buttons are pressed.

5.  This drop-down menu gives access to more functions, such as remove selected button, create or remove a Layer and open the Character Palette for access to special characters and symbols.

6.  Clicking this arrow reveals or hides the sections on the right-hand side of  the picture in which more complex actions can be specified.

7.  Clicking on the ‘Add Action’ button allows actions to be specified which replicate keystrokes or mouse movements; a third possibility is to run an AppleScript.

8.  The special action is chosen in this area.  The picture shows a simple AppleScript to initiate an iTunes function.

Actions can be dragged and dropped onto the buttons in the panel on the left and different patterns of buttons can be created for ease of understanding or to match modified remotes.

*

Modified remotes is the subject of Part 2 of this series of posts, but before we leave the topic of software, I must just mention a small command-line app which runs from the Terminal.  I haven’t yet worked out if this is potentially useful or not yet, but it’s called iremoted and ‘listens for button-press events and prints the identifier (the HID element cookie, to be precise) of the button in question’.

A description of the program can be found here, together with the source code in a file called iremoted.c.  Its GitHub entry is here.  I compiled it from the Terminal by typing the recommended instruction ‘gcc -o iremoted iremoted.c -framework IOKit -framework Carbon’.

When I ran it, sure enough it showed me the HID element of the code sent by each button press, like this:iremoted Terminal window2

It’s interesting that ‘+’ and ‘-‘ were the only two buttons that showed an entry when pressed before another entry when released.  Whether this has anything to do with the fact that they were the only two buttons to show up in PureData, I don’t know.

The above isn’t the only information passed via the infra-red link when a button is pressed.  I’ve read numerous articles on the subject which, frankly, I don’t understand – they either don’t say the same thing, or they say the same thing in a different way . . . suffice it to say that 4 different pieces of information are transmitted each time a button is pressed, according to the NEC Infrared Transmission protocol, which Apple remotes use (in a slightly non-standard way): the first two are purely Apple’s own ID, the third is the instruction code, as above, and the fourth is the remote’s individual ID.

*

The individual remote ID is the final thing I want to deal with in this post – which I ought to do, as I glossed over it rather surreptitiously when talking about ‘pairing’ earlier on.

When you pair a remote with your computer, you’re not pairing just any remote in the vicinity: you’re pairing a particular remote; and the way the computer knows which particular remote is being paired is because of its individual ID, which is a number from 0 to 255.  This isn’t fixed: it can be changed, although not to a number of your choice.

The advantage of pairing a remote is that you can – as  in my earlier example – ensure, in an environment in which several remotes might be in use, that your computer responds only to your remote.  If by some chance you find yourself in a situation in which there are two remotes with the same number, you can change the number and re-pair it.  To change the number, all you do is press ‘Menu’ and ‘Play’ (the centre button) at the same time, and the number will increment.

I have read that the remote will attempt to pair when you do this, so if you don’t want to pair at the same time, do this outside the distance from the computer (3 or 4 inches) which is required for pairing to work.

So, pairing can be useful.  But what might be even more useful is not to pair a remote with your computer, but to allow the computer to recognise individual remotes by their IDs and have them do different things.  Programs like Remote Buddy do this, as the following screen shots show:

Multiple Remotes

Checking the box ‘Enable support for multiple remotes’ – indicated by the arrow at the top – brings up the list beneath.

In the right-hand column, remotes are distinguished by their ID number, not paired, but associated with different ‘behaviour’ groups.

*

In the iRed Lite Editor window, clicking on the ‘Layer’ tab brings up a number of parameters that can be altered, one of which is the ID of the remote which will control this layer.  The actions described will not be performed by another remote with a different ID.

iRed Layer window2

This raises the possibility of using a number of separate remotes for entirely separate purposes, using modified remotes with multiple ‘personalities’, or teaching a universal remote with a learning capability to mimic remotes with different IDs.  This article: http://funwithcomputers.wordpress.com/2008/03/01/using-the-harmony-880-remote-with-your-macs-built-in-ir-port/ describes a project to teach a Logitech Harmony 880 to imitate 8 Apple remotes via Remote Buddy.  In this way 48 different buttons were created (could have been 96, but long presses were not configured) and all manner of things could be controlled in a home theatre set-up.

At some point, you might want to check the ID Number of your remote.  If you’ve only got one, chances are its number will pop up everywhere.  If you have more than one, someone else uses one in the vicinity of your computer, or you haven’t really used it before, here are two ways to find out what it is.

The first thing to say is that isn’t always quite as easy as it might be, as only ID number changes seem to be registered.  If you have more than one remote, it’s less of a problem – every time you use a different remote there’s a number change; if you have only remote, the following needs to be done the first time you use your remote after booting up the computer:

Open iRedLite and select ‘Preferences’ from its drop-down menu, and then ‘Apple Remote IDs’.  It will probably show ‘0’ as the current ID number.  Press a button on your remote, and it will display the remote’s ID number, as below.  If you have more than one remote, you can check the numbers here at any time, as the change from one ID number to another will be registered (although once I was fairly sure I wouldn’t be incrementing the IDs any more I wrote the numbers on the back of each remote!)

Apple Remote ID No window2

Another useful program you could use for this purpose is Joystick and Gamepad Tester.  I’ve blogged about this at greater length elsewhere, but since the Apple infrared receiver is part of the USB system, it will be picked up by this program, which is designed to identify buttons and other controls on USB devices (such as joysticks and gamepads).
In my experience, this only worked after I’d installed Candelair, as recommended above.
I open Joystick and Gamepad Tester and click ‘Ok’:
JAGT 1
I can then choose from a drop-down list.  Instead of choosing ‘IR Receiver’, which normally shows nothing, I choose ‘IOSPIRIT IR Receiver Emulation’:
JAGT IOSPIRIT

A list of buttons and functions appears, the last being the Remote ID number.  Pressing a button on the remote shows the current ID number in the ‘Now’ column.  Any button will do, as the device’s ID number is transmitted as part of every message.  Don’t take any notice of the ‘Min’ and ‘Max’ columns, as they just show other device ID numbers that may have been used before.

JAGT ID No

*

Some of the above could only legitimately be described as ‘fun’ by those of us with a rather esoteric definition of the word.  In Part 2 I’ll progress closer to using the IR remote for modification and music-making purposes.




andymurkin

October 2013
M T W T F S S
« Sep   Nov »
 123456
78910111213
14151617181920
21222324252627
28293031  

Enter your email address to follow this blog and receive notifications of new posts by email.