switchable bluetooth module via a tx aux channel, is it pos?

Post Reply
rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

switchable bluetooth module via a tx aux channel, is it pos?

Post by rct »

right read lots of stuff about multiwii gui over bluetooth and android, but not many about the gui over bluetooth and a pc/laptop.
so found out that it's not that easy, sumit to do with windows bluetooth drivers and something called a 'stack', found the toshiba driver thingy but that didnt work, saw the one post about widcomm drivers, but it was to hard to find them; found some obscure site via the multiwii forum that was dealing with an arduino/bluetooth problems.
well the fix that they had worked out worked like a charm, all you got to do is replace this file in 2 places and heypresto multiwii gui over bluetooth on a windows 7 netbook.
the HP netbook would find the bluetooth module, install 2 serial com ports
but then it all went to poo, the 2 ports it installed 1 was incomming and 1 outgoing but it needs to bridge the com ports but windows standard drivers cant do it (well i could not get them to do it) so replaced the .dll file in the two locations making sure to backup the originals and took the plunge.

hooked up the bt to my shield and powered it up, then loaded the gui and hoped, up it came with the 2 com ports showing so i clicked the bottom of the 2 and it went green (so far so good) clicked start and it sprang into life.
did a little check everything was there and configurable, worked just like it was hooked up via usb.

so thinking this was a fluke i closed the gui unpluged the power to my shield and then repowered it up and re-ran the gui just to see if it would work again.
as if by magic up comes the gui and the 2 com ports and so clicked the bottom one and it worked just like before.

i also restarted the netbook because i thougth that a reboot was needed to test if it wasn't real, hooked up my shield to the gui via usb and that worked fine, then tryed with the BT again and it still works.
now i can take my netbook with me to the field and make whatever changes i want.

sorry if this has been posted before but i could not find a simple fix, so here it is, tested with the dev version working fine.

this abbility to do some realtime debuging is great, with the addition of some windows screen grabber software, i can now video the gui and then play them back to see just what was going on during pid setup and tuning.
as long as you dont go out of range of the BT you should be fine.

Now i need a way of software switching the BT module on and off via my tx?,
as i dont code i will be relying on the experiance of others to help me with this problem.
not sure if this is poss but i dont see why not, all i need to have is it hooked up to vcc, gnd, rx, tx and be able to software switch the the vcc line.
i hope!!??

many thanks RCT

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: switchable bluetooth module via a tx aux channel, is it

Post by PatrikE »

In multiwii file.

Code: Select all

#define BTPower    7      // the number of the BTPower pin (Any unused D I/O pin)

void setup() {
  pinMode(BTPower, OUTPUT);    // Set to output


Put this last in loop()

Code: Select all

  
if (AUX3>1500)  //AUX channel controlling BTmodule
digitalWrite(BTPower,HIGH);
else
digitalWrite(BTPower,LOW);

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

ok many thanks, but exactly where in the sketches do these lines go?
many thanks for helping, i know i am going to spend all day messing with a test sketch to get this to work right.
RCT

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: switchable bluetooth module via a tx aux channel, is it

Post by PatrikE »

It's 6 rows in total to add to the scetch.

At the absolute end of multiwiifile should look lke this.

Code: Select all

          GPS_distance(GPS_latitude_home,GPS_longitude_home,GPS_latitude,GPS_longitude, &GPS_distanceToHome, &GPS_directionToHome);
        }
      }
    }
  #endif
 
if (AUX3>1500)
digitalWrite(BTPower,HIGH);
else
digitalWrite(BTPower,LOW);
}

Insert the 4 rows between #endif and the last }

Lookup setup() in multiwiifile.
Should be like this.

Code: Select all

