Pages: [1]   Go Down
Author Topic: controlling 3 rc servos from one rc signal  (Read 1003 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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();

Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: November 28, 2012, 02:59:28 pm by oric_dan(333) » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: