From Hackteria Wiki
Jump to: navigation, search

3D printed rotary holders


Selection 587.png

Parametrized design by pin&dusjagr in OpenScad: File will be uploaded to thingyverse soon...

Adding Font to the 3d object using

Selection 613.png

Calculate g-force from design

Instructions using the ESC Flyduino 25A and Arduino


introduction bruslees motor as the one that is inside the HD :

To drive a brushless motor, you have to take DC, turn it into three phase AC (sinusoidal or trapezoidal wave) and then measure back-emf pulses (sensorless) to allow you to make sure the three phase AC is being generated at the proper frequency to turn the motor (timing).

As an academic exercise, this might be done with one motor. You will have to generate three AC currents with 120 degree phase difference. Then you have to time them so you have a rotating magnetic field. This usually involves driving six hexfets. See below for a better explanation of what you will need to do. It's actually quite interesting.

Microchip appnotes to read to better understand driving brushless motors:

More Microchip, including selecting mosfets (Double H-Bridge) and using PIC microcontrollers to make a sensorless brushless motor driver (ESC) Arduino forum

open source ESC control example is developing check also here [1]

Error creating thumbnail: File missing

First working setup using the Flyduino and controlling it from the arduino (servo lib). Double checking the servo control output with the oscilloscope.

Connecting stuff

We used an external 12V power-supply to power the arduino. Via the breadboard we connected 5V, GND to a potentiometer and use the reading from Analog 0 (middle leg of pot).

Pin 9 on the arduino is the output of the servo control. only connect this one and GND to the small cables on the ESC. Black is GND, white or yellow is control. DON'T CONNECT 5V to the ESC.

Connect ESC gynepunk.jpg

Connect arduino gynepunk.jpg

The ESC is connected with the 2 big wires to the 12V power supply. black is GND, red is 12V.

On the other side the 3 wires are controlling the brushless motor / hard-disc motor. We kinda tried different connections, in the end the red wire to the red and the other howwever worked. If you have 4 connectors on the hard-disc, the 4th should be the speed signal to read-out.

about hall sensors and control the speed [2]

if you wanna know how to make more than 150rev/seg check this interesting hack [3]

Getting it to run...

next week looking nice box and re-print new version of the initial desing :

IMG 9899.JPG

IMG 9870.JPG

Another use full code for arduino to run 7200rpm

I wrote this code for measuring the rpm of a fan. I think it can be adapted. It works by timing a specified number of pulses (by the saples constant). The NoSensors determines the number of pulses/revolution. Just change these constants to suit your needs. The code is based on my state machine libray found here:


Experiments and more Info

I will love to explain here something more about this motors and the electric parts behind. Most of the HDD motors are BLDC (brushless) motors. They can be driven by brushless ESC. Cheapest would be to buy hobby RC ESC and drive it by PWM

I find this nice tutorial from I'm going to show you, how to program and use the Hobbyking ESC. I just found a few information and tutorials, which really didn't help me very much, so i decided to program an own sketch, which is very simple to understand.

Important to know:

In my Example i use writeMicroseconds, because it is easier to understand.

Step 1: Getting ESC information

You really should remark the Amperevalue of your ESC. This tutorial is only tested on 20 AMP ESC : /__15202__hobby_king_20a_esc_3a_ubec.html I can't really promise, that this is working with an other ESC but i think so, because in the english manual are 20 and 30 Amp ESC's described. In the German version is a generalisation from 10 to 120 Amp, thats why I think this could work for every ESC.

Step 2: Connection to Arduino I tried it with an arduino uno R3. First you have to connect the ESC to you lipo or NiMH. When you have done that you connect the ESC like so:

  • Black to GND
  • White/Yellow to PIN 9

Because you connected the ESC to your battery, the ESC is put under voltage. Thats why it It is important, that you DON'T connect the red wire to your 5v Port, because it could destroy your computer's USB Port. On this picture you can see the correct connection between ESC and Arduino (Mega). Picture source:


//////// other code to crontrol this motors /////

Sorry about that. No, there is only one for each, but the parts of the array are the pins:

motor_left[0] = pin 5, and [1] = pin 6.

Uh, the whole sketch is fairly large all up, but separated into three files, one with the drive functuions (forwards, back, left, right), the main one, and one with other stuff. By Ro-Bot-X @ Wed, 2011-02-02 14:48 Pins 5 and 6 are both PWM

   Login or register to post comments 

Pins 5 and 6 are both PWM pins tied to Timer0. You need to connect one of them to motor_left and the other to motor_right. Then the second pin of the motors can be a regular digital pin (for example 4 and 7). Lets group the pins like this:

  1. define motor_left_0 4 // direction pin, set it LOW for forward, HIGH for reverse
  2. define motor_left_1 5 // PWM pin, 0-255 values
  1. define motor_right_1 6 // PWM pin
  2. define motor_right_0 7 // direction pin, set it LOW for forward, HIGH for reverse

The enable pins have to be connected to Vcc (5V).

When driving forward, you set the direction pin LOW. A PWM value of 0 will have the motor stopped, then higher values make the motor spin faster and faster, 255 being the max speed.

When driving in reverse, you set the direction pin HIGH. A PWM value of 255 will have the motor stopped and lower vales will make the motor spin faster and faster, 0 being the max speed. To make this easy to use, just subtract the desired PWM value from 255 to get the inverted one, like this:

byte setPWM = 200;

//forward digitalWrite(motor_right_0, LOW); analogWrite(motor_right_1, setPWM);

//reverse digitalWrite(motor_right_0, HIGH); analogWrite(motor_right_1, 255-setPWM);

Does this look clear enough?

an example of a driver for a brushless DC motor without Microcontroler

   Control method: open loop, no feedback
   CPU: none
   Power source: 4x AA NiMH
   Sensors / input devices: none
   Target environment: ex hard drives

other posibilitie: