Page 1 of 1

PilotLamp pointers?

Posted: Tue Oct 23, 2012 7:21 am
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?

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 10:37 am
by cGiesen
The buzzer is supported too!!!!!!
Ask my wife ;)

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 11:13 am
by shikra
Ha nice one. Maybe thats a way to get my wide interested too... She hates copters

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 11:14 am
by shikra
xoxota

Nils posted this in wiki area...

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

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 12:56 pm
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

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 7:33 pm
by cGiesen
by the way. Is there a way to use the LED with different funktions?
Perhaps as landig lamp?

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 8:02 pm
by jevermeister
you can program whtaever you want :-). what do you have in mind?
Pleas join #multiwii on freenode to discuss things like this.

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 8:11 pm
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.

Re: PilotLamp pointers?

Posted: Tue Oct 23, 2012 10:19 pm
by xoxota
Thanks all for the answers! Looks like it's exactly what I'm looking for :-)

Re: PilotLamp pointers?

Posted: Wed Nov 21, 2012 6:33 pm
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?

Re: PilotLamp pointers?

Posted: Wed Nov 21, 2012 9:32 pm
by jevermeister
you have to connect 5v and gnd too

Re: PilotLamp pointers?

Posted: Thu Nov 22, 2012 8:33 pm
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?

Re: PilotLamp pointers?

Posted: Thu Nov 22, 2012 9:20 pm
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.

PilotLamp pointers?

Posted: Tue Jan 08, 2013 7:46 pm
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 7:07 am
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.

PilotLamp pointers?

Posted: Wed Jan 09, 2013 7:31 am
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 9:08 am
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 9:12 am
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 9:30 am
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.

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 10:01 am
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 2:14 pm
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.

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 2:56 pm
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 10:18 pm
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

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 10:22 pm
by jevermeister
Is the routing correct?Try to check with a multimeter from input pin to mega chip pin

Re: PilotLamp pointers?

Posted: Wed Jan 09, 2013 10:44 pm
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

Re: PilotLamp pointers?

Posted: Thu Jan 10, 2013 6:12 am
by jevermeister
threre are schematics for 2560.look for the alignment and measure.
I recently heard of boards with wrong pin description


good luck

PilotLamp pointers?

Posted: Sat Jan 12, 2013 3:29 pm
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

Re: PilotLamp pointers?

Posted: Sat Jun 15, 2013 1:13 pm
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

Re: PilotLamp pointers?

Posted: Sun Jun 16, 2013 1:27 am
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