LED controller, jdrones ioBoard hack

Bartman

Welcome to MultiRotorForums.com!!
Just ordered a couple of kits for jdrone's LED controller. THere's one being developed by another manufacturer but I'm not sure as to when it's going to be completed. In the meantime, there's this kit to play with.

Just thought I'd throw it out there.

http://www.jdrones.com/jDoc/wiki:code_ioboard
 
Last edited by a moderator:

Mactadpole

Member
Does HFP output Mavlink? I thought this controller had to be hooked up to a board that output mavlink in order to turn lights on/off, etc. when the FC is doing things like gps hold, etc.?

This board looks to perform really well with the AutoQuad 6 FC and Graupner TX. controls led's and sends display and voice telemetry to the TX.

Bart, any plans to try out the AQ on one of your frames?
 

Bartman

Welcome to MultiRotorForums.com!!
as I'm searching for info I see some names I'm familiar with so maybe we can support this discussion here and work something out.
 

Bartman

Welcome to MultiRotorForums.com!!
Does HFP output Mavlink? I thought this controller had to be hooked up to a board that output mavlink in order to turn lights on/off, etc. when the FC is doing things like gps hold, etc.?

This board looks to perform really well with the AutoQuad 6 FC and Graupner TX. controls led's and sends display and voice telemetry to the TX.

Bart, any plans to try out the AQ on one of your frames?

Shawn,

SOrry I missed your reply. I do plan to try the Arducopter system on my frame at some point in the future. The HF PRO does not output Mavlink but I was hoping we could crack the software open and change what the processor is looking for and teach it to take a PWM value to trigger the lights.

Who's with me on this!?! :)
 

Bartman

Welcome to MultiRotorForums.com!!
I just got a reply from jDrones that it is possible to program the IOboard to reference PWM inputs in determining what to do with the LED outputs. The question is, is my coffee pot big enough to get me through this programming (mis)adventure?

This is a job for (much) later on tonight.
 

Bartman

Welcome to MultiRotorForums.com!!
So I've been thinking some more about this little project and I've got my head wrapped around what I'd like to do but I just need to learn the Arduino language so I can get the code written correctly. If it were Fortran I'd be done already, or close to it as I had that system beaten into my head in multiple college classes, but alas, it isn't so I've got to dig out my Arduino starter kit and get to work.

I'm guessing the program should go something like this

