Back to Phantom Modding - Neopixel LEDs

Joined
Sep 4, 2013
Messages
2,219
Reaction score
7
It feels like it's been a long time since I've cracked open the Phantom's shell! Well, that ended tonight. After too much time messing with the F450, I accumulated enough parts and motivation to get back to the old P1.

The Neopixel NAZA-mirroring mod I originally posted about was on my F450 Y6, but that was really because it was a larger, easier test bed to work with. With that successfully completed, it was time to port things over to the Phantom.

I'm not going to detail the entire build tutorial again, since it's pretty much the same as the Y6 build, so if you're interested in the details and sketch code, I have it posted here: http://www.rcgroups.com/forums/showthread.php?t=2144784.

I wanted to do this mod because I'd like to eventually replace my old ESCs and motors (100+ hours of flight time so far) with the E300 kit. The E300 ESCs don't have LEDs, so I would lose all of the Phantom's orientation lights, and I really didn't want that. I also didn't really care for the Phantom's red-in-front lighting scheme, so it was really time for something custom. Hence, the neopixels. And of course, the Arduino-based NAZA-LED mirroring is really the icing on the cake.

Instead of the pretty 16-LED rings, for the Phantom I opted for an 8-LED strip, that just fits the stock arm light cutout. It's not perfect and I'll have to shave things down a bit to get the lenses back on, but it's close enough for now.
GNEsxHz.jpg


After a couple of hours of soldering and crimping, I had this. It's not pretty, and this isn't the final config. I accidentally ordered only two strips, whereas I needed four for each arm, so this is currently just a hot-glued proof-of-concept.
OQsp3yP.jpg


Just to bring home the point, here's the rats' nest of wiring that I just stuffed back into the shell - no organization or routing here (yet)!
QGpLojG.jpg


Amazingly, everything worked perfectly the first time around. How often does that happen? Here are a few shots of the LEDs in action - the purple is the static orientation mode, the yellow is flashing from NAZA reporting "tx-not-found"
t54SuyD.jpg

9bNn6RW.jpg


The red stock LEDs in front are off because the motors aren't armed. Yes, the Neopixels are set to stay on whenever the battery is providing power.

Here's a poor shot that gives you an idea of how much brighter the 8 Neopixels are compared to the three stock red ESC LEDs:
tyikx6P.jpg


16 LEDs at full power draws about 1W of power. When done, the full 32 will draw about 2W. My Phantom is currently dual-PMU'd, so I didn't even need to use a separate BEC. That really made my day :)

Here's a quick video of the maiden flight:
[youtube]http://www.youtube.com/watch?v=_eefrq3NW8I[/youtube]

Next step - get more strips for the front arms, program in some fun animation sequences for when the NAZA isn't blinking, and then see if the UFO reports increase!

I'm also thinking about ways of making the Trinket more accessible without having to take apart the shell - a remote switch for reset and exposed USB port would let me change color schemes and animations more easily. It'd also let me demonstrate this more as a potential solution for the many folks who are green/red colorblind and need different color flashes to tell what the NAZA is trying to say.
 
Why, in gods name, did i click on this topic. WHY?
Thank god this stuff doesn't cost to much. LOL

Where can you get 4 pin servo connectors all I can find are 3 pin.
 
Very pretty !!!!!!

You will certainly get some UFO calls hehe
 
Thanks! It's going to be fun finishing this up. When the front legs are done, it's going to be a 32-LED RGB lightbulb in the sky! I may have to set a channel to drop the brightness a bit at night.

I finally got it up during the day:
SPwKp3X.jpg
 
Got my stuff in the other day, can't wait to get started on this project, but I bought a new soldering iron which will come in on friday so I'll have to wait till then. Did you wire the sticks the same way as the wiring diagram you have on the other forum? And have you been able to modify the light cover to fit over the sticks? Do you put the resistor on the first stick only or all of them? I also noticed that the Trinket has a 5V pin placement, can you power the sticks from there or is it better to come off of the UBEC?

I really like what you have done with these LED's.
 
