Go Down

Topic: Suggestions on switching from autonomous to manual using RC transmitter (Read 2 times) previous topic - next topic


Apr 30, 2012, 09:24 pm Last Edit: May 02, 2012, 04:57 pm by thomas3120 Reason: 1
In the past couple of days, I was able to get my wheelchair robot to run manually using an RC transmitter (5 channel Spektrum).  For now, I just hooked up my receiver to my Sabertooth 2X25 motor driver in mode 2: RC mode, differential drive, exponential.
Here's a quick video of it:

I'm beginning to look at the Arduino library & the net for different codes that I may try out (programming is my weakest point but I have a few friends who are much better at programming).

Before I start on that I would really like to use the 5th channel toggle switch (labeled 'gear' on the receiver) to switch between autonomous and manual control.
I'm familiar with how the throttle, aileron, elevator channels work using ppm, with 1000us on the 'low' end, 2000us on the 'high' end and 1500us as center.
And just guessing how the toggle switch channel works, maybe one position is one extreme (such as 1000us) and the other toggle position would be the opposite extreme (2000us)?

I went ahead and checked the voltages on the gear channel signal (no load) and in one position I got .149VDC and other position I got .258VDC.

I really like the results in RC mode (there's an RC microcontroller mode as well) and was wondering if I could get some suggestions on how to go about doing this.
One way I was thinking was an electronic/semi-conductor type of DPDT switch that would accept signal S1 & S2 from the Arduino and signals S1 & S2 from the receiver and with the signal from the 5th channel toggle to switch between the 2 sets of (S1 & S2)'s.  The output would go to the S1 & S2 inputs on the motor driver.

I've also done some work (on a custom Atari 5200 controller & adapter) using Quad comparators and how they would 'activate' a signal when a low or high voltage threshold was achieved.
But if I recall correctly, the output was digital not analog.
Btw, currently, the robot will have some simple sensors such as ultrasonic & motion detectors.  And for the time being it's function will be to follow people around & avoid obstacles.  As I progress, hopefully will add more functions and possibly more/different sensors.


I got .149VDC and other position I got .258VDC.

That's because you are reading a pulse train with a DVM, you are just seeing the average voltage of a signal with a ~20:1 low/high ratio.

And just guessing how the toggle switch channel works, maybe one position is one extreme (such as 1000us) and the other toggle position would be the opposite extreme (2000us)?

What do you get on this channel?

You could add a low-pass filter on the output of the receiver and just use a comparator set somewhere between the two readings you get on the downstream side of the filter.

But if I recall correctly, the output was digital not analog.


Rob Gray aka the GRAYnomad www.robgray.com


I don't see the point of having your remote turned on to have your robot run in autonomous mode. It sound to me like keeping the light on when you are gone ]:D
I have been working the last few days on how to switch between autonomous and rc on my robot. The way it works now (and I'm pleased about it) is as follows.
Using a transistor I can turn on and off the receiver.
When you turn on the receiver and the transmitter is off you get no pulse (pulsein will timeout and return 0) this way you know the RC transmitter has not been turned on. you can turn the receiver off for a while and go (or stay) in autonomous mode.
If you get a value from pulsein different from 0 you know the RC is on and you can switch or stay in manual mode.
With my receiver, when I switch of the transmitter, the receiver keeps on giving the same value (I guess this is a safety measure most RC's will have). Therefore you can not easily see the rRCc transmitter has been turned off.
That is  why I do as follows:
If I get the same signal for to long 1 switch of the receiver; wait long enough for the receiver to switch completely off (15microseconds in my case) and turn it back on.
That is all there is to it.

The code is bad but not to bad  :)
The main reason why the code is bad is because you can not linger to long in your RC code as you robot (in autonomous mode) may bump into something. This means you have to keep timers for all the actions.

Best regards
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -


May 02, 2012, 12:46 am Last Edit: May 02, 2012, 04:59 pm by thomas3120 Reason: 1
Thanks for the replies.

The pulse width appears to be 1000us in one position and 2000us in the other.  I tested this with a servo first hooked up to a different channel like the rudder output on the receiver and moved the stick in both directions and noted the movement of the servo.
Then hooked the servo to the 5th channel/toggle switch, both positions of the toggle switch corresponded to the extreme positions of the stick from the rudder channel.  The servo movement was the same for both of those channels.

I hooked up my old DC wide band vacuum tube oscilloscope and noticed the width of the pulse when toggled, was halved or doubled.

I did call Horizon (makers of my Spektrum Tx and Rx) and got nowhere.  They said it was 'proprietary information'...  :smiley-roll:

I have some Arduino Reciever code I may try with serial.print command to possibly give me a screen readout as well.

I was reading up on a few things; possibly using a PWM discriminator to differentiate the 2 different pulses coming in using some type of logic.  Wondering if I could use a PIC for this?

That's pretty neat using the transistor :)  I don't mind that much having the Tx on though.  I guess I could have it off then turn it on when I need it.  Think it only takes a few seconds to link up with the receiver.

How do you control the transistor to turn on the receiver?  By turning on the Tx?
I guess I kind of wanted to keep this part out of the code/keep it completely independent from the Arduino.


The pulse width appears to be 1000us in one position and 2000us in the other.

That's normal.

They said it was 'proprietary information'...

I don't know what is proprietary about this. :~

Wondering if I could use a PIC for this?

Of course you could, but in that case you'll have to move this thread to the PIC forum :)

If you are happy to use a processor any AVR will do this easily.

If not then the hardware comparator idea should work or another idea is to use a one-shot timer (say a 555) set to 1500uS and a gate to clock a flip flop.

Rob Gray aka the GRAYnomad www.robgray.com

Go Up