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;
  } 
}

Download the sketch file:

StepperTest.pde (829.00 bytes)


This is a experiment with arduino and nokia 3310 display module. I downloaded the library from http://www.nuelectronics.com/estore/index.php?main_page=product_info&products_id=12. I got the display modules from eBay and made my own simple breakout board. This demo shows the time reading from a DS1307 time keeping chip. Also demonstrates how to display a graphic image and animation on the display using the library.

Here is how it looks:

Here is a video clip:

 

Here is the arduino sketch:

Nokia3310_Clock.pde (5.80 kb)

pacman.h (5.87 kb)


I recently wrote some code to drive a 4 digit seven segment display using the arduino and 74HC595 shift register chip. The display is a seven segment common anode display with decimal dots. The pin configuration can be found here. I have connected a DS18S20 temparature sensor to read the temparature and display the reading on the seven segment display.

Here is how it looks:




Here is the arduino sketch:

Download the sketch from the link below: 

SevenSegmentTest.pde (2.27 kb)

If you have any questions, please feel free to ask me via the contact link.


Arduino project: The clock

I have been working on this for a while and finally it has been perfected. Here the arduino reads data from DS1307 RTC chip using I2C protocol and displays the time in english and bengali digits on a dot matrix display. The dot matrix display is connected to the arduino through 74HC595 shift register chips to expand the I/O pins of arduino. Here is how the prototype looks:

Photos:





Video:

Arduino Real Time Clock using I2C and Dot Matrix Display from Pial on Vimeo.


I know this has been posted by many people already on different web sites and forums. Still I am posting the Arduino (Atmega168) fuse bit settings, as it appears in AVR Stuido 4 programming  interface:

Fuse bits:



Lock bits:



Please remember the programming sequence:

Step one: Flash the appropriate boot loader

Step two: Set the fuse bits

Step three: Set the lock bits


I hope this helps. I myself looked for this information earlier and it was not easy to find them all together.


Arduino:

I came across Arduino while surfing the web for micro-controller related projects and initiatives. I think it is one of best platform for beginners to start playing with micro-controller programming. The great thing about the arduino is the IDE, which is greatly designed for ease of programming for beginners. However, you certainly do have the option to go into deep programming, but it is very simple if you are familiar with the micro-controller hardware (Atmel AVR architecture) and C++ programming. The arduino IDE languge is very similar to C and Java programming. It has a lot of built-in ready to be used libraries like LCD display interfacing, Stepper motor control, keypad library and lots more.

Learn more about Arduino at: http://www.arduino.cc

Here are some photos of arduino board: