Autonomous helicopter using digital pot

Hello everybody!

i started new project- to make a really simply helicopter to autonomous.

to do so i'm using few things:

  1. co-axial helicopter with 2 main rotors and one back rotor.
  2. 3 digital pot (5k each) which replace the rudders (mechanical pot).
  3. infrared cameras in 360 degree which give me the heli location(x,y,z) and his yaw angle.
  4. arduino UNO \Mega.

i know how to control the pots and i wrote simple code to control the 3 DOF-(yaw,forward\backward, lift).

but, how to say it, its doent work at all.

i know PID control in theory by using the dynamic model but i dont know how to do it in Arduino, specially if my dynamic model is not quite accurate.
i tried to understand how to do it with the PID library without any success.

if anyone can help me with the code it will be wonderful, its quite urgent.

thank!

if anyone can help me with the code

What code?
I don't see any code.

its doesnt work at all and its really stupid one, for example my altitude control is:

void z_control(int z, int error)
{
//z is the cureent height location, error is z_ref-z
digitalWrite(slaveSelectLift, LOW);
if (error > 2)
{ //beneath the ref
if (z <= last_z)
{ //not going up the ref. if not-we going towards the ref and no change need to be done
if (velocity < 250)
{ // over 255 the scale go to zero again
velocity = velocity + 5;
SPI.transfer(0);
SPI.transfer(velocity);
}
}
}
else if (error < 2)
{ //over the ref
if (z >= last_z)
{ //not going down to the ref. if going to the ref- no change need to be done.
if (velocity > 35)
{ //beneath 30 the engine stops
velocity = velocity - 5;
SPI.transfer(0);
SPI.transfer(velocity);
}
}
}
digitalWrite(slaveSelectLift, HIGH);
last_z = z;
}

//velocity is the number sent to the main rotors and its global variable.

its doesnt work at all

Because it doesn't compile.

Post all your code.
Use code tags.

i will upload it tomorrow because its not on me right now.
meanwhile i would love to know if someone did project like this.

PS- how im using the code tags? (sorry i'm new here :o )

PS- how im using the code tags? (sorry i'm new here :o )

Simple, 7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Also a picture of your project and the "pots" you are using.

Tom..... :slight_smile: