Go Down

Topic: controlling 3 rc servos from one rc signal (Read 1 time) previous topic - next topic

mustang493

Can anyone point me in the right direction.  This probably very simple for most of you but i'm new to microcintrollers.  I have an rc plane and i want to operate the gear door lock. gear door and undercarriage servos with one switch on the tansmitter.  I am very confused with how to get the arduino to interpret the signal from the rc receiver.  can anyone give me some code to look at.

dxw00d

DuaneB has some excellent tutorials on the subject. Start with http://rcarduino.blogspot.co.uk/2012/01/how-to-read-rc-receiver-with.html.

mustang493

Have been through these tutorials and can see on the serial monitor how the code allows me to see the change in signal when i operate the transmitter but it doesn't explain how i transfer that to the servo, or is this obvious somwhere.

rgallant

No that code would not be in those examples, what you need to do is take the value from the transmitter channel(s) then create the servos movements you want from there.  You are basically creating a servo mix based on the transmitter value.

So when you flick the gear switch, you call the routines to move the servos so here is an example :

This 1st chunk simply loops waits from me flick the switch, in my case position 1 on my gear switch is the high position about 1800.
The Park Bot code then moves, all my Hexapods servos to the park position.  Note this is an isolated piece of code to test functions it does not do any intelligent testing, it will perform the Park_bot section until the switch is set back to zero.  I was using this to confirm the servos return to the same position each time.

In the Park_bot section I move each of the 18 servos in turn, that code is of no real use to you as I use an alternate wire library to control my servos.  But in you case the idea is the same, read your switch, have a routine to unlock the gear,raise the gear and close the doors.  Each servo is controlled separately so you will have to play with that code.  But get each section working then tie it together.  It is actually pretty simple.

Code: [Select]

// Wait for Reciever Gear switch to go to the 1 postions

ch[5] = pulseIn(Gear,HIGH, 25000); // Read the pulse width of

while (ch[5] > 1500)

{
delay(1000);
Serial.println("Flip Gear switch to 1 to continue");
ch[5] = pulseIn(8,HIGH, 25000); // Read the pulse width of


Park_bot();


oric_dan

OP, I think what you want to do is read the 1 signal from the receiver, and create
3 different servo objects, and send the same pulse value to all 3. No?

retrolefty


OP, I think what you want to do is read the 1 signal from the receiver, and create
3 different servo objects, and send the same pulse value to all 3. No?


First part is correct, but then one can send 3 different position commands to the 3 servos and even time sequence to suit his requirement. Input from receiver is just a signal to start (effectively a go/no go signal) his required sequence to the three servos via three different servo output commands. The receiver's channel information will be digital in nature as it's being generated from just an on/off channel switch on the transmitter, not one of the joy stick encoded channel signals.

Lefty


oric_dan

#6
Nov 28, 2012, 08:56 pm Last Edit: Nov 28, 2012, 08:59 pm by oric_dan(333) Reason: 1
Yes, of course. Do R/C transmitters always send a pulse out to each receiver channel,
or only when the switch is closed? Maybe 1000-usec for switch open, 2000-usec for
switch closed?

retrolefty


Yes, of course. Do R/C transmitters always send a pulse out to each receiver channel,
or only when the switch is closed? Maybe 1000-usec for switch open, 2000-usec for
switch closed?


Yes, 1000us and 2000us is typically what the off/on switch position is encoded to, and yes that 'switch' channel is sent every PPM frame along with all the other channels.

Lefty

rgallant

Just to make things fun the 1000/2000 is a little vague I have a spectrum Dx7 transmitter and AR6100E reciever 1099/1899 but that varies a bit. That why I check against 1500 for the switch, as it is either on or off. 

I built a dummy airboat , basically everything required mounted to a board, to play with ESC's, receivers and servos.  That was a good learning experience.

Go Up