Generating a single pulse

Hi all -

I am using a Arduino Duemilanove with a Firgelli PQ-12-P linear actuator. It can go 20 mm, at 0.1 mm steps, or 200 steps total. When voltage is applied to two pins in one way, it extends, and the other way it retracts. Pin2+/Pin3- extends, Pin2-/Pin3+ retracts. (I have Arduino Digi Output 1 on Pin 2, and Digi Output 2 on Pin 3, by the way). The longer you apply the voltage, the further it goes. I want to create two programs. One takes one step forward, one takes one step backward. These little bundles I want to drop into LabVIEW.

The good news is I can get it to do exactly what I want it to do. The bad news is that it takes some undesired pre-move before it does it.

So I basically played around with examples until I got something that does what I want it to do. It looks like this (for the extend):


void(setup) {
//EXTEND

pinMode(1, OUTPUT);
pinMode(0, OUTPUT);
digitalWrite(0, LOW);
digitalWrite(1, HIGH);
delay(10);
digitalWrite(0, LOW);
digitalWrite(0, LOW);
}
void(loop)
{
}


So it basically does what I want, but it does some strange extra step, that seems unavoidable, which is that it extends a few steps, and then retracts a few steps, to the same position, before it does my desired command.

What's interesting is that when I completely strip the code down to nothing, it does the same quick out/in motion (without the desired extension/retraction, obviously).


void setup()
{
}
void loop()
{
}

I was wondering if anyone had any idea why this happens. This movement, I believe, implies a quick H/L and then L/H occuring on digi output pins 0 and 1.

(By the way, the current draw is a bit too high for the digi outputs, so I built a circuit with a 12 V power supply (made by XP Power), and an H-Bridge chip (made by ROHM). Basically this just amplifies the Arduino signal, so I believe and hope this is irrespective of my question.)

Thanks a million. Your participation in the forums in the past have already been very helpful to me.

First things first, are you aware that digital pins 0 and 1 are used by the serial communications interface to the PC? Maybe you should just try the whole thing with different pins first to see if that's the problem.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

That did the trick!

Thank you very much for your help.

To those trying to do this in the future:

(By the way, you will need to change the delay time to do a single step. I'm not sure that 10 ms is correct. However, I have no multimeter at the moment to check the voltage coming from the potentiometer to verify how many steps it took.)


void(setup) {
//EXTEND

pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(10);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void(loop)
{
}


and


void(setup) {
//RETRACT

pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
digitalWrite(3, LOW); // switch 2 to 3
digitalWrite(2, HIGH); // switch 3 to 2
delay(10);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
}
void(loop)
{
}


If the actuator has an internal pot, then you might connect the pot output to an analog input on the arduino, then control it somewhat like a servo. you would put in a desired voltage value (position) and the arduino would PWM move the actuator until the desired input voltage (position) is reached.