Operating Hobbyking Strobe lights using AUX switch?

Post Reply
Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

I was wondering if I can have a function that would simply toggle my LED lights on or off.
The easy way would be hooking it up straight to the receiver, but im running it in PPMsum mode.
Ive looked around in the code, and I suspect my best bet is butchering the camera trigger function.

Would replacing

Code: Select all

  #if defined(CAMTRIG)
    static uint8_t camCycle = 0;
    static uint8_t camState = 0;
    static uint32_t camTime = 0;
    if (camCycle==1) {
      if (camState == 0) {
        servo[2] = CAM_SERVO_HIGH;
        camState = 1;
        camTime = millis();
      } else if (camState == 1) {
       if ( (millis() - camTime) > CAM_TIME_HIGH ) {
         servo[2] = CAM_SERVO_LOW;
         camState = 2;
         camTime = millis();
       }
      } else { //camState ==2
       if ( (millis() - camTime) > CAM_TIME_LOW ) {
         camState = 0;
         camCycle = 0;
       }
      }
    }
    if (rcOptions[BOXCAMTRIG]) camCycle=1;
  #endif
in Output with this

Code: Select all

  #if defined(CAMTRIG)
    if (rcOptions[BOXCAMTRIG]) servo[2] = CAM_SERVO_HIGH;
   else servo[2] = CAM_SERVO_LOW;
  #endif

turn A2 into a servo driver that toggles between high and low if I activate/deactivate camtrig with an aux channel?

pointheremedia
Posts: 2
Joined: Tue Jan 15, 2013 4:07 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by pointheremedia »

I wonder the same thing...can 5v LED lights be connected directly to the Crius SE FC board ?

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

Anyone? I really urgently need an answer. :')

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by QuadBow »

Well, I don't now the strobe lights from HK / Trunigy.
But, I can provide some comments as to it:
Firstly, I hope they suited to be operated directly by flight controller without overpowering (not more than 20mA) the pins.

The second fact to know is whether they require a static signal or a ppm signal (servo output).
In case of ppm signal it a good idea to "highjack" the camtilt / camtrigger servo pins.
But you have to change the code in order to switch off automatic gimbal stabilisation.

What flight control board do you have?

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

Power isnt coming from the FC board, thats all coming from a BEC somewhere else. ;)
The turnigy LEDs operate like a servo, high is on, low is off, so jacking the trigger servo port should do the trick I thought.
A2 isnt involved with cam pan/tilt I think, thats all A0 and A1 isnt it? So repurposing A2 should have no ill effects on anything else.

The board is a pretty basic Witespy Flip.

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by QuadBow »

Sven wrote:A2 isnt involved with cam pan/tilt I think, thats all A0 and A1 isnt it?


That depends... your board is based upon a arduino promin with a limited amount of pins.
Since you have a sum ppm receiver you don't have to define A0_A1_PIN_HEX.
In this case you have 3 servos at pins A0, A1, and A2 as the following lines show:

File def.h shows the definitions of camera servos for promini (in quad configuration without other definitions):
#define SERVO_1_PINMODE pinMode(A0,OUTPUT); // TILT_PITCH - WING left
#define SERVO_2_PINMODE pinMode(A1,OUTPUT); // TILT_ROLL - WING right
#define SERVO_3_PINMODE pinMode(A2,OUTPUT); // CAM TRIG - alt TILT_PITCH

Thus, you can take on of those pins.

Sven wrote:The turnigy LEDs operate like a servo, high is on, low is off, so jacking the trigger servo port should do the trick I thought.

A servo signal means "high", when it is high for 2ms, "low" at 1ms (out of 20ms).

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

Hmmm, not sure what that means.
I can't use A2 and tilt/pan at the same time on a quad copter?

And if I dont use pan/tilt, will my hack work?

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by QuadBow »

Sven wrote:The turnigy LEDs operate like a servo, high is on, low is off, so jacking the trigger servo port should do the trick I thought.


I understood the strobing lights require a servo signal. That means a pulse of 1-2ms and a repeat frame of 20ms.

Sven wrote:And if I dont use pan/tilt, will my hack work?


You propose to set the related pin high/low by replacing the existng procedure by
#if defined(CAMTRIG)
if (rcOptions[BOXCAMTRIG]) servo[2] = CAM_SERVO_HIGH;
else servo[2] = CAM_SERVO_LOW;
#endif

This change would result in a simple high/low status and not in a servo signal described above.
If there is any doubt about the function of the strobe lights, test both code versions.

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

These are the lights: http://hobbyking.com/hobbyking/store/__ ... _5_5V.html

I dont understand the difference between what cam trigger does, or my replacement code.
It will simply move a servo, or in this case, switch the lights, right?
All im doing is removing the timer cycle that loops once its activated, replacing it with a toggle code.

To keep it even simpler:

Code: Select all

#if defined(CAMTRIG)
if (rcOptions[BOXCAMTRIG]) servo[2] = 1950;
else servo[2] = 1050;
#endif


If I define CAMTRIG and then assign AUX4 to CAMTRIG in multiwiconf,
it should simply turn on and off whatever is plugged in to A2 in unison with AUX4 position, right?

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

Just letting know, my camtrigger hack works flawlessly. ;)
http://www.youtube.com/watch?v=NNwCSIh_k00

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by KeesvR »

Very nice 8-)

QuadBow
Posts: 532
Joined: Fri Jan 04, 2013 10:06 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by QuadBow »

Congratulation!
Only for my knowledge:
Is there only one blinking pattern or can it be changed by different servo pulses?

Sven
Posts: 32
Joined: Mon Feb 27, 2012 10:11 am

Re: Operating Hobbyking Strobe lights using AUX switch?

Post by Sven »

Can't change the strobe pattern unfortunately.

Post Reply