PilotLamp pointers?

Post Reply
xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

PilotLamp pointers?

Post by xoxota »

I'm looking at plugging an XAircraft PilotLamp into my board. I noticed some code that seems to indicate this is supported in some way (at least in MultiWii_shared).PilotLamp has three LEDs (Red Green and Blue) and a buzzer, but the code doesn't appear to support the buzzer.

What pin(s) should I hook the PilotLamp up to? Has anyone already done this? Can someone point to some tutorial or information at all?

cGiesen
Posts: 188
Joined: Wed Jul 18, 2012 7:53 am
Location: Bochum, Germany

Re: PilotLamp pointers?

Post by cGiesen »

The buzzer is supported too!!!!!!
Ask my wife ;)

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: PilotLamp pointers?

Post by shikra »

Ha nice one. Maybe thats a way to get my wide interested too... She hates copters

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: PilotLamp pointers?

Post by shikra »

xoxota

Nils posted this in wiki area...

http://code.google.com/p/multiwii/wiki/ ... _Pilotlamp

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

All normal buzzer sounds are rerouted to pilotlamp if you enable pilotlqmi in config.m.
be careful NOT to connect the lamp to the buzzerpin if the pilotlp is not enabled. it may damage the buzzer.
please send feedback if everything is working.

nils

cGiesen
Posts: 188
Joined: Wed Jul 18, 2012 7:53 am
Location: Bochum, Germany

Re: PilotLamp pointers?

Post by cGiesen »

by the way. Is there a way to use the LED with different funktions?
Perhaps as landig lamp?

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

you can program whtaever you want :-). what do you have in mind?
Pleas join #multiwii on freenode to discuss things like this.

doughboy
Posts: 252
Joined: Tue Sep 04, 2012 7:20 am

Re: PilotLamp pointers?

Post by doughboy »

cGiesen wrote:by the way. Is there a way to use the LED with different funktions?
Perhaps as landig lamp?


I did exactly this. I added an Ultrasonic sensor and modified the GPS alert section in pilotlamp (blue light) to be used as a "low altitude" warning (well, its basically same as landing light), and I added a beep code also so it will beep when altitude is low.

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: PilotLamp pointers?

Post by xoxota »

Thanks all for the answers! Looks like it's exactly what I'm looking for :-)

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: PilotLamp pointers?

Post by xoxota »

Hmm. Well, I enabled PILOTLAMP, plugged my PilotLamp into the buzzer pin (D8), and.... nothing. Am I doing something wrong? How do I diagnose this type of problem? Does the fact that I'm using a PPM receiver have any impact?

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

you have to connect 5v and gnd too

xoxota
Posts: 37
Joined: Mon Aug 27, 2012 12:21 am

Re: PilotLamp pointers?

Post by xoxota »

Looks like, for starters, the BUZ pin on this board is connected to D9, and not D8 for some reason (design error?). I can't find where D8 comes out. Is there some way to configure which pin to use for BUZ within the multiwii code?

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

in the last devs there is an option to reroute the outputs. but it not hard to do it in the standard 2.1 if you look into the def.h

but if it is a board specific thing this should be made into a define and comitted into the shared trunk.

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

PilotLamp pointers?

Post by Urbasik »

Is there any chance to move the pilotLamp to pin46 on megaboard i don't need the camtrigger but my board Pilot Lamp is not working on TX1 or D8
Im using a HK mega board at the moment testet with an Cirrus SE on D8 the Pilotlamp worked fine.

Thx Frank

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

you can remap the pin by yourself. there is a section for that in config.h. we can not move this pin and break everyone's config.

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

PilotLamp pointers?

Post by Urbasik »

Sorry, i was misunderstood, I did not not want you to change the default files ;)

To be more precise will i face any trouble then with interupts or will i be free in the choice which Output pin i use ?
An will a change in config h be enough to asign the pin ?
I'm new to this

Thx Frank

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

Re: PilotLamp pointers?

Post by Urbasik »

One more Question,
Would this be the right code then ?

#define BUZZERPIN_PINMODE pinMode (D46, OUTPUT); // use D46 instead of d8 / URF
#define BUZZERPIN_ON PORTC |= 1<<2 //PORTB |= 1;
#define BUZZERPIN_OFF PORTC &= ~(1<<2); //PORTB &= ~1;

thx Frank

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

Hi.
Sorry. Not sure if it works.You should ask doughboy or copterrichie or eosbandi. They know a lot more about interrupts than me.

But you can always try. Code seems okay though.

Nils

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: PilotLamp pointers?

Post by Hamburger »

Urbasik wrote: #define BUZZERPIN_PINMODE pinMode (D46, OUTPUT); // use D46 instead of d8 / URF
#define BUZZERPIN_ON PORTC |= 1<<2 //PORTB |= 1;
#define BUZZERPIN_OFF PORTC &= ~(1<<2); //PORTB &= ~1;

Frank,
you need not change def.h. With newer versions you find in config.h

Code: Select all

  //#define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A2, OUTPUT); // use A2 instead of d8
  //#define OVERRIDE_BUZZERPIN_ON               PORTC |= 1<<2 //PORTB |= 1;
  //#define OVERRIDE_BUZZERPIN_OFF              PORTC &= ~(1<<2); //PORTB &= ~1;

you can set to desired values. Saves you from fiddling with def.h and does what you want. Check at end of def.h.

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

Re: PilotLamp pointers?

Post by Urbasik »