Hey I wonder if you can set these up for the Red/green color blind population.
I assume you can program just about any color you want.
 
KG4MXV said:
Hey I wonder if you can set these up for the Red/green color blind population.
I assume you can program just about any color you want.

Yeah, I already have....I posted about it but nobody seemed interested. Maybe formatting text so it was green on red background didn't help? Just kidding, just kidding :)

[youtube]http://www.youtube.com/watch?v=u6qZcMoqMzY[/youtube]
 
  • Like
Reactions: dtitus6297
djp4059 said:
Got my stuff in the other day, can't wait to get started on this project, but I bought a new soldering iron which will come in on friday so I'll have to wait till then. Did you wire the sticks the same way as the wiring diagram you have on the other forum? And have you been able to modify the light cover to fit over the sticks? Do you put the resistor on the first stick only or all of them? I also noticed that the Trinket has a 5V pin placement, can you power the sticks from there or is it better to come off of the UBEC?

I really like what you have done with these LED's.

Thanks!

I cleaned up the code a bit for the Phantom, there were a few unused variables and methods meant for animation sequences that I wasn't using yet. This one is for 16LEDs on 2 arms, you should be able to revise it (or I can if you need help) for 32 on all four arms:

Code:
#include <Adafruit_NeoPixel.h>
//#include <math.h>

#define PIN 1 // LED output Pin (Pin 1 output is tied to the red LED on the Trinket)

#define BRIGHTNESS 30 // brightness 0-255  

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(16, PIN);

void setup() {
  pixels.begin();
  pixels.setBrightness(BRIGHTNESS);
  pinMode(2, INPUT);  // GPIO pins 2 and 4 for analogRead
  pinMode(4, INPUT);
}

unsigned long int getAnimationColor() {
  static const unsigned long int animationColors[] = { 
    0x000000, 0x00FF00, 0xFF0000, 0xFFFF00       }; // colors of animation OFF, GREEN, RED, YELLOW
  static unsigned long int animationColor = 0x000000;
  // read Naza green led
  int sensorValue0 = analogRead(1);  //Digital pin 2 is Analog 1 on Trinket
  // read Naza red led
  int sensorValue1 = analogRead(2);   //Digital pin 4 is Analog 2 on Trinket
  
  byte animationColorIndex = (sensorValue0 > 500) + ((sensorValue1 > 500) << 1); // e.g., 1 + 2 = 3 (yellow), 0 + 2 = 2 (red)

  animationColor = animationColors[animationColorIndex];

  return animationColor;
}


void playNoAnimation(unsigned long int animationColor) {
  for (byte i = 0; i < 8; i++) {

// show all 16 back directional colors, which all flash NAZA lights when lit up

    if (animationColor != 0x000000) {   // Assign rings to Naza Blink if not-black
      pixels.setPixelColor(i, animationColor);       // Back right (M4)
      pixels.setPixelColor(i+8, animationColor);    // Back left (M3)
      pixels.setBrightness(255);
    }
    
    else {                                         // otherwise assigns rings to directional color
      pixels.setPixelColor(i, 0xFF00FF);        // Back right arm (M4)
      pixels.setPixelColor(i+8, 0xFF00FF);     // Back left arm (M3)
      pixels.setBrightness(255);
    }
 }
  pixels.show();
}

void loop() {
  unsigned long int animationColor = getAnimationColor();
  playNoAnimation(animationColor);
}
You have a few options for wiring. Following the instructions ends up with a big daisy chain of wiring, which is fine. I'm thinking about powering and sending data to the front arms separately so I don't have wires snaking throughout the perimeter of the quad, but it really ends up being the same thing.

I haven't modified the lens covers yet. I actually like them uncovered (like my Naza LED) - they're much sharper and brighter, and visible from a greater distance. I think getting them to fit is going to be a combination of shaving the PCB of the lights and dremeling out some plastic on the arms...I'll probably do it just because the ESCs and lenses provide some structural support for the arms, and I'd hate to lose it.

