Projects > Post your projects

Laser Scanning Display Project

<< < (2/14) > >>

ElectroNick:
Dude, are you trying to break a 1TB HDD for the sake of this project?!  ;D I am seriously impressed!

I have an old HDD (18Gb) that I would donate for the purpose but I have a feeling the shipping cost is going to be a killer.

Anyway, if I got your idea correctly, you are trying to use the HDDs native BLDC controller? That's is a great idea except the more recent the HDD, the more complex its BLDC controller is. In fact, it's not even a BLDC controller anymore, it's a complex chip (and entire computer in and of itself) that takes care of pretty much every mechanical aspect of the HDD - platters, heads etc. Additionally, I could not find any datasheet on SH61258. But even without the datasheet I can tell you that it may not be so easy.

Older HDDs on the other hand, will have much simpler controllers  such as Phillips TDA5143 which may be easier to handle. There are other BLDC motor ICs, too.

I have to admit, I would love to work with a specialized controller IC at some point but perhaps on one of the next projects. For now it looks like this spin-up circuit works a treat, just need to devise a way to limit RPMs to less destructive 1000-2000RPM.

On a plus side: your new HDD has the 4 leads that you need for the simple spin-up circuit.

Holder: 3D parts printed in metal look a bit too porous to me but I've never seen one that's 3D printed, then polished. Perhaps it's the way to go. If you end up going this route, be sure to post some pictures - I'm very interested to see how it looks. And performs - I have a feeling my plastic mirrors/holders are not yet done giving me a hard time  :)

Georg:
the 1TB HDD was donated by a colleague, who recognised strong smell coming out of the controller, so he lost trust in the HDD! Looking at the controller I found a capacitor melted away. I also couldn't find a datasheet! So I can only make a try and error experiment!
You are right now I have a 4 wire base!
I will ask a friend to make the holder with a milling machine. 3D parts will be too porous to make a good mirror! On the other hand the example in the video makes it with mirrors glued together. So if the centrifugal force is small enough (not too much rpm and small diameter) it should work as well. (maybe you must wear protection goggles and a helmet during the test  ;))

ElectroNick:

--- Quote from: Georg on April 17, 2013, 02:26:18 AM ---the 1TB HDD was donated by a colleague, who recognised strong smell coming out of the controller, so he lost trust in the HDD! Looking at the controller I found a capacitor melted away. I also couldn't find a datasheet! So I can only make a try and error experiment!
You are right now I have a 4 wire base!

--- End quote ---
Save the controller! I think you can disconnect it from the HDD PCB, and it looks like a perfectly fine USB-IDE controller, perhaps you can use it with another HDD to make an external HDD out of an internal one? You can easily replace the capacitor and try it on another IDE HDD
But I digress...


Regarding our project: I implemented PWM speed control last night. No feedback yet, just open loop control. But the good news is that the spin-up circuit responds very well to PWM and I am able to have stable (enough) RPMs even without feedback. Since feedback it readily available - the photointerruptor we use for laser synchronization,  I will definitely add some closed loop RPM control later. Just wanted to get to the stage where I can see some meaningful output, then clean up loose ends such as the better RPM control.

So, this spin-up circuit is a keeper! It works very well from just +5V supply. I think I'm OK with having to spin it initially by hand - I'll see what to do about it later, but for now it's performing very well, can be easily controllable and even provides its own rotation speed feedback (which we may not need because we have a photointerruptor).

I keep referring to the circuit and I did post a link to the Parallax forum page where it came from but I feel like I need to have a reference here as well. So, I would like to repost the circuit schematics here (see attachment). Once again, the credit for the circuit goes to Beau Schwabe - an engineer  at Parallax.

I think you should get the parts for the spin-up circuit and build one since you can use it to test HDDs, balance the mirror holder and do other stuff before even building the project. I am guilty of using this circuit for pure entertainment, too - spin up a HDD to some insane RPMs (like 15,000+), stand back and just watch the HDD break the sound barrier :)  So, if you come here one day and there's no response from me, it's probably because I got killed by shrapnel from an HDD torn apart by centrifugal forces  :'(
 


--- Quote from: Georg on April 17, 2013, 02:26:18 AM ---I will ask a friend to make the holder with a milling machine. 3D parts will be too porous to make a good mirror! On the other hand the example in the video makes it with mirrors glued together. So if the centrifugal force is small enough (not too much rpm and small diameter) it should work as well. (maybe you must wear protection goggles and a helmet during the test  ;))

--- End quote ---
I have a feeling that a holder from solid metal may be a little too heavy for the purpose and its weight may make it harder to balance. The plastic 3D printed holder, terribly unbalanced as the 1° version is, is still light enough for the device to stand steady at 2000-2500 RPM (at 4,000 RPM it tries to vibrate itself right off the table!).