Thx a lot,
the code i posted was copied from DEV r1240´s Config.h

exactly tih section:
So I guess I was goin the right direction.

/**************************************************************************************/
/******** override default pin assignments ********************/
/**************************************************************************************/

/* only enable any of this if you must change the default pin assignment, e.g. your board does not have a specific pin */
/* you may need to change PINx and PORTx plus shift # according to the desired pin! */
//#define V_BATPIN A0 // instead of A3 // Analog PIN 3

//#define LEDPIN_PINMODE pinMode (A1, OUTPUT); // use A1 instead of d13
//#define LEDPIN_TOGGLE PINC |= 1<<1; // PINB |= 1<<5; //switch LEDPIN state (digital PIN 13)
//#define LEDPIN_OFF PORTC &= ~(1<<1); // PORTB &= ~(1<<5);
//#define LEDPIN_ON PORTC |= 1<<1; // was PORTB |= (1<<5);

#define BUZZERPIN_PINMODE pinMode (D46, OUTPUT); // use D46 instead of d8 / URF
#define BUZZERPIN_ON PORTC |= 1<<2 //PORTB |= 1;
#define BUZZERPIN_OFF PORTC &= ~(1<<2); //PORTB &= ~1;

I guess there is nothing else neccesarry then ?
I´ll try it this evening then.

regards Frank

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: PilotLamp pointers?

Post by Hamburger »

sorry,
the names have to be changed to start with OVERRIDE_ ; else the override will not happen.
I fixed this in latest rev only.

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

Re: PilotLamp pointers?

Post by Urbasik »

#define OVERRIDE_BUZZERPIN_PINMODE pinMode (D46, OUTPUT); // use D46 instead of d8 / URF
#define OVERRIDE_BUZZERPIN_ON PORTC |= 1<<2 //PORTB |= 1;
#define OVERRIDE_BUZZERPIN_OFF PORTC &= ~(1<<2); //PORTB &= ~1;

So this will be the right code then i guess

Will this also work for the Powerpin ?

thx for your help

brg
Frank

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

Re: PilotLamp pointers?

Post by Urbasik »

For sme reason it does not work,
the Pilot lamp works on another boerd but not on my Megaboard.
Tried A15,D46,D44 ans so on
Evn changing direkt in Dev.h does not work.
Does anybody have it working with the HK Mega Board, the read one ?

Thanks Anyway
Frank

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

Is the routing correct?Try to check with a multimeter from input pin to mega chip pin

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

Re: PilotLamp pointers?

Post by Urbasik »

I´ll try that an report, Wouldn´t wonder if there is something wrong.
Is there a pinout somewhere ?
Guess I´ll find something

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: PilotLamp pointers?

Post by jevermeister »

threre are schematics for 2560.look for the alignment and measure.
I recently heard of boards with wrong pin description


good luck

Urbasik
Posts: 9
Joined: Mon Aug 13, 2012 2:40 pm
Location: Germany SW

PilotLamp pointers?

Post by Urbasik »

Hi, followed the routes and measured

First pin i knew they were working

A8-89
D2-6
D3-7
D5-5
D6-14

Now the pins which are not working

D8-17
D9-18
D44-40
D45-39
D46-38

Could it be that the routing onnthe board is wrong ?

Thx for your help.

Frank

Tvixen
Posts: 18
Joined: Sun Jun 02, 2013 7:10 pm
Location: Tune - Denmark

Re: PilotLamp pointers?

Post by Tvixen »

Urbasik wrote:Hi, followed the routes and measured

First pin i knew they were working

A8-89
D2-6
D3-7
D5-5
D6-14

Now the pins which are not working

D8-17
D9-18
D44-40
D45-39
D46-38

Could it be that the routing onnthe board is wrong ?

Thx for your help.

Frank


Hi Frank
How's it going with the routing ?
Im going to do exactly the same thing as u. (on the same Red "HK MultiWii PRO w/MTK GPS Module" Mega2560 board ) I want landing light to turn on when im near 50cm from ground on D8. But im using the sonar to messure this (on pin D9 and D10) and i dont see how i use the D8 for turning on the landinglights.

So if u found a way to do ur thing, i could use some of ur infomation to get a littel further.

Thx Tvixen

/Tvixen

Tvixen
Posts: 18
Joined: Sun Jun 02, 2013 7:10 pm
Location: Tune - Denmark

Re: PilotLamp pointers?

Post by Tvixen »

Got it all figured out.

Here is the code for landinglights on HK MultiWii PRO w/MTK GPS Module" Mega2560 board. Pin D8.

offcourse you have to enable the sonar code in config.h (Sonar=pin D9 is trigger, D10 is Echo)

Code: Select all

 /*******************************    Landing lights    *********************************/
   /* Landing lights
     Use an output pin to control landing lights.
     They can be switched automatically when used in conjunction with altitude data from a sonar unit. */
    #define LANDING_LIGHTS_DDR DDRH
    #define LANDING_LIGHTS_PORT PORTH
    #define LANDING_LIGHTS_BIT PORTH5
// #define LANDING_LIGHTS_INVERT  //inverterer lyset; activ =lights when over LANDING_LIGHTS_AUTO_ALTITUDE

    /* altitude above ground (in cm) as reported by sonar */
    #define LANDING_LIGHTS_AUTO_ALTITUDE 50 //Sætter lys på når den kommer under 50cm

Dont mess with the "BUZZER" code, leave it as it is.

/Tvixen

Post Reply