Initialize chip
define/configure two inputs as PWM
define/configure two outputs (to power LED's) for each input (PWM from receiver)
establish test ranges for first input (If <30, output sequence 1, If >30 and <200 use output sequence 2, If >200 use output sequence three)
Same for second input but probably using different output styles (illumination patterns for LED's)
Loop the test to continuously monitor PWM inputs and change outputs accordingly

Tada! Now to correctly structure it according to Arduino programming language.
 


Bartman

Welcome to MultiRotorForums.com!!
just in case anyone's actually following this thread, here's where I'm at. the PulseIn command is causing an error when compiling and I'm in the process of trying to figure out the correct usage of the PulseIn command. There's a thread here that may shed some light on it but I haven't worked it into my program yet.

/*
LED control using jDrones ioBoard and inputs from
RC receiver (PWM)
PWM signal pulses are measured using 'Pulse' statement
Conditional statement looks at Pulse value and determines
illumination pattern of LED outputs
illumination to be alternating left/right indicates manual control
coordinated heartbeat indicates GPS position hold
rapid flashing indicates come-home mode active

Created 26 March, 2012
By Bartman with help from the Arduino community.


This code is in the public domain
http://www.multirotorforums.com/showthread.php?9347-LED-controller-jdrones-arduino-kit

*/


void setup() {
// pin numbers for inputs and outputs
int rxgpsmode = 12; // digital input pin using GPS mode channel from Rx
int ledPin1 = 02; // pin for left LED output, PWM enabled
int ledPin2 = 03; // pin for right LED output, PWM enabled
unsigned int duration;
int ledCounter; // counter variable used to loop LED patterns
int ledBrightness; // brightness variable for heartbeat pattern
int fadeAmount = 25; // factor used to build light intensity in Heartbeat pattern
pinMode(rxgpsmode, INPUT); // initialize Rx connection pin as in INPUT
pinMode(ledPin1, OUTPUT); // initialize the LED pins as outputs
pinMode(ledPin2, OUTPUT);
}

void loop()
{
duration = pulseIn(rxgpsmode, HIGH) // read the value of the incoming pulse length

if (duration < 100){
// alternating arms flash slowly----->GPS off
digitalWrite(ledpin1, HIGH); // turn the ledpin1 ON (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledpin1, LOW); // turn the ledpin1 OFF by making the voltage LOW
delay(100); // brief delay, to make blinking appear uniform throughout subroutine
digitalWrite(ledpin2, HIGH); // turn ledpin2 ON
delay(1000); // wait for a second
digitalWrite(ledpin2, LOW); // turn ledpin2 OFF
}

else if (duration > 1200)

{
// LEDs flash quickly three times then exit loop to recheck conditional
// GPS come home mode active
//
for (int ledcounter = 0; ledCounter < 3; ledCounter = ledCounter +1) {
ledpin2 = ledpin1; // ledpin2 set equal to ledpin1 to coordinate illumination pattern
digitalWrite(ledpin1, HIGH); // both LED pins turn on
delay(300); // wait 1/3 second
digitalWrite(ledpin1, LOW); // both LED pins turn off
delay(100); // wait 1/3 second
}
}

else

{
// heartbeat pattern, GPS PH active
ledpin2 == ledpin1;
for (int ledBrightness = 0; ledBrightness <= 250; ledBrightness = ledBrightness + fadeAmount) {
analogWrite(ledpin1, ledBRightness);
}
analogWrite(ledpin1, 250);
delay(250);
digitalWrite(ledpin1, LOW);
delay(250);
digitalWrite(ledpin1, HIGH);
delay(500);
digitalwrite(ledpin1, LOW);
}
 

Mactadpole

Member
That looks like a miserable endeavor. I wish you the best of luck and do hope you get it working! :highly_amused:
 

Bartman

Welcome to MultiRotorForums.com!!
hey thanks, i think? the board I'm using hasn't been without controversy so I hope the board works if I'm able to get the code working!
 

Bartman

Welcome to MultiRotorForums.com!!
was able to compile this latest sketch but haven't had a chance to put it in the board yet. here it is if anyone wants to give it a try. we won't know if my logic all works until it's on a board but having it compile is a good step forward indicating my arduino is coming along. :)

if/when it works i'll have completed boards in my webshop for purchase.

/*
LED control using jDrones ioBoard and inputs from
RC receiver (PWM)
PWM signal pulses are measured using 'pulseIn' statement
Conditional statement looks at PulseIn value and determines
*****illumination pattern of LED outputs*****
illumination alternating left/right indicates manual control
coordinated heartbeat indicates GPS position hold
rapid flashing indicates come-home mode active

Created 26 March, 2012
By Bartman with help from the Arduino community.


This code is in the public domain at
http://www.multirotorforums.com/sho...roller-jdrones-ioBoard-hack&p=92148#post92148

*/

void setup() {
// pin numbers for inputs and outputs
unsigned long Duration;
unsigned long lastgood1;
int rxGPSmode = A1; // input pin using GPS mode channel from Rx
int ledPin1 = 2; // pin for left LED output, PWM enabled
int ledPin2 = 3; // pin for right LED output, PWM enabled
int ledCounter; // counter variable used to loop LED patterns
int ledBrightness; // brightness variable for heartbeat pattern
int fadeAmount = 25; // factor used to build light intensity in Heartbeat pattern
pinMode (rxGPSmode, INPUT); // initialize Rx connection pin as in INPUT
pinMode (ledPin1, OUTPUT); // initialize the LED pins as outputs
pinMode (ledPin2, OUTPUT);



}

void loop()
{
static int Duration;
static int rxGPSmode;
static int lastgood1;
static int ledPin1;
static int ledPin2;
static int fadeAmount;
static int ledCounter;
static int ledBrightness;
Duration = pulseIn(rxGPSmode, HIGH, 20000); //read GPS mode channel
if (Duration == 0) {Duration = lastgood1;} else {lastgood1 = Duration;}

if (Duration < 100){
// alternating arms flash slowly----->GPS off
digitalWrite(ledPin1, HIGH); // turn the ledpin1 ON (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin1, LOW); // turn the ledpin1 OFF by making the voltage LOW
delay(100); // brief delay, to make blinking appear uniform throughout subroutine
digitalWrite(ledPin2, HIGH); // turn ledpin2 ON
delay(1000); // wait for a second
digitalWrite(ledPin2, LOW); // turn ledpin2 OFF
}

else if (Duration > 1200)

{
// LEDs flash quickly for three seconds then exit loop to recheck conditional
// GPS come home mode active
//
for (int ledCounter = 0; ledCounter < 9; ledCounter = ledCounter +1) {
ledPin2 = ledPin1; // ledpin2 set equal to ledpin1 to coordinate illumination pattern
digitalWrite(ledPin1, HIGH); // both LED pins turn on
delay(300); // wait 1/3 second
digitalWrite(ledPin1, LOW); // both LED pins turn off
delay(100); // wait 1/3 second
}
}

else

{
// heartbeat pattern, GPS PH active
ledPin2 == ledPin1;
for (int ledBrightness = 0; ledBrightness <= 250; ledBrightness = ledBrightness + fadeAmount) {
analogWrite(ledPin1, ledBrightness);
}
analogWrite(ledPin1, 250);
delay(250);
digitalWrite(ledPin1, LOW);
delay(250);
digitalWrite(ledPin1, HIGH);
delay(500);
digitalWrite(ledPin1, LOW);
}
}
 
Last edited by a moderator:

Bartman

Welcome to MultiRotorForums.com!!
for the ioBoard to work it has to have a single high voltage input to power the lights and a 5v input to drive the board. all grounds have to be common with each other. use the PWM outputs to allow the lights to ramp up to full power for the heartbeat effect (may work and look cool, might need to be tweaked some more). i'm still not sure if the input should be analog or digital, will know more when i get it on a board and can hook everything up.

bart
 

Hi Bart, I have some boards on order and will be having a play when they arrive....just need to stop getting new toys to get some free time :)
 

Bartman

Welcome to MultiRotorForums.com!!
Hi Bart, I have some boards on order and will be having a play when they arrive....just need to stop getting new toys to get some free time :)

glad to hear someone else is joining in the effort Dave. Here's where I'm at with it. the code was loaded onto the board and the board appeared to take it successfully but I'm not sure if the servo input from the receiver is a digital or analog input. the signal is being read as a high or low by the pulseIN command so I thought maybe it should be a digital input but I couldn't get the code right for it to compile that way. it compiles as an analog input but there's nothing happening with led's attached so i'm thinking the code isn't quite right.

also, the ranges still have to be calculated for the servo channel positions. right now it shows the high as 1200 and the low as 100 but those were just numbers i threw in there to represent high and low.

do you have any arduino experience?
 

jrlederer

Member
Btw, I have two of these jdrones ioboards, and have yet to ever get either working even in their intended usage. I first bought one when they were initially released and, while loading firmware to the board using its provided software utility, somehow I lost the ability to connect with the board. I thought that I must have fried the board inadvertently and proceeded to order another one. Frustratingly, when the new board came, despite being extra cautious not to mistakenly overpower the board, somehow I ran not he same bug and now neither board is abl to g reprogrammed nor communicates with the software. I wrote a support request months ago that was never addressed properly. Anyone knows how to properly rewrite firmware to the board. I also have an AVR programmer handy if that could be useful.

That being said, if I were to be able o return either board to an operable condition, I would be happy to assist you n getting this project coded and working properly, as I do know how to program relatively well (no pro, for sure, though)

jrl
 

Bartman

Welcome to MultiRotorForums.com!!
john,

i saw the posts at the diydrones site about the boards not working correctly or users having problems with them. but then some people said they worked fine.

any help you can offer would be appreciated. i think i'm close but haven't had time to get it the rest of the way there.

would the inputs for the pulseIN command be digital or analog? that question alone would get me motivated to get back into it but if it's digital then I'll have to figure out why i can't compile with it assigned a digital pin number.

bart
 

MombasaFlash

Heli's & Tele's bloke
That looks like a miserable endeavor. I wish you the best of luck and do hope you get it working! :highly_amused:

I scrolled through Bart's long list of code thinking "Jeez, I cannot think of anything I am less interested in than buggering around with computer language" and then I came to your post.

It made me smile.

It's a jolly good job some folks like to work out code n' stuff, but it ain't for me. Sodding around with a Picloc or CARVEC already drives me to distraction.
 

So is this what we would need if we wanted to be able to turn led lights on or off during flight? would I be able to use this with NAZA-M v1?
 

Bartman

Welcome to MultiRotorForums.com!!
So is this what we would need if we wanted to be able to turn led lights on or off during flight? would I be able to use this with NAZA-M v1?


If we could make it work it would!

There are easier ways to turn lights on and off but this would make the illumination patterns correspond to the positons of a three way switch. There are a number of switches available that can be activated (on/off) by a servo channel.

Bart
 


Top