Mixing channels to create 3-way switch ?

General discussions on the Gluon-project that don't fit elsewhere. If required, I will create more subforums.

Moderator: lukasz

Mixing channels to create 3-way switch ?

Postby cassini » Mon Feb 20, 2012 12:25 pm

Hi,

For the project we're currently doing, we've been given Futaba 6EXA radios. Unfortunately, these don't have any suitable three-way switches. It seems possible to mod the hardware to add one in, but I was wondering if there is a way to mix channel 5 + 6 (both 2-way) in the firmware.

Similar to http://diydrones.ning.com/forum/topics/ ... way-switch ?

thanks.
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Re: Mixing channels to create 3-way switch ?

Postby Tom » Mon Feb 20, 2012 1:01 pm

This shouldn't be a problem if you don't mind doing some basic coding.

The file which needs to be modified is control.c / control_mix_out():
http://code.google.com/p/gluonpilot/sou ... trol.c#544

The variables which you will need:
ppm.channel[0..] = input from RC remote
servo_out[0..5] = output in microseconds of the PWM pulse (1000 ~ 2000)

Does this answer your question?
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: Mixing channels to create 3-way switch ?

Postby cassini » Mon Feb 20, 2012 3:54 pm

hmmm, i'm not sure.

I want to be able to switch between the 3 modes somehow using two 2-way switches (channel 5 and 6). I'm pretty sure it would work if (for example) the signal from channel 6 was reduced in magnitude and then added to channel 5. That way the calculated value could be altered with the 2 switches to produce values within all 3 regions (for each mode). (whilst still staying within the correct range)

like -

channel_6b = ( channel_6 / 2 );
mode_op = channel_5 +channel_6b;

so effectively channel 5 would switch ( manual or not ), and channel 6 switch ( stabilised or not ).

I just need to find a place to put the code to calulate values for 'channel_ap' from the two ppm.channel s.

Of course, I'm probably way off! :)
-thanks.
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Re: Mixing channels to create 3-way switch ?

Postby cassini » Mon Feb 20, 2012 3:54 pm

and I'm using PWM connections if it makes a difference.
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Re: Mixing channels to create 3-way switch ?

Postby Tom » Mon Feb 20, 2012 5:33 pm

Oh ok you want to use it to switch between autopilot modes...

You can alter it here: http://code.google.com/p/gluonpilot/sou ... trol.c#151

Or trim your 2-state switch so you can use 2 out of the 3 modes.
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: Mixing channels to create 3-way switch ?

Postby DaveK » Mon Feb 20, 2012 7:19 pm

I use something like this on what my TX calls logic switches for other uses. Easy to do in Toms code as he has shown.

I would do something like this:

Setup channel 5 & 6 each on a 2 position switch. Set travels up so switch away from you generates something like 2000uS pulse and towards you is 1000uS. Basically plus 100% and minus 100% on the TX.

Switch 5 Is master. Towards yourself is 'manual' mode with switch 6 being ignored. Switch 5 forwards allows switch 6 to select either 'stabilised' or 'auto'.

Line 151 replace

ppm.channel[config.control.channel_ap] < 1300)

with

ppm.channel[5] > 1700 && ppm.channel[6] > 1700)

Line 195 replace

ppm.channel[config.control.channel_ap] < 1666)

with

ppm.channel[5] > 1700 && ppm.channel[6] < 1300)

Nice thing about such a configuration is that regardless of the switch 6 position switch 5 will allow you to drop back into manual mode.

Dave
DaveK
 
Posts: 8
Joined: Sun Feb 05, 2012 10:15 pm

Re: Mixing channels to create 3-way switch ?

Postby cassini » Wed Feb 22, 2012 12:32 am

^ Yes! That's the sort of thing I was talking about, but I didn't know you could access ppm.channel directly. I'll give it a go soon.
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Re: Mixing channels to create 3-way switch ?

Postby cassini » Fri Feb 24, 2012 7:52 am

ok, this might be a stupid question, but once I download the code folder and edit what I want, how do I then upload it to the gluon? Maybe compile it to the .hex? I can't see any configuration files in the gluonconfig folder, so I'm not sure what to do.
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Re: Mixing channels to create 3-way switch ?

Postby Tom » Fri Feb 24, 2012 9:04 am

Yes, you can use Mplab or Mplan X to compile it.

Upload the firmware (.hex file) to the gluonpilot. Here is a nice tutorial that explains how: http://www.unmannedtech.co.uk/3/post/20 ... mware.html
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: Mixing channels to create 3-way switch ?

Postby cassini » Thu Mar 01, 2012 10:18 pm

Ok. I'm struggling with the task of actually getting the modified c files into MPLABX to compile it. Do all the files in the 'firmware/lib' (in the original src download) go under 'libraries' in mplabx? And from 'rtos_pilot' - separate these files and put them under 'Header' and 'Source' folders?

I checked out http://gluonpilot.com/wiki/Creating_a_n ... t_in_Mplab , but unsure which go under 'source' , 'libraries' etc.

thanks!
cassini
 
Posts: 49
Joined: Mon Oct 17, 2011 4:12 pm

Next

Return to General

Who is online

Users browsing this forum: No registered users and 15 guests

cron