Pial's (We)Blog

Hobby electronics, interesting findings on the web



Recently I collected a broken hard drive to experiment on making a POV clock that I found on the web. After taking the hard drive apart, my first idea was to drive the stepper motor in the hard drive using Arduino. I looked around the web for writeup and tutorials about the principles of driving stepper motors. I particularly found this resource very useful: http://www.cs.uiowa.edu/~jones/step/. Reading this tutorial I found out the type of stepper motor the hard drive had, as there are couple of types of stepper motors available in the market. This hard drive had a Variable Reluctance Stepper Motor and the internal construction of it is like the figure below.

 . . . . . . . . 1 ---/\/\/\-  .            1 | . .      2   X   3 2 ---/\/\/\-|-- C        Y o Y |          3   X   2 3 ---/\/\/\-               1
The motor has 4 pins, the common pin is usually connected to the positive power supply and the three other pins are required to be supplied negative voltage in a sequence to get the stepper motor moving. The logic is visualized in the figure below:



Now that I understood the logic of driving the motor, I wrote up the code for Arduino. The code uses 3 arduino digital pins in output mode (Pin 2,3,4) to drive the 3 coils of the stepper motor. However the arduino digital I/O pins does not produce enough current to drive the motor coils. Therefore power transistors or Darlington array chips (ULN2003 etc.) or H-Bridge motor drive chip (L293D etc.) are required to successfully drive the motor. For the experiment I used couple of regular NPN switching transistors (2N3904). These transistors yield quite low current (around 150-200mA), so I couldn't drive the motor beyond a certain speed. I wrote the code that will start spinning the motor at a lower speed and then gradually speed up. You can play with the steppingDealy value to control the speed of the motor.

Here is the arduino code:


int pinA = 2;
int pinB = 3;
int pinC = 4;
int steppingDelay = 100;

void setup() {
  pinMode(pinA, OUTPUT);
  pinMode(pinB, OUTPUT);
  pinMode(pinC, OUTPUT);

  digitalWrite(pinA, HIGH);
  digitalWrite(pinB, HIGH);
  digitalWrite(pinC, HIGH);  
}

void loop() {
  stepping(1);
  delay(steppingDelay);
  stepping(2);
  delay(steppingDelay);  
  stepping(3);
  delay(steppingDelay);
  if(steppingDelay > 10)
  {
    steppingDelay--;
  }
}

void stepping(int stage)
{
  switch(stage)
  {
  case 1:
    digitalWrite(pinA, LOW);
    digitalWrite(pinB, HIGH);
    digitalWrite(pinC, HIGH);
    break;
  case 2:
    digitalWrite(pinA, HIGH);
    digitalWrite(pinB, LOW);
    digitalWrite(pinC, HIGH);
    break;
  default:
    digitalWrite(pinA, HIGH);
    digitalWrite(pinB, HIGH);
    digitalWrite(pinC, LOW);
    break;
  } 
}

Arduino sketch download:

StepperTest.pde (829.00 bytes)



When I was on TI's website today checking out the MSP430 microcontroller series chips, I also discovered another cool product they have. It's a wristwatch with built-in RF transceiver based on their one family of microcontrollers (CC430 RF SoC Series). It is called the EZ430-Chronos. This is full featured sports watch with time keeping, 3-axis accelerometer, pressure sensor and temperature sensor. The watch can easily communicate with other wireless sensors around it that are transmitting in the same frequency. The watch kit comes with two USB interface module. One for wireless connection to the watch to set time etc. or collect accelerometer and other sensor data on the pc. The other interface is to reprogram the watch if you want. The kit also comes with tools to disassemble the watch for reprogramming. There is a wiki page for more information at:
http://www.ti.com/chronoswiki

I believe it will be definite attraction for techsavy people out there.



Today I bumped into TI's website about their recently released embedded development kit targeted towards hobbyists. It is called the LaunchPad. The kit is priced at only $4.30 and TI's store will ship it free if ordered from there. You can also order it from their distribution partners, but with shipping cost. However, one of the distribution partner, Arrow Electronics is offering free shipping till the end of July for any orders. So you can order it there as well for free shipping. Here are the few features of the microcontrollers that comes with the kit.

Features

  • Low Supply Voltage Range 1.8 V to 3.6 V
  • Ultralow Power Consumption
    • Active Mode: 220 µA at 1 MHz, 2.2 V
    • Standby Mode: 0.5 µA
    • Off Mode (RAM Retention): 0.1 µA
  • Five Power-Saving Modes
  • Ultrafast Wake-Up From Standby Mode in Less Than 1 µs
  • 16-Bit RISC Architecture, 62.5 ns Instruction Cycle Time
  • Basic Clock Module Configurations:
    • Internal Frequencies up to 16 MHz With One Calibrated Frequency
    • Internal Very Low Power LF Oscillator
    • 32-kHz Crystal
    • External Digital Clock Source
  • 16-Bit Timer_A With Two Capture/Compare Registers
  • Universal Serial Interface (USI) Supporting SPI and I2C (See Table 1)
  • Brownout Detector
  • 10-Bit 200-ksps A/D Converter With Internal Reference, Sample-and-Hold,
    and Autoscan (See Table 1)
  • Serial Onboard Programming, No External Programming Voltage Needed
    Programmable Code Protection by Security Fuse
  • On-Chip Emulation Logic With Spy-Bi-Wire Interface

The kit comes with the followings:

  • LaunchPad Development board (MSP-EXP430G2)
  • Mini USB cable
  • 2x MSP430 flash devices
    • MSP430G2211IN14 flash device
    • MSP430G2231IN14 flash device (preloaded with sample program)
  • 10-pin PCB Connectors (2 male & 2 female)
  • 32kHz crystal
  • Quick Start Guide
  • 2x LaunchPad stickers

    I believe it will be quite popular in the hobbiest community for the low price of the microcontrollers (around $2.17 for retail) and low power usage of the chips. I saw a demo video where they were powering up the microcontroller and a LCD display using only 3 pieces of grapes, potatos, kiwis etc.
  • For more information please visit their wiki site at: http://www.ti.com/launchpadwiki




    Control panel


    Blogroll


      Archive