#define BTPower  5      // the number of the BTPower pin
void setup() {
  pinMode(BTPower, OUTPUT);     
  SerialOpen(0,115200);
  LEDPIN_PINMODE;


one row before setup() and one after.

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

ok many thanks have been trying myself but no joy, now with this extra info i think i can do this.
RCT


Edit . just hacked this into dev203 sketch and it compiles no probs many many thanks now i got to sort out the ardunio pin to use (was looking at pin digital pin8 will adjust the code), then figure out how to impliment this if someone does not have ppm sum.

beacuse if someone has say a paris shield and all the receiver pins are populated, how on earth can you trigger this?

again many thanks RCT

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

right got my aux3 channel working in the gui but there is no output on pin 8 on my pro mini, aux3 is linked to my ch7 output (er9x).
so either i have not done sumit right or this just wont work for me?
ideas please?
RCT

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

rct wrote:right got my aux3 channel working in the gui but there is no output on pin 8 on my pro mini, aux3 is linked to my ch7 output (er9x).
so either i have not done sumit right or this just wont work for me?
ideas please?
RCT


right have managed to get 5 volts at pin8 by messin with the vbat stuff, but it wont turn on or off via the tx?
any ideas?
RCT

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: switchable bluetooth module via a tx aux channel, is it

Post by PatrikE »

Can this be something?

Code: Select all

  #define BUZZERPIN_PINMODE          pinMode (8, OUTPUT);

Pin 8 is assigned for the buzzer.
If you set pi8 from radio Buzzercode will override it.
Check in def to see what the pin is assigned to.
Try to comment

Code: Select all

 //#define VBAT


If you use PPM you will free a lot of I/O pins.

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

got a reply in the multiwii forum but i cant reply as i cant connect to that forum at the mo?
anyway the reply was, if you use ppm sum then that free's up the other receiver channels, so with that i mind i set about trying some of the receiver channels.
i can power any of those channel's to 4.6volt, BUT i still cant switch the power on or off via my receiver.
in the gui it shows as AUX 2 moving to trigger but it just wont operate the pin.
anyone got any ideas as to why i cant get the pin to trigger from AUX 2?
many many thanks so far RCT

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: switchable bluetooth module via a tx aux channel, is it

Post by PatrikE »

Sorry A minor fault in my coding.

change to

Code: Select all

if (rcData[AUX3]>=1500)

Then it will work.

/Patrik

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

PatrikE wrote:Sorry A minor fault in my coding.

change to

Code: Select all

if (rcData[AUX3]>=1500)

Then it will work.

/Patrik


woo hoo it worked, many many thanks PatrikE.
now all i got to do is soak test it then try and fiqure out some failsafe code to turn off either pin5 when motors are armed or the aux2 channel when motors are armed.
RCT

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: switchable bluetooth module via a tx aux channel, is it

Post by PatrikE »

You can add more parameters to the if.

Code: Select all

if ((rcData[AUX3]>=1500) && (armed==0)  )

rct
Posts: 20
Joined: Wed Nov 09, 2011 7:48 am

Re: switchable bluetooth module via a tx aux channel, is it

Post by rct »

PatrikE wrote:You can add more parameters to the if.

Code: Select all

if ((rcData[AUX3]>=1500) && (armed==0)  )


cool another bit for me to test on me test bed arduino.
so far the switch is working fine and at the moment not causing any problems.
many thanks for all your help on this.
RCT

zaiter
Posts: 1
Joined: Sun Jul 08, 2012 10:32 pm

Re: switchable bluetooth module via a tx aux channel, is it

Post by zaiter »

Hi, i built a quadcopter X and i want to control it with an android cellphone (and pc), can you write a summary of what are the changes in multiwii firmware that you do to use bluetooth?

also, this will work to use zigbee?, and control it with an arduino with zigbee? the distance is way better than bluetooth and the buttons can be customized, a bit expensive
Thanks

sismeiro
Posts: 173
Joined: Tue Feb 21, 2012 12:33 pm

Re: switchable bluetooth module via a tx aux channel, is it

Post by sismeiro »

zaiter wrote:Hi, i built a quadcopter X and i want to control it with an android cellphone (and pc), can you write a summary of what are the changes in multiwii firmware that you do to use bluetooth?

also, this will work to use zigbee?, and control it with an arduino with zigbee? the distance is way better than bluetooth and the buttons can be customized, a bit expensive
Thanks

See the option in the config.g file:

Code: Select all

/******************* RC signal from the serial port via Multiwii Serial Protocol *********/
      //#define RCSERIAL

Also there is an Android app in the market for it, search for "MultiWii BT Remote" by Luis Correia.

Post Reply