VCR capstan control with ATmega328P

I like taking stuff apart, especially stuff with electronics in them, so when I saw an old VCR next to a trash bin in the alley behind our house, I had to take it in. There are obviously quite a few interesting bits inside a VCR, both mechanical and electronic. One of the things I was mostly interested with the VCR was the different electrical motors in it. Altogether there were at least two: one to operate the mechanism to load and unload the video cassette and the so-called capstan, the part that actually pulls the tape. The video drum also seems to have some sort of motor like components (permanent magnets and coils), but I haven’t figured out yet if they actually produce rotations, or if they are used for the reading and recording of the video tracks on the tape.

The capstan motor was placed on its own little module and was therefore very easy to take out. It came with a small PCB with a few surface mount components, most notably a 34-pin QFP. The part number LB1952 identified it as a brushless motor driver specifically for VCR capstans. The datasheet for the device was very easy to find.

top side of the VCR capstan module
Driver IC of capstan motor and connector

The pins on the connector on the board were also nicely labelled so it was fairly easy to identify which of the connector pins connected to which pins on the IC. I only mixed up the two voltage pins. I had falsely assumed that VCC1 would be the controller voltage supply, as it was next to S-GND (=signal ground?), whereas VCC2 would be the output, i.e. motor supply voltage (since it’s next to M-GND =motor ground?). It turned out to be the opposite, which I found out after I measured the voltage at VREF, which if unconnected should show a level of approx. 0.43 x Vcc. Besides the supply voltages, the three important signals are F/R, CONT and LIMIT. F/R specifies the direction of rotation (forward/reverse), so can either be tied to ground or Vcc. CONT is the main speed control voltage, in the range VREF to Vcc. LIMIT is a current limiting control. As mentioned, VREF can be left unconnected. FG seems to connect to the FG-OUT pin on the device, the “FG amplifier output pin”. I have yet to learn what that means and how to use it – it seems to related to some sort of feedback mechanism, so may very well be quite useful. However, for now I left it unconnected.

To control the speed I decided to make use of the Boarduino I had laying around. I still use the default bootloader it came with, but wrote the program for the ATmega328P in AVR Studio to have tighter control over the timing of things. To generate a variable control voltage I used one of the 16-bit capture/compare timer modules to generate a  PWM signal. I set the module up for 10-bit “fast-PWM” mode, and have the counter running at the main clock frequency (16Mhz), i.e. without a clock prescaler. I set it up to turn off the timer output pin on compare match and to turn it on when the counter overflows (in this case, reaches the maximum possible with 10 bits). Adjusting the compare value therefore sets the duty-cycle directly. This should give me a main PWM frequency of approximately 15.6kHz (=16MHz/2^10). I implemented a simple 2-pole RC low-pass filter to smooth the voltage. This probably wouldn’t be necessary, as the momentum of the motor itself should act as a filter, but I figured it couldn’t hurt.

For my first tests I connected two push buttons to increase and decrease the duty cycle via the comparator value. I used pin-change interrupts and one of the other timer modules (this time with heavy prescaling and overflow counting) to implement a simple software button bounce algorithm. This had the neat side effect that main() ended up being an empty while(1) loop. I could have probably even put the micro into a sleep mode – I’ll have to look into this.

The whole setup seemed to work quite well, though it was fairly clear that the relationship between the control voltage and the speed isn’t a simple linear one. The next step will be to actually measure the rotational speed with the microcontroller so it can dynamically adjust the control voltage(s) to maintain a set target speed.

2 thoughts on “VCR capstan control with ATmega328P

  1. Andreas,
    I’m curious if you would be willing to share your code for this project. I’m working on a oscillator control project (hobby) and I’m hung up on getting fast 10 bit PWM to function in Arduino.cc. Even a code snippet would be interesting and probably helpful.

    Regards,
    Bob Darby

    Like

    1. Hello Bob,
      Yes, of course. The relevant sections of the code are these:

      void setup() {

      // set up waveform generation p.137 WGM10+WGM11+WGM12: Fast PWM 10bit
      // clock select CS10: clk/1 (no prescaler, i.e. fastest possible)
      // compare output mode for channel A (COM1A1): non-inverting (clear on compare match, set at bottom/overflow)
      TCCR1A = (1 < < WGM10) | (1 << WGM11) | (1 << COM1A1);
      TCCR1B = (1 << WGM12) |= (1 << CS10);

      // set compare value to 512 (50% pulse width to begin)
      OCR1A = 0x0200;

      DDRB |= (1 << DDB1); //configure Port B pin 1 as output (for the timer)

      ...

      }

      This will output a PWM waveform on pin 15 (PB1) of the DIP-28 package. I’m not sure which pin this is in Arduino terms. Since the fast PWM mode always counts up to a fixed value (in my case 0x3FF, 10 bit), changing the value of the output compare register 1A (OCR1A) defines the pulse width.

      I hope this helps!
      Andreas

      Like

Comments are closed.

Create your website at WordPress.com
Get started
%d bloggers like this: