Shop OBEX P1 Docs P2 Docs Learn Events
Spindle motor — Parallax Forums

Spindle motor

gambrinogambrino Posts: 28
edited 2009-01-11 00:22 in Propeller 1
Hello forum , i would like to connect a spindle motor ( Extract from a hard disk ) to the propeller . The spindle motor has 4 wires .The +12V should be from external supply , and what about +5V ? it should be from propeller , but the propeller gives 3.3V max. should i use converters or what do you recommend me ?
Thank you in advance for your answer

Post Edited (gambrino) : 1/6/2009 10:08:29 PM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-05 21:35
    I'm not sure your interpretation of those motor connections is correct. More likely, it's a brushless DC motor that needs a motor controller to sequence the phase currents for proper operation.

    -Phil
  • SRLMSRLM Posts: 5,045
    edited 2009-01-05 21:49
    Take a look at the N&V column "Stepping Out With Spin". It does exactly what you need.
  • gambrinogambrino Posts: 28
    edited 2009-01-05 21:56
    Do i need a closed loop DC servomotor control system ? or this control can't be applied to a spindle motor ? or L293D can do this ?

    Post Edited (gambrino) : 1/5/2009 10:17:52 PM GMT
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-01-06 01:03
    Hello Gambrino,

    first of all: a propeller-IO-pin can stand max 30mA. The whole chip 100 mA. You rmotor does surely exceed this current.

    A brushless-DC motor is something complete different from "classical" DC-motors

    In "classical" DC-motors the switching of the magnetic field is done electromechanically by the "brushes"
    this is done "automatically" whenever to motor is rotating

    In a brushless-DC-motor (BLDC-Motor) an external electronic has to do the switching of the magnetic field
    always with a certain frequency depending on the rotation-speed of the motor. The exact position of the Rotor
    is detected by a hall sensor.

    So first thing is to clarify what kind of motor is this.

    "classical" DC-motor, BLDC-motor, steppermotor with or without encoder

    best regards

    Stefan
  • SRLMSRLM Posts: 5,045
    edited 2009-01-06 01:19
    You can find the N&V article under the resources tab of the main parallax website, and the N&V sub heading. It is article number 136, and you can download it for free. This is the link.
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-01-06 10:35
    Hello Gambrino,

    If I think over that you have four wires it might be that - if it is a BLDC the 5V is some kind of an input
    for a controller INSIDE the motor.

    two ideas

    1.) maybe feed it with a rectangle signal varying the frequency to control the rotationspeed

    2.) maybe feed it with a PWM where the ontime is related to the rotationspeed

    I would start expermintating about this with a transistor like shown below.


                       5V
                       │             
                       1k
                       │ 
                       │───10k──> 5V-wire of motor             
                     collector  
                       │       
       I/O ───4k7──base            NPN=2n3904
                       │
                    emitter                   
                      GND
    



    best regards

    Stefan
  • heaterheater Posts: 3,370
    edited 2009-01-06 13:46
    I'm with Phil on this one. All of the motors I have pulled out of old hard drives have been BLDC. The four connections seem to be one ground and three poles. I got as far as poking at the connections with wires from a bench power supply and watching the platter jump round.

    I'm not sure if driving it like a stepper is going to work so well, the steps are huge, 3 steps per rev, but it's an experiment worth trying.

    Now I don't know what voltages are used in hard drives but 5v will make it jump.

    I always thought controlling these was a tad complicated. Shouldn't the poles be driven by a sine waves 120 degrees apart in phase and synchronized to the motor position.

    Spindle position can be determined by a Hall effect sensor or such. I think real hard drives use the back EMF to determine this.

    The sine waves of course could be pulse width modulated DC.

    I'm sure a prop can do this with some driver FETs.

    What would you use it for ? These motors don't seem to be up to much apart from spinning platters at a constant high speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-06 19:06
    Gambrino,

    Here is a document that describes brushless DC motors and their applications. One of the things it mentions is the use of Hall effect sensors for position feedback. Given that your motor has only four wires emanating from it, I wonder if these sensors have been replaced with feedback from the disk platter itself (e.g. sector boundaries). In any event, some time spent with an ohmmeter probing the motor leads would give you (and the rest of us) a lot more information to work with.

    -Phil
  • heaterheater Posts: 3,370
    edited 2009-01-06 19:36
    Hi Gambrino,

    Thanks for you PM. I have a personal interest in getting hard drive motors running as I have a stack of them (who does not?) and took it as a challenge some time ago. I thought I would reply on the forum as more people may be interested in this and together we can make it work from the Prop. Hope you don't mind.

    If your motor looks like the picture you sent then I think we are talking about the same thing, brushless DC motor. Most hard drive motors I have seen recently look much the same.

    I am no electronics wizard but I think with a little research and experiment we can come up with something that works, even if not the most efficiently.

    First you should read the wikipedia on BLDC motors: en.wikipedia.org/wiki/Brushless_DC_electric_motor

    Next microchip has an excellent series of application notes on BLDC motors here: www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1523


    Now what to do? Can't be that hard, it's only coils and magnets right.

    Easy way out might be to get hold of a dedicated BLDC motor controler IC like this one from Texas Instruments focus.ti.com/lit/ds/symlink/uc2625.pdf. There are many others. No idea where you would get them.

    But as we like to do everything with a Propeller or two around here that seems like cheating.

    I have understood that some motors like sine wave drive but I'm sure +ve DC, 0, -ve DC will drive these also, perhaps not to perfection.

    So we need +ve and -ve DC supplies, say +/-12v and some way of switching them to the coils.

    With that it is only necessary to program the Prop to generate the correct sequence of drive pulses.

    Next we need some sensors to detect the motor position to get the drive pulse in sync. Three Hall effect devices seems to be traditional. Detecting the back EMF voltage of the "undriven" coils maybe a bit tricky.

    You mention wanting to attach mirrors to you motor in the completed project. Well perhaps you could use light reflected from the rotating mirror(s) onto photo diodes as the position detectors. Did you know that LEDs also work as cheap photo diodes?

    If you have the L293 perhaps you could try an experiment to drive the coils with only the positive supply. May not work so well but perhaps well enough.

    Phil is right about probing the motor connections with an ohm meter. I did that once and you can easily see how the coils are connected.

    @Phil: Never heard of detecting rotor position from the actual sector info, sounds like a neat idea but I'm not sure the sectors are necessarily in fixed positions wrt the motor. Soft sectors and all. I think they normally use the back EMF from the motor to do this. Which I guess the Prop could also do up to some speed limit. Sounds too hard for now.

    Anyone got suggestions for the +/-12 volt drive circuitry?. Is there a chip around to do this?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-01-06 19:58
    Just thinking: Leave the hard drive platter on the motor. It's very reflective so with some black sticky tape (or drill some holes) and three LEDs and photo diodes around makes a good position sensor. Also acts as a flywheel to smooth out the rotation.

    I feel a youtube video coming on!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-01-06 20:19
    Here is a guy who has driven a hard drive motor with just a 555 a shift register and a L293D. Complete with video demonstration and other circuit ideas: letsmakerobots.com/node/2876 and http://letsmakerobots.com/node/2898[noparse][[/noparse]url]

    We should be able to do better with bipolar drive, correct phasing and position feedback.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • gambrinogambrino Posts: 28
    edited 2009-01-06 21:19
    Thanks alooot guys , i need time to read all this and i will reply later
  • heaterheater Posts: 3,370
    edited 2009-01-06 21:30
    I love Fig 4 of that ems_ch12_nt.pdf document. Just 3 transistors, three photo diodes and a light source and there it spins. I have to try that for fun.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • ErNaErNa Posts: 1,752
    edited 2009-01-06 21:50
    To start with BLDC it is better to have hall sensors. And therefor begin with the spindle drive of a CD-Drive. CD-drives have variable speed and therefor sensorless control of the motor is a very difficult task. And the CD's itself can have different diameter and momentum. For this reason, normally there are three hall sensors hidden under the rotor. The motor voltage should be a PWM-signal from 0 - 12 V
  • TreeLabTreeLab Posts: 138
    edited 2009-01-07 17:27
    Greetings All;
    This discussion has been very useful for me; I have no experience with brushless motors, whatsoever. If a three-coil brushless motor is stopped with a single coil left energiezed, does this mean that the rotor wil end up in one of three possible positions? How accurate would this position be (for example, plus or minus ___ degrees)?

    In the absence of significant friction, is there a pressing need for feedback control to regulate the rotation speed, or would frequency control of the three drive signals be adequate?

    Cheers!

    Paul Rowntree
  • heaterheater Posts: 3,370
    edited 2009-01-07 17:57
    @TreeLab, By "stopped" I guess you mean halting the progress of commutation control. So yes it will come to rest trying to point to the active pole.

    I think that if there is any load on the motor that will prevent it from actually getting to the "pole position" as it were. So the accuracy may not be good.

    Also some motors may have multiple sets of coils so there may be multiple rest positions for a single active pole, if you see what I mean.

    In the absence of friction the thing might just get faster and faster until something breaks !

    I've been thinking about speed control. Imagine the motor is turning at say 5000 rpm under some load. The controller is commutating at the same speed and in phase. Now we increase the load. What happens? What do we do about it?

    At enough load the rotor won't be able to keep up with the rotating magnetic field and the thing will stall.

    Having the controller increase the commutation speed to compensate will not help, indeed the commutation should be locked to the rotor position anyway, what we need is more power delivered.

    So during the "on" periods of a pole the power should be delivered in a PWM fasion, say 5KHz. If the rotor starts to slow down increase the duty cycle of the PWM.

    I'd love to stick a scope on a running hard drive motor and see what a real hard drive controller does. But no scope around here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • TreeLabTreeLab Posts: 138
    edited 2009-01-07 18:25
    @Heater : yes, that is what I meant by stopped. I would be putting a rotating (100-200 Hz) disk inside a high-vacuum machine, so aside from the bearings there should be little physical friction. I like your idea of PWM inside the commutation frequency; I was going to suggest a two-level two-transistor current control with varying duty cycles, but your approach is much more elegant, with no hardware additions. Alternatively, the period of the PWM could be set by the rotor frequency, and the duty cycle used to control the power delivered per rotation. I am using a modified verion of Jev Kuznetsov's PWM codes from ObEx that use counter A, and they work well to speed control a DC motor. I am not sure how to drive three such waves from a single cog though, and it may require 2 synched cogs. Could the video generator be put to use here? My app is running low on cogs at this point ...

    Still, I would be hoping that the speed would be stable enough from the drive frequencies in my application, and elimiante the need for feedback.

    The fellow with the 555-based drive circuit was showing that the coil current was decreasing with higher speed. How is that possible? Is it an artifact of the rms calculation inside the ammeter?

    Cheers!
    Paul Rowntree
  • heaterheater Posts: 3,370
    edited 2009-01-07 19:00
    Not sure the vacuum will gain you much I think bearing friction might be greater generally. Unless you are driving a fan [noparse]:)[/noparse]

    I would keep the PWM frequency fixed for simplicity. What's to be gained by changing it. Just increase vary the duty cycle to control speed.

    Problem is a cog only has two counters. I would suggest driving the three pole signals out of three pins using software bit banging in PASM. Generate the PWM signal from a counter. Mix the PWM signal with the drive signals externally with AND gates, job done in one COG. As for Video generators I'm really not up to speed on those.

    As for the 555 guy, I wondered about his current measurements as well. Starting out at over one amp at slow speed with no load sounded huge anyway. But why does it go down with speed? As you probably know a normal DC motor when stalled with excessive load consumes a lot more current than when it is running. Basically a motor is also a generator so as it spins its back EMF fights the voltage that is driving it and current is reduced. When stalled there is no back EMF.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-01-07 19:09
    Oh yeah, and the thing about feed back is which feedback do we mean?. Ideally we need to know the rotor position in order to generate the drive signals in the correct phase. That's one, position. This will run faster and faster up to some limit unless we control the power in the drive pulses (PWM). That's another, speed. Of course actually these are both coming from the same signals so its a bit mixed up.

    With no PWM control you can control the speed just by slowing the commutation period, as the 555 guy does, be careful to watch the current those coils will burn eventually.

    Depends how you want to set it up. I would start my first experiments with no feed back, just variable speed drive pulses. Sadly I have no time or resources to do this. Just sitting here with ideas....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • TreeLabTreeLab Posts: 138
    edited 2009-01-07 19:21
    @heater : Actually, the vacuum is why I am interested in the motor in the first place. I have a beam of particles moving inside the a vacuum system, and I want to measure their velocity distribution. We will have a fast chopping disk with fine slits in it near the source, which will give ~25 micro-second long pulses of atoms aimed at the detector, all of which start their race at about the same time. We measure the time of arrival about 0.5 m downstream, and work backwards to see the velocity profile. The other cogs on the prop are busy with interfacing to the PC and operating the pulse detector and signal accumulation. None of this beam technology works at pressures above 1 nano-atmosphere of pressure (10^-6 torr) because of collisions with the background gases.

    I do not understand how keeping the PWM frequency constant would affect speed, since the overall frequency on each pin would be exactly the rotational frequency, no? Unless you are refering to a loaded rotor that cannot keep up. In air with a simple DC motor I see significant changes in rotation speed vs duty cycle as I change the disk profile, so I think that air resistance is a factor for benchtop testing. In the vacuum, the problem is overheating of the motor because of no convection cooling. Plus, most motors are lubricated for in-air service, and the lubricants they use can crud up my machine.

    Bit-banging the pins would work, even without the external gating It would just take a slightly rolled out loop, since only one of the three coils is active at any time. I will try this.

    Cheers!
    Paul Rowntree
  • heaterheater Posts: 3,370
    edited 2009-01-07 19:24
    Re: the guy with the 555. I'm sure that's it. At slow speed the rotor is rotor is always pointing to an active pole, or between a pair of poles. There little back EMF. None at zero speed. Only the resistance of the coils is limiting the current. Not good.

    With PWM control the duty cycle would go down to zero at zero speed. Much less current. Good.[noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Paul RowntreePaul Rowntree Posts: 49
    edited 2009-01-10 17:39
    @heater: I have the spindle motor going using spin-coded ~5kHz PWM on three pins, feeding into a ULN2803 darlington array. These things have resistances of ~1.5 Ohm per winding, so they are drawing current through two of the ULN2803 channels for each coil. Even then the chip is warming up significantly. I have a CD mounted on the spindle, with a slot at the perimiter to measure rotations with a Motorola H21A optointerrupter module.

    The problem is that the final speed is far below what I am driving them at (target 30 Hz shaft speed, getting 6-8 Hz) It is stable to ~0.1% (watching the scope of the interrupter, or monitoring the rotation speed with a PASM cog), but clearly not locked to the rotating coil frequency. Changing the PWM frequency changes the rotation speed, but the duty cycle of the PWM seems to have no effect. The current through the darlingtons looks irregular, and only poorly corresponds to the drive signals (do I need a resistor between the prop pin and the darlington, and/or a pull up/down resistor?). SO I think that the next step is to bring in bigger guns like a TIP120 on each channel and see if it improves.

    This is more complicated than I was imagining ... we will see if the improvement over a duty-cycle controlled DC motor was worth the effort.

    Cheers!

    Paul Rowntree
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-10 18:52
    Paul,

    Have you tried ramping up the speed from a standstill? If you just zap it with the target frequency, you may end up with a subharmonic of that target.

    -Phil
  • Paul BakerPaul Baker Posts: 6,351
    edited 2009-01-10 20:18
    Paul, I'm with Phil, it sounds like you are driving it at a harmonic. This wastes energy (leads to heating of your driver), and reduces the torque of the motor. Since you are able to measure RPM, you should implement a closed loop controller. The driving frequency should never exceed twice the current speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
  • Paul RowntreePaul Rowntree Posts: 49
    edited 2009-01-10 22:17
    Hi Phil, Paul;

    Yes, I ramped up very (!) slowly. I start the cycle at what should be 3Hz ( with a 1-2-3-1-2-3 )coil sequence per rotation, then make ~30 rotations at that speed before increasing the target frequency by 1 Hz. I repeat this until it fails, usually at a slow frequency. The mass of my rotor is much less that the 2 HD platters, and is well balanced.

    The motor does not start smoothly, and jerks back and forth quite a bit at first. Sometimes a gentle push is needed. As I wrote above, the power/current waveform is badly distorted wrt the PWM control signal, so I am inclined to doubt the drive circuit. I have used the ULN2803 in a quasi DC application before, but not at 5 kHz; I know that the TIP120's work well on the 3.3 control voltages, and so will try that next.

    Q : Do you think that the PWM frequency should be constant (so changing the shaft frequency means fewer pulses per coil activation) or should I have a set number of cycles per activation with shaft-speed dependent pulse widths? I thought that the bare motor worked better with fixed PWM, but haven't gone back to this approach with the disk attached ...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-01-10 23:11
    You might try single pulses, instead of using PWM, to give the motor a "kick" from each coil at the precise moment it needs it. As Paul suggests, using feedback from your sensor will help to determine the proper moment, which is almost certain to be speed-sensitive (rather like the timing advance on a gasoline engine).

    Another issue you may encounter, since you've altered the rotational inertia of the motor/load system by removing the platters, is resonance. If your system is resonant at a certain RPM, it may be hard to get past that speed without some sort of damping. I know this affects stepper motors, and I can only assume BLDCs are similarly afflicted. Resonance is easy to recognize, as the motor will chatter or operate with more jerky movements. You can change the rotational dynamics by using a heavier load or by frictional or magnetic damping.

    -Phil
  • Paul RowntreePaul Rowntree Posts: 49
    edited 2009-01-11 00:22
    The single pulse mode is worth trying. I could feel slight resonances when running the motor unloaded, and there is no doubt that my CD is not as perfectly balanced as a HD platter, despite my earlier confidence. I was very surprised to measure such low coil resistances (1-2 Ohms each in the star pattern), and I am concerned about making the Prop reset. I may need to get a separate power supply or a beefier wall wart. I had toyed with synching the coil cycles to the position of the rotor, but then I would have to use duty cycle variations to do speed control (I think).
Sign In or Register to comment.