Lamps

The lamp section of this is going to be quite simple as well, although there are a couple of parts to it.

The Otari has pins for all ten of the lamps that would normally be on the auto-locator, as well as five extra that it calls MEMO (0 through 4.) The standard lamps are Rec, Play, Stop, Rew, F.F, Cue, Search, Search Zero, Shuttle and Auto-rewind. The MEMO lamps are used to indicate something has been stored in one of the 5 memory locations that the auto-locator could store. I am not going to use these, as I plan to store my locations on the computer.

These lamp outputs seem to conform to regular digital voltages, so a LOW signal (or 0) is a voltage between 0V and 1.5V, and a HIGH signal (or 1) is between 3.5V and 5V. To simplify, if the Rec pin has a voltage over 3.5V, the Rec lamp is on. If not, and it is under 1.5V, it’s off. This should work fine with what the Arduino expects to see.

The Hookup:

I am going to use the analogue inputs on the Arduino, as I want to keep the other inputs free for the display, switch and keypad parts of this project. The analogue inputs can act as either analogue or digital inputs. I will be configuring them as digital inputs. The wiring is straight forward:

 

  1. REC Lamp (pin 7) -> Input A0
  2. PLAY Lamp (pin 8) -> Input A1
  3. STOP Lamp (pin 9) -> Input A2
  4. RWD Lamp (pin 10) -> Input A3
  5. F.F Lamp (pin 11) -> Input A4
  6. CUE Lamp (pin 12) -> Input A5
  7. SEARCH Lamp (pin 36) -> Input A6
  8. SEARCHZ Lamp (pin 37) -> Input A7
  9. SHUTTLE Lamp (pin 38) -> Input A8
  10. AUTO RWD Lamp (pin 39) -> Input A9

 

The Arduino Code: 

The Arduino uses a version of the C programming language, and I am quite comfortable in C, so this should be easy.

I have written two functions: getLamps() and sendLamps(). These interact with two variables, currentLamps and lastLamps, which are both 16 bit integers. I need them as 16 bit numbers, because I am going to use one bit per lamp, and there are ten lamps, so an eight bit number isn’t large enough to hold them. Why am I squishing all of the lamps into one number? Well, I am thinking ahead to where the bottle-neck will be. The slowest thing in this project is definitely the MIDI communication, and I want to keep the messages as small as possible. When the Arduino sends the lamps to the computer, it will only have to send a few bytes, making it super fast.

This is how I will use the bits. They will be assigned like this:

Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
AUTOREW SHUTTLE SEARCHZ SEARCH CUE F.F RWD STOP PLAY REC

If a lamp is on, the corresponding bit will be set (made to be a one.) If it is off, the corresponding bit will be cleared (set to zero.) For example, let’s say the MTR-12 is in record. It should have the record lamp and the play lamp on. That condition should set my currentLamps variable to be binary 0000000011. If I then hit the stop button, the stop lamp comes on, while the play and record lamps go off. This should set my currentLamps variable to be binary 0000000100.

The Arduino has two standard, required functions: setup() and loop(). The setup() function is run when the unit first powers up, and then it enters the loop function and runs that until the power is shut off.

Here is the setup() function I will be using.

void setup() {
  pinMode(stopLampPin, INPUT);
  pinMode(recordLampPin, INPUT);
  pinMode(playLampPin, INPUT);
  pinMode(ffwdLampPin, INPUT);
  pinMode(rewLampPin, INPUT);
  pinMode(searchZLampPin, INPUT);
  pinMode(searchLampPin, INPUT);
  pinMode(cueLampPin, INPUT);
  pinMode(shuttleLampPin, INPUT);
  pinMode(autoRewLampPin, INPUT);
  Serial.begin(115200);
  sendLamps();
}

This will open up the serial connection, so I am able to send myself messages, and then it calls the sendLamps() function to show me the currentLamps variable. This is really only for testing the concept, although I will simply rewrite the sendLamps() routine to send a midi message later on. The message that I should see when this setup() function runs is just a zero, as the currentLamps variable is set to zero on power up, which means ‘All Lights Off.’

The program then enters the loop() function.

void loop() {
   getLamps();
}

The getLamps() function reads all of the lamp pins and, if a pin is HIGH, it sets the correct bit in the currentLamps variable. If it isn’t HIGH, it clears the bit.

It then compares the currentLamps variable to the lastLamps variable. If currentLamps is the same as lastLamps, it doesn’t do anything. If it is different, the lamps have changed since the last time the program sent a message, so it will then send a message with the new lamps. Then it goes back into the loop() function and does it all over again.

And that’s it. Now for some testing…

Testing:

If you have made it this far, you might want to make this video full screen, so you can see what the display is showing. Taken with my iPad, so the quality isn’t that great, and the focus isn’t super stable…

Conclusions:

Works like a charm. Response is very fast too.

Note to self: The last thing I do in the video, at the point where you lose sight of the buttons, is hit the search zero button on the other side of the machine. The button on the MTR-12 does not seem to trigger the searchZ lamp to come on. I am assuming that it will once I start triggering a search zero from (what would be) the auto-locator. The button on the machine is not a standard lamp button, but the button on the auto-locator, as you can see here, was.

So far, so good…

Leave a Reply

Your email address will not be published. Required fields are marked *