Wednesday, February 24, 2010

Long Range XBee PRO XSC testing, Part 2

It has been awhile since my original post about seeing how large of a distance I can get two XBee PROs to communicate, but since coming across two nice 902 - 928Mhz ISM band 9 element yagi antennas I figured it was time to give it a try.


My plan is to mount two XBee PRO XSCs each to one of the yagis mounted on tripods. A small ttl to serial interface will be needed at each end which will allow interfacing to laptops. These setups will need to be as portable as possible. With each setup I will be able to set them up easily at any location (the tripod / antenna / XBee and interface, along with a laptop will be the only items needed) and test signal strength and communication using the XBee X-CTU application.

I finished the first ttl to serial converter tonight, only one more to make:




The final step will be to find two locations that are line of sight and up to 15 miles apart using topographical data. 15 miles is a long way, so I will be starting with a five mile distance. As soon as it warms up I will be giving the range test a try. I'm hoping to reach the 15 mile range Digi states that these modules are capable of, but even further would be better. :D

Thursday, February 11, 2010

Serial VFD character displays are awesome

I finally spent a few minutes powering up the serial VFDs I bought a month or so ago, they are all working. :)




And it's bright! :D Placing a filter over the front will increase contrast and make it much easier to read in bright conditions.

I will say that these are by far the easiest displays I have ever worked with. Powered it up with 5V, wired it through a max232 to my machine, 19200, 8,1,1 was its default serial config and it was running. Any text to the terminal showed up on the display. Special codes can place cursor and clear the display. With a little extra work you can write custom characters to the displays memory. Interfacing these with any microcontroller will be so easy and will save a bunch of io pins and code space not having to interface HD44780 compatible displays via a parallel interface.

Thursday, February 4, 2010

Using a hard drive spindle motor for projects

I was recently staring at a pile of 15K RPM SCSI drives that had gone bad at work. I have always admired the build quality of these drives, the fact that they can spin at 15000 rpm without failure for years is amazing. I was curious if the platter spindle motors would be useful to use in any type of projects, so I tore a couple drives apart and pulled the spindle motors out of them.

These spindle motors are basically a small three phase motor. My initial assumption to drive them was that you would need to provide each phase a voltage pulse in sequence to create rotation. Looking at a drive with my scope I could see that this was definitely not the case. The waveform on each pin was extremely complex, actually so complex that all of my Agilent and Tektronix digital scopes had a hard time capturing the waveform. My best success in capturing was with my Tektronix analog scope. The waveform to one of the phases can be seen here:


This shows again how as awesome as digital scopes are, sometimes an analog scope can provide a better picture of the waveform you are trying to see. :)

To drive this motor, I wanted to see if I could get it spinning as fast as possible with the minimum amount of circuitry simply by pulsing the three phases in sequence. I chose a pic 18F4520 as the controller and was driving each phase using a TIP31C power transistor. Initially I was using a ULN2003 to drive the phases, but found the current consumption from the motor was higher than I would have liked risking damage to the ULN2003. This motor is definitely harder to drive than a typical stepper motor.



When initially starting up the motor, you need to start the pulses at a slow rate. I found that pulsing each phase at about 20Hz (1200 rpm) was slow enough to get the spindle rotating.



Once initial rotation is established you can begin decreasing the delay between pulses to increase the spindle rotation speed. Driving the motor with a square wave, I am able to reach speeds just over 100Hz (6000 rpm) before the motor begins decreasing speed.

At this point my pulses begin to overrun each other causing speed to decrease as each phase is on consecutively. Decreasing the pulse width doesn't help either as the decreased pulse width doesn't provide enough current to each winding to keep the motor running. I would like to try driving it with sine waves, or that complex waveform that the original controller generates, but 6k rpm is pretty good for the minimal circuitry required. Not bad for about an hour worth of work anyway.


I found that placing the platters back on the spindle acted as a flywheel which helped the motor maintain smoothness being driven by the pulses. To control the speed, I used an adjustable resistor to provide input into one of the adc inputs on the pic. This in turn adjusted the pulse width of the motor. Here is the code to make it spin:



#pragma config WDT = OFF

void delay1(int result1)
{
result1 = result1 / 20;
if (result1 <= 30)
{
result1 = 30;
}
Delay1KTCYx(result1);
}
void delay2(int result1)
{
result1 = result1 / 12;
Delay1KTCYx(result1);
}

void main (void)
{
int result1;
TRISB = 0x00;
while (1)
{
OpenADC( ADC_FOSC_4 & ADC_RIGHT_JUST & ADC_4_TAD, ADC_CH0 & ADC_INT_OFF, 15 );
ConvertADC();
while( BusyADC() );
result1 = ReadADC();
CloseADC();


PORTB = 0b00000001;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
PORTB = 0b00000010;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
PORTB = 0b00000100;
delay1(result1); //big
PORTB = 0b00000000;
delay2(result1); //short
}
}




Next I plan creating a simulated sine wave with the pic to try to obtain higher speeds and smoothness replicating what the hard drive controller circuity does. I would like to look into the pulses generate by the actual hard drive controller as well to get a better understanding of how it can reach speeds of 15000 rpm.