RC reciever output to arduino - RC Groups
Shop our Airplanes Products Drone Products Sales
Thread Tools
Sep 20, 2017, 06:43 PM
Registered User
Discussion

RC reciever output to arduino


I know there have been threads on this before, the main one by Dutchraptor is closed. I'm probably repeating a lot but could use help from those that know more about it. Since I'm now interested in it I thought I'd start a new thread for me.

I'm planning on a hybrid rc model that uses a regular, if old, rc radio, six channel (airplane type radio, airtronics), I'd use the basic channels for forward revserse throttle and for steering, that leaves me with 4 channels, two joystick type pots and one on/off switch and one three postion switch. For now I just want to be able to use the other channels for on/off switches.

I used the most rudimentry sketch from somewhere on sparkfun using pulsin() and it seemed to work just fine, I was able to read all the channels on the 1000-2000 range. But I've heard/read that is a very bad path to take, burning up processor time by waiting a lot for one thing. Using interupts and other slightly more complicated methods is much better. I'm really tempted by the simplicity of the pulsein method and wonder how bad it's really going to affect me if my sketch isn't too time sensitive, or terribly complex. Again the throttle and steeing would go direct from the radio to the esc and servo so the control of that would be unaffected.

I just don't have much experience with it so will plod through it and eventually decide for myself, but certainly appreciate any input, including reposting or referring to whatever you've done in the past that I've missed. I'm a lazy searcher. But I have searched this recently outside rcgroups and don't particluarly look forward to parsing all the different methods, sounds like many, many hours of effort.

I guess in particular I would add that the sketch will likely only run the compass directed turret system, maybe another thing or two but would be considered not terribly important, a bit of time lag even being more realistic. Another question is how the pulsein or interupts might affect the compass readings or stepper motor operation. The one thing about the pulsein is it does its thing and finishes and doesn't affect the rest of the program, I don't think interupts would affect that but don't know. Don't want to miss any stepper steps for sure.

Thanks in advance. Cap
Sign up now
to remove ads between posts
Sep 20, 2017, 10:32 PM
Registered User
steamboatmodel's Avatar
I know that with the new 2.4 gear it doesn't matter but I hope that when you say "a regular, if old, rc radio, six channel (airplane type radio, airtronics)," that it is not on an aircraft frequency, but on a surface frequency.
Regards,
Gerald.
Sep 25, 2017, 04:10 AM
Registered User
Mike Meyer's Avatar
Well, I'd say not using pulsein was good advice. Unless you really only want to watch one channel, and don't care what else happens while you're waiting, anyway.

My personal advice would be - don't bother with the Arduino. While I love the little micros and minis for aircraft, where weight and power consumption are crucial factors, for anything the surface I use newer, faster (hence bigger & more power-hungry) hardware, typically ST Micro's 32-bit ARM-based stuff. And even on aircraft, I'm liable to go with small STM32F1 sticks if I need more IOs.

My current build (tank, not a ship) is using a Nucleo F411RE. US$12 with overnight shipping to anywhere in the US. Can use Arduino boards that are UNO R3 and 3.3V compatible. It's got enough oomph that I can easily write the code in -python, which is a lot easier to deal with than C++ on the Arduino. Not to mention how much fun it is to connect to the REPL and invoke stuff directly.

I'm not doing PWM input, but I do have an ultrasonic rangefinder which has a similar problem: I need to measure the length of pulse on the "return" pin, which starts when the ping is sent, and stops when it gets the return, with values as low as a few hundred -seconds. The IRQ handler is:

Code:
    def IRQ(self, pin):
        if self.return_pin.value():
            self.start_micros = micros()
        elif self.start_micros is not None:
            self.elapsed = elapsed_micros(self.start_micros)
        else:
            self.bogus = True
This hardware also has the advantage that nearly every pin on the thing can do PWM and interrupts. And it's got something like three times as many IO pins as the Arduino.
Sep 25, 2017, 02:48 PM
Fairly Stable
Pulsin works fine if you have relatively few signals to monitor. For monitoring several channels, a better technique is to use a receiver's PPM signal, IF IT HAS ONE. Unfortunately, not all of them do, or don't document it.

I haven't used the PPM method in my projects because my receivers lack the signal.

The PPM signal basically stacks all the receiver channels onto one line, with the pulse timings denoting individual signal lengths. It makes for faster reading, since the microcontroller doesn't have to wait for the next complete servo signal boundary.
Sep 25, 2017, 07:26 PM
Registered User
Mike, Thanks for responding, I'm sure you are right that arduino is not the optimal processor, however I don't like change, arduino is most common and simple and I know it so I've not yet plunged into other options. I will note arduino sketches do not require writing C++, it's simpler than python in fact. Boats generally have ample room and seldom have weight issues so that doesn't sway me either. I will tally a no vote on pulsein() though. I love tanks, will have a look at your posts.

