The problem with the drive was fairly obvious once you opened it up and spun the platters. The head was scraping against it, making a squeaky sound. I suppose the head bent when it was dropped, but the drive just wasn't working anymore. No problem, we can breath new life into it.
For the first part of this thing, I'll be following this guide. There will be a few key differences though. I'm going to be using the op amps and pattern they're using, I will not be mimicking their final product, however. I'll be using a Raspberry Pi to run the sound, so I can have a whole keyboard at my disposal. The only other button on the device will be a "hold button" which tells the software to either continue spinning the platter at the current speed, or to start listening to the speed to command the playback. Either way, it'll be sending signal to the Pi's GPIO pins and will be running custom written playback software written specifically for this turn table. It's gonna be awesome.
The first step is to remove everything we don't need. That is to say everything but the disks and the motor and the axle. The disk guard, the actuator, the head, and the PCB on the other side all need to go. The empty space where the read/write head used to be will be where any additional circuitry will go. It'll also be home to the hold button.
Next, we'll extend the motor pins with some wires. I'm not really confident in my soldering abilities, and these weren't just little contacts, so I shoved the wires under the metal arms and hot glued everything in place. If I had tried to solder it it would have been a disaster and I would have ruined it.
Gutted drive |
My mediocre glue job |
Next, I wanted to see if I got the offset sine waves from the drive like I should have. So I hooked up the oscilloscope, then I learned how to use the oscilloscope. The scope I have access to doesn't have colors, so I offset the waves to see the phase shift of them. And it couldn't have worked better. I connected one positive to one wire, one positive to another wire, and the two negatives to the third. If I had a fourth wire, it would have gone on a positive as well and it's corresponding negative would have gone on the other negatives. But this is what it looked like:
Now the task was to make these sine waves into square waves to trigger edge detection in the Arduino. The instructable told me to do it with an op amp. So I did. I got the suggested LM324 op amp and wired it up as follows:
So I wired my mini-breadboard up exactly like this. Here are some pictures from the set up.
Then I wrote the interrupt code for the Arduino. This code wasn't too bad to write, as the Arduino makes it super duper easy to set this up.
int pina = 2;
int pinb = 3;
int state = 0; //0 = none, 1=a last. 2 = b last
void setup() {
Serial.begin(250000);
pinMode(pina, INPUT); //Set Mode
pinMode(pinb, INPUT);
attachInterrupt(digitalPinToInterrupt(pina), handlea, RISING); //Create interrupts
attachInterrupt(digitalPinToInterrupt(pinb), handleb, RISING);
}
void loop() {}
void handlea() { //When A rises
Serial.print("A");
if(state==0) state=1;
else if(state==1) return;
else {
Serial.print(state);
state = 0;
}
}
void handleb() { //When B rises
Serial.print("B");
if(state==0) state=2;
else if(state==2) return;
else {
Serial.print(state);
state = 0;
}
}
So when it triggers, it should print numbers. The good news is that it worked well for determining the speed of the platter (more output was given when the platter was fast.) However, the directionality was all messed up. I think it has something to do with the duty cycles not matching up, but I'll have to ask one of my electrical engineering friends about it because I'm already way out of my depth. Hence, why this is broken up into two parts.
We'll tune in next week and hopefully we'll get the drive to spin by itself as well. (I already tried, this is hard without special hardware.)
No comments:
Post a Comment