Adafruit_Pixie for their 3W-LEDs ported

I have successfully ported the Adafruit_Pixie-library for their 3W-serial LEDs, not to be confused with the ‘Pixy’-camera, also distributed and librarised by Adafruit, simply by adding the spurrious sniplet:

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#elif defined(PARTICLE)
#include "application.h"
#endif

Spurious, because a) discussion here is endless, and b: I swapped ‘SPARK’ to ‘PARTICLE’.

Anyway: This library works right out of the box. My opinion is, it can be safely added to the official pool.

Those LEDs are simply great.

@dial I’m also using the Pixie with my Photon. I added the snippet you posted to the .h file found here. Then I used their example code, which worked great after removing the SoftwareSerial code in favor of Serial1 (the comments in their example helped quite a bit here). Seems like this should be added to the library set so others don’t have to spend the hour I did getting this to work :smile:

1 Like

The wiring for working with the Pixie is also worth a mention since it requires 5V logic and the Photon has 3.3V, so I’ll add that here:

I based my solution off of this one, which uses an N-Channel MOSFET to switch the serial line at 5V given the Photon’s 3.3V.

I use a FQP30N06L N-channel MOSFET:

  • the Photon’s TX pin is connected directly to the source

  • the Pixie DIN pin is connected directly to the drain

  • +3.3 Vdc is connected directly to the gate

  • a 10k pull-up resistor (R1) is connected between source and gate

  • a 1k pull-up resistor (R2) is connected between drain and +5 Vdc

I published the library here so anyone can now easily add it :smiley:

2 Likes

Does this refer to SoftwareSerial?
There is one (in beta state), and I could do with some feedback in real world projects

Oh nice! This library was originally made for SoftwareSerial, so I’ll see if it works.

1 Like

Of course, that piece of code went driectly into the ~.h-file.

As mentioned in my starting entry from August, simply the mandatory

#include "application.h"

is sufficient. The adafruit code works as documented.

I did not read it carefully enough:

Does this refer to SoftwareSerial?
There is one (in beta state), and I could do with some feedback in real world projects

SoftwareSerial is unrelated, and should be IMHO.
Said library is taken directly from adafruit and has not been changed since.

I've had no issues. I powered the Photon (or Core) with USB and the Pixie via VIN ignoring the little dropdown.
The data line goes directly to the Photon via SoftwareSerial, or in case of the core directly:

   Adafruit_Pixie pixieStrip = Adafruit_Pixie(NUMPIXELS, &Serial1);

No extra mile.

I’ve made an improvement to the Adafruit library so that each Pixie’s brightness can be controlled individually. The hardware is totally capable, but the library didn’t come with support for this. I’m testing the new version now and still cleaning up the code to bring back as many of the Adafruit features as I can. Code can be found here

What do you guys think?

Do you like the function setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t brightness) or keep it as it was, setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b), and instead change setBrightness(uint8_t b) to setBrightness(uint16_t n, uint8_t b) where n is the strip number?

Should I make an effort to port the original setBrightness(uint8_t b) so that one can continue to change the brightness of every light with one function?

I would not mess with color models. RGB is the most technical and I know how to work with.
I have seen the functions inside the library and do not quite understand what he is doing there. The author is probably referring to his code in the implementation of the Pixie itself, so maybe you want to look there.
I myself would use a clean hue-saturation approach, maybe with some mapping to create a much more linear experience. In other word, I am avoiding that function.