• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Arduino Uno in the control loop

stythys

Junior Member
#1
I am trying out a project that I found on this site
http://www.flitetest.com/articles/qu...-using-arduino
and according to the comments some people have been able to get this to work on an apm board. I am trying to interface an arduino uno to an apm 2.5. I have tried many things to trouble shoot my set up and so what I am trying to do right now is just manually control the arducopter with the arduino in the control loop for the elevator and aileron channels. Essentially I have those two channels going directly from the receiver to the uno, then to the input on the apm.
I power the system with the props off and connect it to the mission planner. I then go to the radio calibration screen so I can have a nice visual of what the apm is seeing from its input ports. The apm is seeing the stick values fine on the screen they move smoothly with my stick movements on the controller. The problem is I don't see or hear any reaction from the motors on the two channels being sent through the uno board to the apm.
I've tried powering the uno board from my computer to see if the current draw was too much and no change. I undid the wiring and took the uno out of the loop to make sure nothing on the output side was wired up wrong and on the test run my motors responded fine.
Here is the stripped down code I am using on the uno just so I can rule out any interference by the rest of program I took it down to just translating input and spitting it back out.

#include <Servo.h>
Servo aleo,eleo,thro;
int x,y;
void setup()
{

aleo.attach(10);
eleo.attach(11);

Serial.begin(115200);
Serial.println("initializing......");
}
void loop()
{
x=pulseIn(3,HIGH,20000);
y=pulseIn(5,HIGH,20000);


aleo.writeMicroseconds(x);
eleo.writeMicroseconds(y);


}
 

stythys

Junior Member
#3
I enable it with the stick command from the rc controller. I do not have the throttle or yaw running through the uno board so arming is unaffected. When I run the motors without props on I can hear and see them react to the two channels not going through the uno. The two that go through the uno I do not have any response.