Thanks too Satbiker, I did read about PPM, have not checked but doubt my old radios have it, sounds like best way to go with multiple channels, will use if I can. Cap
Sep 25, 2017, 10:41 PM
Submarines, etc.
tsenecal's Avatar
pulsein is basically the worst possible way to get data from the receiver. it offers absolutely no recourse if the connection between the transmitter and receiver fails while in the call. the call will never return in a failsafe situation. if you use an interrupt, you can add a few lines of code that will signify a failsafe condition, and act accordingly.

reading ppm is basically no different than reading a single channel, it is simply ALL channels combined, one after the other. the only advantage reading the PPM stream offers is if you are trying to read more than one channel from the receiver... if you read individual channels, you will need a pin/interrupt for each channel, if you read the PPM stream, you only need one pin/interrupt.
Sep 26, 2017, 12:59 PM
Registered User
Look into RCArduinoFastLib for arduino. You basically don't need to do any of the back-end work. It works so fast there's no delay/jitter/etc and lets your own code run fine. It can operate multiple channels, iirc 6 or more. This doesn't have to include your normal throttle/steering channels.

You put your code in the normal loop function, then it modifies the output of a given input in the bUpdateFlags section near the end. You can do a number of things from changing the output of a channel completely, to having an extra channel adjust a different channel. IIRC it allows you to use

An example is a DIY lipo cut I've considered. It either reads battery power directly or uses a cheap lipo alarm and reads if the siren is active. When it detects this, it modifies the throttle channel from a 1:1 ratio to a 2:1 reduction (dual rates) or simply doesn't allow it past a certain throttle level.

Psudo-code for that would be (assuming 1500ms is neutral):

if(alarmactive = true)
{output = ( (input - 1000) * 0.5 ) + 1000)}

Full throttle of 2000ms turns into 1750ms or half throttle.
Sep 26, 2017, 05:16 PM
Registered User
tsenacal, You must have written that before, I knew I'd seen it somewhere. Good to know another reason not to use pulsein. I'll likely use an arduino mega so I should have enough pins for interupts too.

Hydro, thanks, that looks like a good place to start (fastlib), I think I read about it once but failed to follow up. That is what I'm looking for, something that avoids all the back-work, and is all developed and ready to go, that's great. It would be great too to run the throttle through the arduino too because I'm thinking of using some brushless motors, they get way high rpms, too high, probably melt the bearings, but they can also run pretty slow which I'd like to have it do. I tried the pulsein and mapping the throttle range but was unsucessful, it was an experiment, maybe using the fastlib I can do it.

Any one use brushless motors on RC boats (other than racing/high speed) much? Bad idea?