It'd be pretty tough to power 32 neopixels from the Trinket's 5v out. That output is limited to 150mA @5v. Each neopixel draws about 60mA at full brightness, or 20mA at each of full red, green or blue. That's enough power to drive two or three pixels at full brightness, or maybe eight at a single color or lower brightness. Long story short, I'd use a ubec (I have an extra PMU in my Phantom so I used that) and you can drive as many pixels as you want :)
 
Hi can you help me i need to have a switch when activated switch all Leds off i don't know how to code.

thank you
 
That's pretty basic, you can definitely do that without coding or going to the lengths of this particular mod. I know there are some commercial solutions out there that will let you simply wire the LED controller to a free channel on your TX (if you have gimbal tilt, you're out of channels and will need a third party rx/tx).

I'm reading CANBus through the Arduino right now and it looks like all the information there is change or turn on/off the LEDs based on any kind of stick input, craft position/orientation/speed/etc. There are a lot of possibilities here :)
 
Thanks but i wasn't clear already copied your code thank you but i need as extra lets say using pin 10 in arduino connected to rc switch channel if high display the Naza LED notifications if switch is low switch all Leds off. I don't know how to program it.

Thanks
 
Auh said:
Thanks but i wasn't clear already copied your code thank you but i need as extra lets say using pin 10 in arduino connected to rc switch channel if high display the Naza LED notifications if switch is low switch all Leds off. I don't know how to program it.

Thanks
Ah got it. You should be able to read the pwm off an analog rx pin exactly as you describe. I have a link in the blog entry to yves's original code which already has rx input examples you can use (his had switchable animations you could trigger from the tx, which is exactly what you want).
 
Question for you Elguano, in one of your pic's for the wiring of the neo stick, do you only need to use one of the ground connections.
 
djp4059 said:
Question for you Elguano, in one of your pic's for the wiring of the neo stick, do you only need to use one of the ground connections.

Yep, that's correct. Both grounds on each side are common, they go to the same ground plate on the PCB so you only need to connect one of them. I think the extra ground is there for convenience in case you break out the data and power lines separately.
 
I got everything hooked up and installed one light to check it out, it lit up but just stayed white, it didn't blink the same colors as the naza led. But I am happy that it lit up and that its pretty bright. Tomorrow I'll look and see if the Trinket has the right sketch that you posted.

EDIT: I just looked at your sketch on the 1st page and you have it setup for 16 neo-pixels and I only have 8 hooked up, would that be the problem?
 
djp4059 said:
I got everything hooked up and installed one light to check it out, it lit up but just stayed white, it didn't blink the same colors as the naza led. But I am happy that it lit up and that its pretty bright. Tomorrow I'll look and see if the Trinket has the right sketch that you posted.

EDIT: I just looked at your sketch on the 1st page and you have it setup for 16 neo-pixels and I only have 8 hooked up, would that be the problem?

It may, but from what I've seen, you can ask it to address however many you want, but it will only have an effect on what you have installed (lights 0-7).

Not sure why it's lighting up white, the sketch I have here doesn't ever use pure white. Have you tried running the neopixel example sketch strandtest? It'll let you know if everything is wired up right.
 
I'll give the strand test a try. Working with Arduino, when you upload a sketch does it automatically erase the old sketch or are you suppose to erase it first.
 
djp4059 said:
I'll give the strand test a try. Working with Arduino, when you upload a sketch does it automatically erase the old sketch or are you suppose to erase it first.

New sketches automatically replace the old one, no need to manually erase.
 
SUCCESS!! Thanks for the help ElGuano. All I have to don now is get it all wired up and mounted. I'll post some picks when its finished.
 
djp4059 said:
SUCCESS!! Thanks for the help ElGuano. All I have to don now is get it all wired up and mounted. I'll post some picks when its finished.

Woohoo congrats! Can't wait to see the pics and maybe a video in flight! I've been talking a few people through this mod but have yet to see someone finish it up :)
 

Members online

Forum statistics

Threads
143,066
Messages
1,467,358
Members
104,936
Latest member
hirehackers