Pages: [1]   Go Down
Author Topic: Suggestions on switching from autonomous to manual using RC transmitter  (Read 2510 times)
0 Members and 1 Guest are viewing this topic.
Charleston, SC
Offline Offline
Full Member
***
Karma: 1
Posts: 157
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
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.
« Last Edit: May 02, 2012, 09:57:59 am by thomas3120 » Logged


nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 130
Posts: 8622
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

______
Rob
« Last Edit: April 30, 2012, 04:57:19 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-twist
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  smiley
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
Jantje
Logged

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 -

Charleston, SC
Offline Offline
Full Member
***
Karma: 1
Posts: 157
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies.

@Greynomad:
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?

@Jantje:
That's pretty neat using the transistor smiley  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.




« Last Edit: May 02, 2012, 09:59:45 am by thomas3120 » Logged


nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 130
Posts: 8622
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The pulse width appears to be 1000us in one position and 2000us in the other.
That's normal.

Quote
They said it was 'proprietary information'...
I don't know what is proprietary about this. smiley-confuse

Quote
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 smiley

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Charleston, SC
Offline Offline
Full Member
***
Karma: 1
Posts: 157
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
I don't know what is proprietary about this.
Maybe just lazinesss on their part hehe smiley

Thanks again for the help & suggestions.  I'll go try a few things out now smiley

t
Logged


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

I noticed when using serial monitor that when the tx is turned on/off there is a zero pulse sent. When the tx is off the arduino still reads 1500us off the rx. Is there any way of using this zero pulse to trigger between rc and auto mode? I don't know how to tell the arduino the difference between on and off, maybe with the timeout? (Good ideas here, these forums have been great!!)
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

That would be a "Quad 2 Input Multiplexer" (74157). That's what the Ardupilot uses.
Logged

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

I am working on the same issue ( interesting problem with transistors) I haven't quite got it working, yet! As far as channel 5 to control the overide, I just wired channel 5 to my uno, and used "pulse in >=1500" as my trigger to go to the override function.
Logged

Pages: [1]   Go Up
Jump to: