Need help integrating an RC receiver to an Arduino Uno

I seeking advice on the sketch type I should use. I don’t mind doing the research but have been having some problems finding the correct advice.

What I am trying to do is use existing free RC channels (4 ea) PWM output to an Arduino Uno.

I then need the Uno to communicate via serial tx rx to a DFplayer Mini. A mp3 player module needs to change between audio tracks and other available functions. (Two PWM channels) #1 channel 3 position switch to select files. #2 channel 2 position switch normally off repete last track.

I also need the Uno to communicate via 12C to an Adafruit 20W amp board to change the vol and to mute. (One PWM channel) 3 position switch Mute/Medium vol./Max vol.

I will also need to activate an Arduino compatible relay to operate a light. (One PWM channel) 2 position switch On/Off.

Ultimately the finished code will be inserted to an Adafruit Pro Trinket Mini that will operate amp board and mp3 player.

I am pretty new at writing sketches as I’ve been able to use examples until now to get by.

I’ll do my best to research, write, and test but can someone suggest a set of library’s and different Arduino modes that need to be utilized.

The reason for using RC reciever PWM out to microprocessor is it will be used on a drone.

I the PWM signals are only needed one way out to microprocessor.

Microprocessor then needs to communicate via serial tx/rx to DFPlayer mini and 12C to Amp board.

So would I be able to hook 4 wires plus ground up from RC reciever to microprocessor?

Then be able to distinguish between 2 or 3 PWM signal’s value per channel?

Then send appropriate one way data to other boards via 2 different data types?

I actually have this already wired up to a breadboard ready to code. Just need to hook up the reciever to the proper Uno pins to start.

I can add a pic of the prototype if neede?

Can anyone help on such a project?
Any help is very apperciated!

pulseIn()

JasonHohman:
What I am trying to do is use existing free RC channels (4 ea) PWM output to an Arduino Uno.

I then need the Uno to communicate via serial tx rx to a DFplayer Mini. A mp3 player module needs to change between audio tracks and other available functions. (Two PWM channels) #1 channel 3 position switch to select files. #2 channel 2 position switch normally off repete last track.

Do you really need to use an RC transmitter and receiver?

If you use a pair of cheap nRF24L01+ modules with a pair of Arduinos (one to transmit and one receive) you will have a great deal more capability and the programming will be much easier. For example you could easily transmit a specific track number and you could control many more options. Have a look at this Simple nRF24L01+ Tutorial.

...R

I have seen a YouTube on those modules. Thank you for that suggestion.
This will actually be attached to the bottom of a drone.
I have spare RC radio switches as well as spare channels on my RC reciever.

It would be ideal if I could utilize 4 inputs. Is this possible on the Pro Trinket? It is supposed to almost the same capability as the Uno. I could attach a data sheet.

I also have a few PPM encoder modules that I could try if that makes communication easier?

pulseIn()

Thank you I'll read up.

Briefly, however, it looks like this limits to either high or low. So two choices per "channel". If that is so I can modify my expectations on radio capability.

I know my radio with a three position switch outputs 3 different PWM values per channel.
I understand that it may be too difficult to expect Arduino IDE pulseIn() to see 3 different PWMs?

Thanks for all the help!

pulsein() gives you the pulse length of the PWM/servo signal. If your RC channel is has an analog control (gimbal or knob) you will see a wide range of varying lengths. A 3-position switch will give pulse lengths something like 1ms, 1.5ms or 2ms. Your code can then interpret these values. It's been done many times.

Steve

briefly, however, it looks like this limits to either high or low

Incorrect, pulseIn() measures the length(width) of the pulse in microseconds. it does not return HIGH or LOW.

I understand that it may be too difficult to expect Arduino IDE pulseIn() to see 3 different PWMs?

Keep researching, pulseIn() can do this easily.

JasonHohman:
This will actually be attached to the bottom of a drone.
I have spare RC radio switches as well as spare channels on my RC reciever.

I understand. The irony is that it is quite likely the RC receiver is actually using an nRF24 (or its Cypress equivalent) under the hood.

...R

This is great news about pulseIn()!
Thank you I will research more.
I am very new to this.
I have read somewhere that "PWM" signals could be decoded and displayed on an uno. I could not find any good instructions to do so. Does anyone know where I could find a diagram to hook up my RC to the Uno? I could then copy the "PWM" signals that RC is outputting to start writing the code.
Thanks a bunch!

Thanks nRF24 info. I believe I have a few of those modules as well. I also have several bluetooth modules and NodeMCUs. These all will send signals to microprocessors and my be easier to integrate. The goal in this project is to be universally compatible with other flying drones without an additional device signaling devices since the RC has the free switches and channels.

It may work if there was a nRF24 decoding the signal from RC reciever then wirelessly sending a signal to another nRF24 on the microprocessor.....? Not sure that would he the best usage. Am I missing a usage here.
All this info is great guys!!

"A 3-position switch will give pulse lengths something like 1ms, 1.5ms or 2ms. Your code can then interpret these values."

This is exactly what I need.

I have four switches I would like to use. 2ea two position switch, one two position switch spring loaded (normally off if you will), and a three position switch.

I have matched the RC radio switches to the channels on the RC reciever.

If I input the four wires and a ground to an Arduino would I use a digital input or analog input pin?

I could not find any good instructions to do so

Really?? LMGTFY

JasonHohman:
If I input the four wires and a ground to an Arduino would I use a digital input or analog input pin?

Connect to 4 digital inputs and start by just doing pulsein()s and printing the results so you know exactly what values you get.

E.g. see this tutorial.

Steve

JasonHohman:
It may work if there was a nRF24 decoding the signal from RC reciever then wirelessly sending a signal to another nRF24 on the microprocessor.....?

I don't understand what you have in mind. I would expect it would be a very complex task to build a program for working with an nRF24 to make it capable of receiving and interpreting the signals directly from the RC transmitter - and in any case that would only be possible if the transmitter is using an nRF24. AFAIK the Spektrum RC equipment uses Cypress wireless devices.

Separately, if you already have the output of the RC receiver there would be little point trying to send it by wireless to another device a few centimetres away. As well as which that just adds weight to the drone.

What may be possible (up to you to decide if it has value) is to put an nRF24 on the drone as a receiver for a completely separate transmission from an Arduino/nRF24 based controller that you use alongside the regular RC controller.

OR, if you are suitably adventurous, completely replace the existing RC controller with an Arduino/nRF24 system.

...R

Awesome! Thanks. I finally hooked up my reciever and now have a PWM readout (range) for 4 different channels.
I have written down the PWM range with the sticks centered and written down the PWM range with the sticks manipulated.

Now I have to learn how to write the code to activate a sunfounder relay to turn on a light.
(Have it all wired up to pin #7)

I then have to write the code for the amp board to mute/50%/100% volume with I2C comm.

Also have to add code to change file on a DFPlayerMini with UART TX/RX

Finally one more command to play last track played on a DFPlayerMini UART TX/RX.

Not sure how to write these extra commands to an existing code that I've been working on.

Thanks so much to everyone who has helped!!