Saturday, February 18, 2017

Reusing a VCR Remote

They don't make things like they used to anymore. Technology has certainly advanced, but things just don't last long because they're cheaper to make than to make well. That's why it's so much fun to work with old devices. They're durable and they're simple. I'm going to work with a VCR remote with a jog wheel on it in order to make a sort of handheld video editing control board for some of the programs I use. It's time to get in over my head with USB HID devices!




This is a remote for a Mitsubishi VCR. The model number of the remote is the RM59106. You can get one of these from ebay for a reasonable cost. It is, for all intents and purposes, a regular remote. The only exception is the jog wheel. This jog wheel has a spring loaded outside and a click wheel inside. The number four was for remote identification in our household.

I hooked an IR receiver to my Arduino and loaded the IRRecvDumpV2 program onto it. It read most of the data, but was unable to figure out the values coming from the jog wheel. Why couldn't it understand those codes, but could understand most others. It also occurred to me that empty codes (0-bits in length) were following many button presses. I don't think that was the fault of the remote, rather the fault of the library decoding the signal. So I decided to investigate.

I got a logic analyzer for Christmas, so I decided to use it here. I hooked my DSLogic Pro up to the board IR sensor and looked at the pulses. Here's one of the outside of the jog wheel being pulled to the left.


This shows us something really important. We can tell from this that this remote follows the pulse distance protocol. More specifically, a larger gap after a pulse means it's a one. So here we have the 16-bit binary number 0b1110001010101100 or hex number 0xE2AC. This looked very similar to the codes the IR library was picking up. So how do we make the IR library pick up the correct data?

That turned out to be fairly simple. Whenever you decode a pulse, a bunch of information comes with it automatically. More specifically, we want to look at the raw data coming from this pulse.

This is not the same pulse. It turns out it could read the first tick on the dial just fine.
Here we look at the rawData variable. This array is organized into pulse width, gap width, etc. So we really only care about the even numbered entries starting from 2 (because this array printout starts at 1 according to the code.) If the value of the gap is larger than some number (I chose 1700), then that bit is a one. Otherwise, it's a zero. I wrote an Arduino method to decode this and it was dumping the correct numbers. It also turns out that some of the buttons have double meaning depending on if the remote is in TV or VCR mode. Here are all of the codes for the remote (you're going to have to zoom in):

Okay, so how do we make these buttons trigger things on our computer? The answer is this neato Arduino Leonardo compatible board with a full USB connector printed right on the board.


This little guy actually worked better than I expected. I plugged it in and it showed up immediately as an Arduino Leonardo. I uploaded some test Keyboard code and my computer immediately recognized it as a keyboard. It typed and I could still program it. I thought this was going to be a low-tier Chinese piece of crap. It isn't so far. I'm going to get another one because this is actually pretty neat.

I want this to be a simple USB dongle, so I designed a quick circuit with an RGB LED to determine the mode. I'm thinking that the LED will indicate what program it's using by its color. We'll define what those colors are when we actually code the device. I decided to do this on perfboard because I've never used it before. It's not pretty on the bottom, but it's going in an enclosure, so it doesn't really matter as long as there are no shorts. For a first time, I'm relatively proud.


Next, I trimmed the board and put the microcontroller on it. After it was cut down to size, it looked like this:


So now we have to program it. We do have a limited space to work with, Most of it is going to go to the key mappings; we'll have a lot of them.

For Premiere Pro, I used this key map. I also gave some extra coding to the outer jog wheel. This code is tricky and kinda unstable. The debounce method I'm using isn't very smart and the remote isn't super consistent. I also don't have Premiere CC, so I can't select with my remote just yet, but I do plan on upgrading and I do plan on getting the ability to select and ripple delete from the remote.

At the time of writing, I still haven't mapped all of the buttons or made a second mode. However, everything works: mode switching, modifier keys, jog wheel, and complete mappings are supported. You can find the code in this GitHub Repo and you can modify it to your heart's content. I'll finish the mapping as I find shortcuts that I want to map.

No comments:

Post a Comment