I did some test runs of my software, too - with no good results, unfortunately. I've only gotten enough code to print the word "TEST" but even then, I can only see two or three random dots on the wall instead.   I don't know if it makes sense to post unproven software (let me know and I'll post it) but I  have a feeling it's not the software but rather laser diode driver that is not fast enough. I am using the TTL-controlled laser diode driver of my own design. It has a rather large capacitor in the output circuit which I think is messing up my timing.  I'll make myself another laser diode driver tonight (and just omit the capacitor C1 and its drain resistor R5), will post results later.

Georg:
I want to try it with the spin-up circuit and your code from April 16. Two silly questions:
- Goes the PWM to ENABLE?
- Is the 4.wire from the motor on ground?
I tried it with a laser from a laser pointer. My impression was that it was fast enough. 

ElectroNick:

--- Quote from: Georg on April 18, 2013, 05:06:32 PM ---- Goes the PWM to ENABLE?

--- End quote ---
Yes, the PWM output from Arduino (I used digital pin 9) goes on ENABLE

--- Quote from: Georg on April 18, 2013, 05:06:32 PM ---- Is the 4.wire from the motor on ground?

--- End quote ---
No, the 4th (common) wire goes to the positive supply rail, in my case 5V but on the schematics it's marked as 12V. At 12V my little laptop HDD motor would be doing 20,000 RPM or will just break apart. Perhaps the 3.5" HDD that you have needs a bit more juice, so be ready to play with the supply voltage, which, again, comes in on the 4th (common) wire to the motor.


--- Quote from: Georg on April 18, 2013, 05:06:32 PM ---I tried it with a laser from a laser pointer. My impression was that it was fast enough.

--- End quote ---
Well, I have re-done the driver and I can now pulse is sufficiently quickly. But (and that's a big one :) )  if I try to pulse the extremely bright 150mW red laser from a DVD burner drive (about 30 times brighter than a typical laser pointer) at 10 microseconds per pulse, which is about all time we have for one dot, all I see is a very faint spec of light, and not even on a wall a few feet away (about 2m)  but on a sheet of paper I hold right in front of the mirrors. This is very alarming - it means that we either need to slow the mirrors down significantly or increase the power output of the laser even more (and at 150mW that's already a very powerful and dangerous laser). Perhaps there's something terribly wrong with my mirrors (also a distinct possibility). As soon as my new holder comes, I will try again.

Also, if you are working with the code, try this code below (yet unproven as far as text output but motor control works). You will need to hook up a potentiometer (5-10K) with one leg on the +5V of Arduino, opposite leg on the Ground and the brush (middle contact) on A0 input (potPin in the code) - this is the manual PWM control. Let me know how it works!

The laser control is digital  Pin 8 (laserOnPin), the photointerruptor input is Pin 2  (slotPin) and the PWM is Pin 9 (pwmPin).

if you don't have a laser hooked up yet, all you really need is  these two lines of code in the loop():

--- Code: ---pwm = analogRead(potPin)/4;
analogWrite(pwmPin,pwm);

--- End code ---

The full code as it stands now is below. It is supposed to print the word "TEST" but all I see at this point is some specs of light (see above)


--- Code: ---/*
Laser Scanning Display Project
See http://elabz.com/ for more project details and instructions
 */
#include <avr/pgmspace.h>

byte slotPin = 2;
byte pwmPin = 9;
byte ledPin = 13;
byte laserOnPin = 8;
byte potPin = 0;
int pwm;
int serialDelay = 2000; // print out RPM valule every 2 sec
unsigned long serialPeriodNow;
unsigned long rotationTime;
unsigned long lastInterrupt;
unsigned int rpm; // caclulated RPM value
byte currentRow = 0;
byte charsInLine = 4;
byte timePixel = 20; // this is in microseconds
int timeDelay = 20; // in microseconds - delay until the first pixel of the first column is shown
byte image[4][8]  = {
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000},
{B11111111,B11000001,B11000000,B11111000,B11111000,B11000000,B11000001,B11111111},
{B01111111,B11000001,B11000000,B01111100,B00111110,B00000011,B10000011,B11111110},
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000}
};
/*
PROGMEM byte image[4][8]  = {
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000},
{B11111111,B11000001,B11000000,B11111000,B11111000,B11000000,B11000001,B11111111},
{B01111111,B11000001,B11000000,B01111100,B00111110,B00000011,B10000011,B11111110},
{B11111111,B10011001,B00011000,B00011000,B00011000,B00011000,B00011000,B00011000}
};
*/
/*
byte alphabets[][8] =
{  {0,0,0,0,0},
  {0,56,125,56,0},//!
  {80,96,0,80,96},//"
  {20,127,20,127,20},//#
  {18,42,127,42,36},//$
  {98,100,8,19,35},//%
  {54,73,85,34,5},//&
  {0,80,96,0,0},//'(7)
  {0,28,34,65,0},//(
  {0,65,34,28,0},//)
  {20,8,62,8,20},//*
  {8,8,62,8,8},//+
  {0,5,6,0,0},//,(12)
  {8,8,8,8,8},//-
  {0,3,3,0,0},//.(14)
  {2,4,8,16,32},///
  {62,69,73,81,62},//0
  {17,33,127,1,1},//1
  {33,67,69,73,49},//2
  {34,65,73,73,54},//3
  {12,20,36,127,4},//4
  {114,81,81,81,78},//5
  {62,73,73,73,38},//6
  {64,71,72,80,96},//7
  {54,73,73,73,54},//8
  {50,73,73,73,62},//9
  {0,54,54,0,0},//:(26)
  {0,53,54,0,0},//;(27)
  {8,20,34,65,0},//<
  {20,20,20,20,20},//=
  {0,65,34,20,8},//>
  {32,64,69,72,48},//?
  {62,73,87,85,62},//@
  {31, 36, 68, 36, 31},//A
  {127, 73, 73, 73, 54},//B
  {62, 65, 65, 65, 34},//C
  {127, 65, 65, 34, 28},//D
  {127, 73, 73, 65, 65},//E
  {127, 72, 72, 72, 64},//F
  {62, 65, 65, 69, 38},//G
  {127, 8, 8, 8, 127},//H
  {65, 65, 127, 65, 65},//I
  {2, 1, 1, 1, 126},//J
  {127, 8, 20, 34, 65},//K
  {127, 1, 1, 1, 1},//L
  {127, 32, 16, 32, 127},//M
  {127, 16, 8, 4, 127},//N
  {62, 65, 65, 65, 62},//O
  {127, 72, 72, 72, 48},//P
  {62, 65, 69, 66, 61},//Q
  {127, 72, 76, 74, 49},//R
  {50, 73, 73, 73, 38},//S
  {64, 64, 127, 64, 64},//T
  {126, 1, 1, 1, 126},//U
  {124, 2, 1, 2, 124},//V
  {126, 1, 6, 1, 126},//W
  {99, 20, 8, 20, 99},//X
  {96, 16, 15, 16, 96},//Y
  {67, 69, 73, 81, 97},//Z
  {0,127,65,65,0},//[
  {32,16,8,4,2},//
  {0,65,65,127,0},
  {16,32,64,32,16},//^
  {1,1,1,1,1},//_
  {0,64,32,16,0},//`
  {2,21,21,14,1},//a
  {64,126,9,17,14},//b
  {14,17,17,17,10},//c
  {14,17,74,127,1},//d
  {14,21,21,21,9},//e
  {1,9,63,72,32},//f
  {9,21,21,21,30},//g
  {127,8,8,8,7},//h
  {0,0,46,1,1},//i
  {2,1,1,1,94},//j
  {1,127,4,10,17},//k
  {0,65,127,1,0},//l
  {31,16,14,16,31},//m
  {31,8,16,16,15},//n
  {14,17,17,17,14},//o
  {127,20,20,20,8},//p
  {8,20,20,31,1},//q
  {31,8,16,16,8},//r
  {9,21,21,21,18},//s
  {16,16,126,17,18},//t
  {30,1,1,30,1},//u
  {28,2,1,2,28},//v
  {30,1,6,1,30},//w
  {17,10,4,10,17},//x
  {16,9,6,8,16},//y
  {17,19,21,25,17},//z
  {8,54,65,65,0},//{
  {0,0,127,0,0},//|(92)
  {0,65,65,54,8},//}
  {32,64,32,16,32},//~

 
 
};
*/
void setup() {
  attachInterrupt(0, calcRPM, FALLING);
  //Serial.begin(9600);
  //pinMode(slotPin, INPUT);
  pinMode(pwmPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(laserOnPin, OUTPUT);

}

void loop() {

pwm = analogRead(potPin)/4;
analogWrite(pwmPin,pwm);
/*
if((millis() - serialPeriodNow) > serialDelay)
{
 rpm = 60000000/rotationTime; //rotationTime = duration of 1 rotation in microseconds.
 Serial.print("RPM: ");
 Serial.print(rpm);
 Serial.print(" | PWM: ");
 Serial.println(pwm);
 serialPeriodNow=millis();
}
*/
}
void calcRPM(){
  rotationTime = micros()-lastInterrupt;
  lastInterrupt = micros();
  byte currentCharRowByte;
  byte actualRow; // since the slot photointerruptor is on the side opposite to the laser, it's always 4 mirrors ahead
  actualRow = currentRow+4;
  if(actualRow > 7) actualRow=actualRow-8;
  int timeOneMirror = rotationTime/8;
  //delayMicroseconds(timeDelay); // small delay to align the laser with desired position on the wall (higher - string starts more to the left)
  delayMicroseconds(timeOneMirror*actualRow); // wait until the proper mirror for that row is positioned for the laser
  for(int x=0; x<charsInLine; x++){
    //currentCharRowByte = pgm_read_byte(&(image[x][currentRow]));
    currentCharRowByte =image[x][currentRow];
    for(int y=1; y<9; y++){
    if (currentCharRowByte & (1<<y)) {
        digitalWrite(laserOnPin, HIGH );
    }
      else {
        digitalWrite(laserOnPin, LOW );
    }
    delayMicroseconds(timePixel);
    digitalWrite(laserOnPin, LOW);
    } 
 
  }

  currentRow++; // prep the row counter for the next interrupt
  if(currentRow > 7) currentRow = 0;
}



--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version