Thanks for all the input, anything else is welcome. Cap (I recieved the 1/200 bismarck so will have some photo's of RC conversion soon)
Sep 26, 2017, 06:32 PM
Fairly Stable
Quote:
Originally Posted by Hydrocarbon82
Look into RCArduinoFastLib for arduino. ...
That's a good library to know. I was unaware of it, so thanks for mentioning it.
Sep 26, 2017, 09:14 PM
Registered User
Mike Meyer's Avatar
If you're using the Arduino IDE, you're using C++. If you're like me, you close your eyes and pretend it's C. I get burned every once and a while, but I think it's the less painful option. If you're using something else, I'd be interested to know what. If its C, you can use the Arduino IDE on some the STM boards.

Unfortunately, you won't find anything from me on the tank or Micropython here. There's an unedited (last time I checked, anyway) video of my presentation on it to a local Python group at https://www.twitch.tv/videos/174475982. The tank gets run, code examined, etc.

If you're looking at changing rx's, you may be better off with S-BUS instead of PPM. Video going into the differences: https://www.rcgroups.com/forums/show...-CPPM-vs-S-BUS.

One last thing I should have mentioned in that first post. The STM32F4s have hardware support for PWM input. Not exposed in micropython, though. I haven't had a need to play with it , so I'm not sure how good it is. But it does allow you to do other things while waiting.
Sep 26, 2017, 11:07 PM
Registered User
Quote:
Originally Posted by capricorn
Any one use brushless motors on RC boats (other than racing/high speed) much? Bad idea?
Quite a few people use brushless in their rescue boats now. You can get low-KV motors that are very efficient & powerful, and they'll stay very cool if you don't over-prop them. Brushed are rarely over 50% efficient while the worst brushless are >80%. They'll also gain efficiency if you increase voltage & decrease KV (for a similar effective RPM). Last thing is most decent bearings will go past 40k no prob and the best will be 60k+. It's really just flex cable harmonics & prop inefficiencies past 30k, not bearing issues.

Also I used MS in place of uS...a 2-sec throttle pulse lol.
Sep 27, 2017, 06:36 PM
Registered User
Quote:
If you're using the Arduino IDE, you're using C++.
You are right Mike, essentially, I'm not sure what made me think otherwise, I guess when I started the microprocessor stuff I first did it using straight C++, that was a pain and a half, arduino ide just seems simple now, but I guess I've used it enough.

Thanks for the links, I'll check out the tanks and the other but I'm a bit overloaded now. Haven't gotten to look much at fastlib that Hydro mentioned yet, have you used that?

Hydro, I have a low Kv motor and esc, it works great, that's why I want to use them. A bit odd for a boat, it's an outrunner. So has a built in fan, but due to the rotating housing and all the stepper wires I was considering covering them so there aren't any horrible tangles, that might result in a build up of heat but I'm aware of it, I think I can vent them, add a tiny fan if needed.

As far as bearings melting, that was in reference to the styrene. It's a styrene hull and will likely have styrene around the prop shafts etc (with a brass tube bearing/liner), so too high of rpms could cause enough heat to melt the styrene, but I'm aware of that too. Just based on the motor rpm and it's high torque, if ran full speed (especially in air) it would be bad, not that I would do that. For some reason I like the outrunner type motor due to its natural extra flywheel inertia, greater rotor diameter and all, seems to run well at low speed (and high). If it's a fail no big deal, I'll just fix it.

PS: I am using 3/32" dia prop shafts (2.4mm) with 1/8" OD tube bearings, I've read some rather dubious, exagerated warnings about what a catastrophy that would be for a 1/200 BB, but I can say I'm not concerned. Unsupported lengths short enough that resonant vibration won't happen. Other than that it's torque, and how much torque can you get with a 7/8" dia prop in water? Not much. If, by chance it were hit by a topedo at or around the rudder area that could be a problem though. Does anyone know offhand what the Bismarck prop shaft diameter was? 3/32" is about 19" dia scaled. The trumpeter comes with ~5/64" metal shafts, which I assume are close to scale, that's about 15.5".

Thanks all for the input. Cap
Sep 28, 2017, 11:40 AM
Big Boats Rule!
boater_dave's Avatar
For most plastic scale model conversions almost anything works. My Lindy USCG cutter used the smallest K&S brass tube and the solid brass rod that fit inside and that setup lasted over 20 years. I finally switched because I broke a blade off of the original plastic kit prop. The new props were made from brass sheet, cut to shape and bent with a pliers. I'm sure they aren't balanced, but they work fine.

Dave
Sep 28, 2017, 07:07 PM
Registered User
I don't doubt that Dave, I scanned some threads here and this one the shaft size was questioned, I'm sure it works just fine, the thread was never finished.

https://www.rcgroups.com/forums/show...ISMARK-r-c-fit

Am taking mfr02's advice and fixing the deck, access the rc etc through the deck opening, a bit tight but should be fine. The main thing that will be inaccessible is the rudder connection, just have to make that solid, if there's a problem, cut a hole in the deck later.
Sep 29, 2017, 04:36 AM
Registered User
When I did my Heller Tirpitz I put a bulkhead forward of the rudder and left the stern as a free flooding area. Access was via a removable section of deck, very carefully razor sawed from the rest of the deck moulding to minimize the join. It was held in place using bath sealant with the intention that it would be removable if needed. OK unless you looked too closely. Trouble was, there's nothing on that after deck to hide access holes under.


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Idea Arduino 2 CH RC Reciever Servo subtrim for Antenne Tracker Roel-CP DIY Electronics 0 Jan 25, 2016 03:40 PM
Question Walkera 250(r) "Reciever input/output channel" connector BillyBag2 FPV Equipment 0 Jan 18, 2016 12:29 PM
Discussion need help with arduino rc transmitter papo DIY Electronics 11 Oct 17, 2015 11:16 PM
Question Output PWM from pixhawk channel to arduino? I might be phrasing this incorrectly smocksam Multirotor Drone Electronics 1 Aug 20, 2015 11:09 PM
Help! Arduino:Control Fans and output voltage of Power Supply via PWM, please check my code Julez DIY Electronics 5 May 25, 2014 04:17 PM