Managing 16 Radio Signals

Hey everyone!

I'm currently working on a large animatronics project and am running into a few road blocks as far as controlling everything. The goal is to have an animatronic puppet which is capable of automatically performing a variety of pre-made gestures. Along with this, I need to emulate the one to one control via rc controllers that my puppeteers are used to.

So where the problem comes in is trying to connect 2 transmitters with 8 ports each into either an arduino uno with an EZ-Expander shield (EZ-Expander) or an arduino mega. I'm only just messing around with ideas right now and quickly realizing that the pulseIn function when used 16 times is going to lag everything up to the point it'll be too slow to work.

Is there any way I could manage 16 RC signal inputs at once on one Arduino board without slowing everything down to the point that it'll be unusable?

Would be so kind as to help us know what you are writing about? What does this mean "2 transmitters with 8 ports each". Some actual documentation would help us hep you. You have all this stuff in front of you we don't.

Paul

Hey! Sorry about being so unclear Paul. Just a little too wrapped up in this project to realize I was doing a bad job explaining. So, I'm just going to start again here.

I want two RC controllers to send their signals into two RC receivers with 8 ports each. I then want those two receivers to feed 8 wires each into an arduino mega. (I've left some pictures here to give a clearer picture. I don't quite have all the pieces yet, so I've just drawn the outline of some pieces and and the receiver pictured only has 6 slots as apposed to 8.) https://drive.google.com/drive/folders/1XulcyeScFA7YdvsvLlk84RRswow4uaxl?usp=sharing

Each of the ( 8 ) ports of each receiver feeds a signal into one of the digital pins of the arduino to be read.

Currently, I'm just testing with one receiver on an arduino uno, and finding that, when given only six radio signals to read, the Arduino gets bogged down like crazy. I'm using the pulseIn fuction to read each of the six signals right now. Here's the code I've written to test the speed on this:

#define rcPin0 0
#define rcPin1 1
#define rcPin2 2
#define rcPin3 3
#define rcPin4 4
#define rcPin5 5

Serial.begin(9600);

void setup() {
pinMode(rcPin0, INPUT);
pinMode(rcPin1, INPUT);
pinMode(rcPin2, INPUT);
pinMode(rcPin3, INPUT);
pinMode(rcPin4, INPUT);
pinMode(rcPin5, INPUT);

}

void loop() {

left_y_in = pulseIn(rcPin0, HIGH, 20000);
right_x_in = pulseIn(rcPin1, HIGH, 20000);
right_y_in = pulseIn(rcPin2, HIGH, 20000);
left_x_in = pulseIn(rcPin3, HIGH, 20000);
gear_in = pulseIn(rcPin4, HIGH, 20000);
aux1_in = pulseIn(rcPin5, HIGH, 20000);

Serial.println(left_y_map); //using this to see how long it takes for the board to run through the code

}

So I'm realizing with 16 signals, this program is going to run far too slow for my needs using the pulseIn function. Is there a better way to go about this, or is reading 16 radio signals simultaneously just inevitably going to make the arduino super slow?

I'll be around all day today so I'll try to give a faster response if anyone has any further questions :slight_smile:

Do you really need to use the two RC controllers?

If you could use an Arduino with an nRF24L01+ wireless transceiver to replace the controllers and another nRF24 at the receiver end it should be very simple to control all those actions.

...R
Simple nRF24L01+ Tutorial

Thank you for that suggestion! I would honestly love to use something like that and will hopefully be able to convince the people I'm working with to do so in the future. Sadly though, for this project at least, they are dead set on using these remotes so I'm just trying to integrate them in the best possible way I can.

That can't possibly be the code you are using. Please show the actual program with the proper unsigned long pulse lengths properly defined.

Paul

Paul_KD7HB:
That can't possibly be the code you are using. Please show the actual program with the proper unsigned long pulse lengths properly defined.

Paul

Hey Paul! I was more just fiddling around to see how much having all those rc signals inputting into the board would lag everything. But, in the past few hours I've gotten the code to this point and it seems to be interpreting everything alright (and mapping all values to servo friendly ones between 0-180), albeit very slowly.

If you see something that could be improved I'd love to give it a shot. I'm sure any little improvements would help alot. I'm pretty new to things so there might be some pretty basic things going right over my head.

#define rcPin0 3
#define rcPin1 4
#define rcPin2 5
#define rcPin3 6
#define rcPin4 7
#define rcPin5 8

int left_y_in = 0;
int right_x_in = 0;
int right_y_in = 0;
int left_x_in = 0;
int gear_in = 0;
int aux1_in = 0;

int lefty;
int rightx;
int righty;
int leftx;
int gear;
int aux1;

void setup() {
pinMode(rcPin0, INPUT);
pinMode(rcPin1, INPUT);
pinMode(rcPin2, INPUT);
pinMode(rcPin3, INPUT);
pinMode(rcPin4, INPUT);
pinMode(rcPin5, INPUT);
}

void loop() {

left_y_in = pulseIn(rcPin0, HIGH, 29000);
right_x_in = pulseIn(rcPin1, HIGH, 23000);
right_y_in = pulseIn(rcPin2, HIGH, 20000);
left_x_in = pulseIn(rcPin3, HIGH, 20000);
gear_in = pulseIn(rcPin4, HIGH, 29000);
aux1_in = pulseIn(rcPin5, HIGH, 28000);

lefty = map(left_y_in, 881, 2069, 180, 0);
rightx = map(right_x_in, 2069, 882, 0, 180);
righty = map(right_y_in, 882, 2068, 0, 180);
leftx = map(left_x_in, 2066, 884, 0, 180);
if(gear_in < 1000){gear = 0;}
if((gear_in > 1200) && (gear_in < 1800)){gear = 90;}
if(gear_in >1800){gear_ = 180;}
if(aux1_in < 1000){aux1 = 0;}
if((aux1_in > 1200) && (aux1_in < 1800)){aux1 = 90;}
if(aux1_in >1800){aux1 = 180;}

}

kindcat, if you use a receiver with CPPM, you can read up to 9 channels using only 1 pin.

What receiver(s) are you using now?

Currently I'm messing around with a Spektrum AR-610 receiver, which uses spektrum's DSMX protocol. I have yet to buy the receivers that will be used in the final build though, so I'm definitely going to put some time into researching CPPM receivers. They sound like they might help this project alot.

Thank you Vince!

Please read up on pulseln()! It returns a long int, 32 bits, time in microseconds.

Paul

search term: arduino port manipulation