Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2 RGB Neopixel leds working #123

Open
raymond-w2 opened this issue Nov 25, 2019 · 176 comments
Open

v1.2 RGB Neopixel leds working #123

raymond-w2 opened this issue Nov 25, 2019 · 176 comments

Comments

@raymond-w2
Copy link

raymond-w2 commented Nov 25, 2019

After some trial and error I got my RGB leds to work.
Strip of 59 leds powered by an external wall powersupply .
https://imgur.com/a/lEBhNcu

Sharing my solution here as I spent way to much time on this...

On the WS2812B Din the normal resistor should be 300 to 500 Ohm.
I changed it up to 12580 Ohm (several resistors in series) and now the signal is coming trough :)

/edit
After a bit mote tinkering best value was 14K Ohm

Software settings :

Platformio.ini
https://github.com/bigtreetech/Adafruit_NeoPixel

Configuration.h
`// Support for Adafruit Neopixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
//#define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
//edit by RaymondW
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800)
#define NEOPIXEL_PIN PC7 // LED driving pin

//Changed by RaymondW
#define NEOPIXEL_PIXELS 59 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 55 // Initial brightness (0-255)

#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup

// Use a single Neopixel LED for static (background) lighting
#define NEOPIXEL_BKGD_LED_INDEX 25 // Index of the LED to use
#define NEOPIXEL_BKGD_COLOR { 0, 0, 0, 255 } // R, G, B, W
#endif

/**

  • Printer Event LEDs
  • During printing, the LEDs will reflect the printer status:
    • Gradually change from blue to violet as the heated bed gets to target temp
    • Gradually change from violet to red as the hotend gets to temperature
    • Change to white to illuminate work surface
    • Change to green once print has finished
    • Turn off after the print has finished and the user has pushed a button
      */
      #if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
      #define PRINTER_EVENT_LEDS
      #endif`
@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

I put the 3 pixels under my hero me and are somewhat working, colors are off. After the startup_test the first pixel is not lit. When the hot end heats up the colors are all wrong. Once the hotend is to temperature the first led is blue and the other two are white though. Was putting up with it. I just need to add a high ohm resister on the dataIn line and change NEOPIXEL_TYPE? Any help is appreciated, been putting up with it but would rather it work the way its supposed to.

@x0rzist
Copy link

x0rzist commented Nov 25, 2019

I didn't install the LED strips yet, so I can only guess, but if your colors are off, you can try to change the NEOPIXEL_TYPE. Maybe NEO_KHZ800 or NEO_RGB.

And for the first LED behaving differently, maybe you defined NEOPIXEL_BKGD_LED_INDEX? This seems to affect only one LED.

@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

I did try NEO_RGB, and the colors were worse. I think its weird that after power up they should be blue and the first led is off. I just tried compiling with NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800), and it failed. The output didn't like the + sign.

@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

Also, the NEOPIXEL_BKGD_LED_INDEX is still commented out.

@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

I'm a dummy the NEO_GRB + KHZ800 shouldn't be in parentheses! That's what I get for being lazy and copy and pasting.

@raymond-w2
Copy link
Author

I put the 3 pixels under my hero me and are somewhat working, colors are off. After the startup_test the first pixel is not lit. When the hot end heats up the colors are all wrong. Once the hotend is to temperature the first led is blue and the other two are white though. Was putting up with it. I just need to add a high ohm resister on the dataIn line and change NEOPIXEL_TYPE? Any help is appreciated, been putting up with it but would rather it work the way its supposed to.

This was my issue also, wrong colors and partial functioning RGB leds.

@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

Just compiled with the above changes, getting ready to test it out. Just have to solder in the resistance change.

@JWolfJr
Copy link

JWolfJr commented Nov 25, 2019

Thanks for posting your findings, I went with 14.4k and is pretty close. Red is red blue is blue and so on, I think orange and yellow are slightly off. I can live with it, I really just care about the extra light when printing. Thanks again!

@TheGadge
Copy link

Interesting! thanks for this! Did you use a cap at all? Such as adafruit recommend?

@JWolfJr
Copy link

JWolfJr commented Nov 26, 2019

Not on this one, on all my other addressable led projects I do though. I do have a set of 4 tea lights I printed and use for a halloween scene with a flickering sketch that I did not use any caps on. Was on all of October with no ill affect.

@demitrix
Copy link

demitrix commented Nov 28, 2019

I was able to get LEDs working with a little different route. Have you noticed any issues with inconsistent colors though? I'm curious is the resistor is the key here. I will try to get a video of the effect, but say during the warm up cycle, most pixels are purple like they should be, but a few will be yellow or red instead.

https://imgur.com/gallery/Mnd2kmk

@TheGadge
Copy link

Not on this one, on all my other addressable led projects I do though. I do have a set of 4 tea lights I printed and use for a halloween scene with a flickering sketch that I did not use any caps on. Was on all of October with no ill affect.

A34011FB-FEEC-484B-8F08-2C2B84E3D51A

@TheGadge
Copy link

I was able to get LEDs working with a little different route. Have you noticed any issues with inconsistent colors though? I'm curious is the resistor is the key here. I will try to get a video of the effect, but say during the warm up cycle, most pixels are purple like they should be, but a few will be yellow or red instead.

https://imgur.com/gallery/Mnd2kmk

“A little different route”??? Come on man, how! Lol.
67185CD2-D148-4963-ACB1-7DD1E2E2FF15

@raymond-w2
Copy link
Author

@demitrix
It is not only the resistor or capacitor, I can get inconsistent colors if I have incorrect grounding.
The LED strip and the SKR/PSU need to share 1 common ground to get consistent colors in my setup.

I placed an extra ground wire from the SKR-PSU connection to the metal chassis and connected my 5v LED PSU ground to the chassis also.

There are multiple users mentioning inconsistent ground problems, probably pointing to a bad ground plane design.

@demitrix
Copy link

demitrix commented Nov 28, 2019

Here are the changes I used when I first got my strip working.
Platformio.ini
Under [common] comment out the Adafruit Neopixel library and add
Adafruit NeoPixel=https://github.com/bigtreetech/Adafruit_NeoPixel
Under your [env:STM32F103RC_bigtree] of choice
remove Adafruit Neopixel from lib_ignore

Configuration.h
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRB //Varies by strip
#define NEOPIXEL_PIXELS 20 // Set your length
#define NEOPIXEL_IS_SEQUENTIAL
#define NEOPIXEL_BRIGHTNESS 127
#define NEOPIXEL_STARTUP_TEST

The NEOPIXEL_PIN is defined in a separate file no need to define it here.

@raymond-w2 I am using the DCDC5V addon and getting 5v/gnd from the board itself. Perhaps this is an issue as well. I have a 4kOhm resistor laying around I may toss on the data in to see if it helps.

I believe using NEO_GRB + NEO_KHZ800 is redundant if you look at Marlin\src\feature\leds\neopixel.cpp

Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800)

@raymond-w2
Copy link
Author

@demitrix
Maybe redundant, but this is how I got this working.
If something changes in the future, I know I've got my details in the correct places.

Using the onboard DCDC5V is only possible with a small amount of leds, I'm using a strip of 59.
My external PSU spikes up to 1.7A when they change to full power white.

@demitrix
Copy link

I only have 20 LEDs so within range. I have up for the time being. They work sometimes but colors are inconsistent, I believe it's BTTs implementation of STM32F1 in the neopixel library to be honest

@demitrix
Copy link

demitrix commented Dec 4, 2019

I have made some progress in my suspicions. After some light reading about bit banging and microcontrollers and WS2812B strips I was convinced that BTTs timing was off. I just uploaded a second version my modified NeoPixel library and have much better accuracy on my LEDs. I have increased the number of nops to increase the delay between GPIOs being high and low. Some of the ranges used by BTT are far off. Really need someone with an oscilloscope to measure the data pin and confirm the timings.

// min: 550 typ: 700 max: 5,500 - Incorrect.
// min: 550 typ: 700 max: 850
GPIO_SET(pin);      
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;");
// min: 450 typ: 600 max: 5,000 - Incorrect
// min: 450 typ: 600 max: 750
GPIO_CLEAR(pin);
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop;");
      } else {
// data ZERO high
// min: 200  typ: 350 max: 500
GPIO_SET(pin);
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop;");
// data low
// min: 450 typ: 600 max: 5,000 - Very incorrect
// min: 650 typ: 800 max: 950
GPIO_CLEAR(pin);
asm("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"
    "nop;");

@demitrix
Copy link

demitrix commented Dec 9, 2019

So I just realized tonight when adding mesh bed leveling that my second try at this never actually flashed. The above edit to Adafruit_NeoPixel.cpp gets the RGB functionality much much closer than it was with BTTs version. anyone else using RGB feel free to try it out and see if it improves your RGB colors.

Here is the hotend heating sequence. Still a few glitches.

http://imgur.com/gallery/lBvdgpJ

@Scope666
Copy link

Scope666 commented Jan 5, 2020

Hi,

Wanted to see if anyone made any progress here. Here's the REALLY strange thing. LED control works PERFECTLY under Klipper firmware, so there's something specific to Marlin / the Bigtree Neopixel library that's borked.

Here's my Marlin config:

// Support for Adafruit Neopixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
  #define NEOPIXEL_TYPE   NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
  #define NEOPIXEL_PIN     PC7       // LED driving pin
  //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
  //#define NEOPIXEL2_PIN    5
  #define NEOPIXEL_PIXELS 3        // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used
  #define NEOPIXEL_IS_SEQUENTIAL   // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
  #define NEOPIXEL_BRIGHTNESS 127  // Initial brightness (0-255)
  #define NEOPIXEL_STARTUP_TEST  // Cycle through colors at startup

  // Use a single Neopixel LED for static (background) lighting
  //#define NEOPIXEL_BKGD_LED_INDEX  0               // Index of the LED to use
  //#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
#endif

Library config in platformio.ini:

lib_deps =
  LiquidCrystal
  TMCStepper@>=0.6.1,<1.0.0
  #Adafruit NeoPixel
  #https://github.com/bigtreetech/Adafruit_NeoPixel
  https://github.com/demitrix/Adafruit_NeoPixel

Under Klipper I can address any of the 3 LED's on the hot end and get the exact color I ask for, so I know the SKR Mini E3 1.2 is capable at the hardware level.

Perfectly working Klipper config:

[neopixel my_neopixel]
pin: PC7
chain_count: 3
color_order_GRB: True
initial_RED: 0.0
initial_GREEN: 0.0
initial_BLUE: 1.0

My gut instinct tells me that even though we're setting it to GRB (no W) it's still treating it like a GRBW LED type. I'm using this exact strip: https://www.aliexpress.com/item/32886914735.html (60 leds/meter)

Perhaps an examination of what he's doing differently (that works) with Klipper would help:

https://github.com/KevinOConnor/klipper/blob/master/src/neopixel.c

UPDATE: On a whim I changed the amount of LEDs in Configuration.h from 3 (what I actually have on the hot end) to 8 just to see if it would make a difference. Unbelievably its working almost perfectly! Before if I set the LEDs to "off" they would still be lit, just dimmer. Now they actually turn off. Also the color presets menu is working about 98% correctly with Demitrix's modified library. There must be a bug in how it tries to "index" the individual LED's.

Video: https://imgur.com/a/2dzzqXF

@wees
Copy link

wees commented Jan 8, 2020

I've also been trying to get my neopixel strip of 15 LEDs working. I have them plugged in directly to the neopixel port for power and data and using the same configuration.h and platform.ini as above, but my LED strip only turns on as white. I can't get the LEDs to change color, the startup test, through gcode, or through the LCD menu. Any suggestions?

@Scope666
Copy link

Scope666 commented Jan 8, 2020

@wees Are you using the modified library by Demitrix? I had WAY better results with it. Also you might have to play with the number of LEDs in Marlin. When I set to what I actually have it doesn't work, I had to go higher. (I have 3, had to set to 8, 15 also works) Also if you have 15 you have to supply additional power, I don't think the board can drive that many without the 5v add-on board.

@wees
Copy link

wees commented Jan 8, 2020

@Scope666 I am using Demitrix's library now. I thought that would be the golden ticket but no luck. I'll try setting a higher number of pixels. I did try a lower number thinking maybe it was a power issue and it did disable the additional LEDs, but the color is still white. Well RGB white, my strip isn't rgbw just to clarify.

@Scope666
Copy link

Scope666 commented Jan 8, 2020

How are you disabling the additional LEDs, aren't they all connected together in the strip? Doing it at the software level I don't think would be enough. My strip is also GRB only, no "W"

This one: https://www.aliexpress.com/item/32886914735.html (60/meter)

Edit: they say not to use more than 8:

image

@wees
Copy link

wees commented Jan 8, 2020

By disabling I mean in the software. I have a total 15 LEDs in my strip and when I set the number to 5, only 5 LEDs lit up.

Edit: Hmm I didn't see that recommendation. All of the LEDs are lit up, but I'll try 8

@demitrix
Copy link

demitrix commented Jan 8, 2020

Something is definitely off, I haven't touched this in a while been working on other things, however I noticed that each time I flash a firmware the results were different. Even with no changes to the Neopixel config, I am not sure whats going on. It looks like Klipper is using an actual timer to time the Neopixel signals, where as Marlin (well not Marlin but BTTs implementation of Neopixel) is just bitbanging the port and using nops as a "timer" to set the delay in signal. This can vary wildly in relation to the timing that the LEDs require. Hopefully one day someone with more experience (mine being none) experience with STM controllers can rewrite the library to use the proper timer or maybe Adafruit will add STM32 support someday.

If anyone were to have access to an oscilloscope that could measure the signals from the Neopixel pin on the SKR we'd be closer to knowing how far and which direction the timing if off by. I was just trying to make an educated guess with my changes.

@Scope666
Copy link

Scope666 commented Jan 8, 2020

I would suggest maybe cutting off and wiring 3 only, to replicate my setup. You can always install them on the hot end, and then add more later to the top bar. (my plan)

Hopefully you can get to a known working setup with the 3, and then troubleshoot from there.

@Scope666
Copy link

Scope666 commented Jan 8, 2020

@demitrix For sure, Klipper definitely nailed it. It was spot on perfect the first time I tried it, and I could individually set each LED to any color I wanted. The Marlin guys / BTT should take a look at his code.

Is there any way to reverse engineer how Klipper is doing it to get the timing correct that way?

@demitrix
Copy link

demitrix commented Jan 8, 2020

@demitrix For sure, Klipper definitely nailed it. It was spot on perfect the first time I tried it, and I could individually set each LED to any color I wanted. The Marlin guys / BTT should take a look at his code.

Yeah I just popped over to that repo and it looks like it using an actual timer library. Maybe one day if I get bored I might dig back into this. I am in the process of moving my Ender to an enclosure and designing an electronics case for everything. So the RGB LEDs hit the backburner as I will probably light the enclosure with just white LEDs.

@wees
Copy link

wees commented Jan 8, 2020

Had some time this morning to play around with my config. Changing to 8 LEDs didn't change anything. They all stayed white. On a whim, I changed the NEO_GRB to NEO_GRBW and my LEDs did change colors, although not the correct colors. Very strange because I'm 99% sure my LEDs do not include a W pixel. I did order the 5vDCDC board and the neopixel strip Scope666 posted above so maybe it's just my LED strip. The fact that my LEDs do respond to gcode, but don't display the correct colors leads me to believe my LED strip is out of compliance or some other standard.

@argus0209
Copy link

So after a few days and lots of help from discord and other places i managed to get a working library and thus compile a working firmware. However still no neopixels sadly. I've tested them outside of the skr and they function. So i don't know what the problem could be. Any thoughts?

did you clear up your errors ?

@noterms
Copy link

noterms commented Jul 1, 2020

So after a few days and lots of help from discord and other places i managed to get a working library and thus compile a working firmware. However still no neopixels sadly. I've tested them outside of the skr and they function. So i don't know what the problem could be. Any thoughts?

did you clear up your errors ?

Yes there was a linting setting in vscode that caused those i can't recall it now. But changing to demitrix library helped a great deal in fixing my issue. Something is off with the default library for neopixels.

@argus0209
Copy link

So after a few days and lots of help from discord and other places i managed to get a working library and thus compile a working firmware. However still no neopixels sadly. I've tested them outside of the skr and they function. So i don't know what the problem could be. Any thoughts?

did you clear up your errors ?

Yes there was a linting setting in vscode that caused those i can't recall it now. But changing to demitrix library helped a great deal in fixing my issue. Something is off with the default library for neopixels.

I have the same errors so if you recall the fix please let me know.
I can get marlin to compile but my board won't boot with neopixels enabled. I do however get one green led on power on. This is frustrating.

@argus0209
Copy link

Can someone with neopixels working post there firmware files ?

@paul-1
Copy link

paul-1 commented Jul 2, 2020

Its not that easy, since there are too many machine options.

First.....Please make sure you pull the latest Marlin Bugfix....... What are problems are you seeing? How are your LEDs wired? What kind of LEDs do you have?

@argus0209
Copy link

argus0209 commented Jul 2, 2020

My issues was fixed with a reboot of my computer. Here is my config to help people in the future. thanks everyone!

Firmware = https://github.com/bigtreetech/Marlin

Platformio.ini:

[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
default_envs = STM32F103RC_btt_512K

The 'common' values are used for most Marlin builds

[common]
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants
lib_deps =
LiquidCrystal@1.5.0
TMCStepper@~0.7.0
Adafruit MAX31865 library@~1.1.0
#Adafruit NeoPixel@1.5.0 <==========================Commented out
U8glib-HAL@0.4.1
Arduino-L6470@0.8.0
SlowSoftI2CMaster
LiquidTWI2@1.2.7
SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
Adafruit NeoPixel=https://github.com/bigtreetech/Adafruit_NeoPixel #<===========added this line

configuration.h:

// Support for Adafruit Neopixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
//#define NEOPIXEL_PIN PC7 // LED driving pin
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
//#define NEOPIXEL2_PIN 5
#define NEOPIXEL_PIXELS 8 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)
#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup

// Use a single Neopixel LED for static (background) lighting
//#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use
//#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
#endif

/**

  • Printer Event LEDs
  • During printing, the LEDs will reflect the printer status:
    • Gradually change from blue to violet as the heated bed gets to target temp
    • Gradually change from violet to red as the hotend gets to temperature
    • Change to white to illuminate work surface
    • Change to green once print has finished
    • Turn off after the print has finished and the user has pushed a button
      */
      #if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
      #define PRINTER_EVENT_LEDS
      #endif

@romandie
Copy link

Hello, thank you for all these posts. I would like to operate just 1 LED 5V to create a light to know when it is hot, cold and other. I know how to do it with GCODE, but I don't quite understand how to connect. I have 4 wires on my led strip and I'm not sure which PIN to put these cards on, if I need a resistor or something. I don't want to burn my card. Thank you

@Taomyn
Copy link

Taomyn commented Jul 21, 2020

As the platformio.ini files seems to change format every other release of the latest bugfix, here's my current copy in case anyone has problems compiling again.

The changes are:
Makes the SKR Mini E3 v1.2 the default, change as you see fit
image

Switches to the BTT version of the Adafruit NeoPixel library:
image

@romandie
Copy link

Thanks, where in the skr E3 mini i connect ? And i change files pins ?

@Taomyn
Copy link

Taomyn commented Jul 23, 2020

Ok, so I jumped the gun a bit and was not paying attention. Yes it compiles, yes the LEDs switch on, no they cannot be controlled by the printer. They remain full lit white at all times.

Have tried with the PIN set to PC7 and without. So I reverted to the the old "fixed" version of the library from https://github.com/CommandoreBombardiero/Adafruit_NeoPixel and now it's back to RGB normality. Looks like BTT have broken something somewhere, so I'm going to fork the CommandoreBomardiero version for myself to include the correct changes to one of the files so it works on my environment even when VSCode has to download it again.

@Arakon
Copy link

Arakon commented Aug 8, 2020

I'm getting absolutely zero reaction. no matter the library.

@Arakon
Copy link

Arakon commented Aug 8, 2020

Neeevermind. The strip is broken.

@monstis
Copy link

monstis commented Aug 24, 2020

If you are still having probs try this solution
#286
It worked for me. SKR mini e3 v2

@Mickroz
Copy link

Mickroz commented Dec 14, 2020

i cannot seem to get this to work on a SKR mini e3 v1.2 , so many different ways of doing this, and nothing works.
The readme files fails aswell, changing default_envs = STM32F103RC_btt to STM32F103RC_btt_512K fails.
under [features] in platformio.ini i have:

NEOPIXEL_LED            = NeoPixel=https://github.com/CommandoreBombardiero/Adafruit_NeoPixel/archive/master.zip

configuration.h

#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
  #define NEOPIXEL_TYPE   NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
  #define NEOPIXEL_PIN     PC7       // LED driving pin
  //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
  //#define NEOPIXEL2_PIN    5
  #define NEOPIXEL_PIXELS 6       // Number of LEDs in the strip. (Longest strip when NEOPIXEL2_SEPARATE is disabled.)
  //#define NEOPIXEL_IS_SEQUENTIAL   // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
  #define NEOPIXEL_BRIGHTNESS 127  // Initial brightness (0-255)
  #define NEOPIXEL_STARTUP_TEST  // Cycle through colors at startup

in Adafruit_Neopixel.cpp i added after #include "Adafruit_NeoPixel.h"

#include <..\..\..\..\Marlin\src\HAL\shared\Delay.h>

but that always seam to fail finding the file when changed to the 512k env.

Also changed the jumper for external power to motherboard power.

@Taomyn
Copy link

Taomyn commented Dec 15, 2020

@Mickroz what actually fails? You don't post any kind of messages you're getting. There's other things you need to do to get it to compile for the mini E3.

@Mickroz
Copy link

Mickroz commented Dec 15, 2020

Ok, let me take you through my steps:

  1. I download a copy from this github.
  2. I open the platformio.ini file in BIGTREETECH-SKR-mini-E3/firmware/V1.2/Marlin-2.0.7.2-SKR-mini-E3-V1.2/
  3. I change NEOPIXEL_LED = Adafruit NeoPixel@1.5.0 to NEOPIXEL_LED = NeoPixel=https://github.com/CommandoreBombardiero/Adafruit_NeoPixel/archive/master.zip
  4. I open the configuration.h file in BIGTREETECH-SKR-mini-E3/firmware/V1.2/Marlin-2.0.7.2-SKR-mini-E3-V1.2/Marlin/
  5. I change the setting for my bltouch and neopixel as provided on the v1.2 firmware github page.
  6. i press ctrl-alt-b, and its starts building
.pio\libdeps\STM32F103RC_btt\NeoPixel\Adafruit_NeoPixel.cpp:51:10: fatal error:
replace with path to Delay.h file: No such file or directory
 #include <replace with path to Delay.h file>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\STM32F103RC_btt\lib988\Adafruit NeoPixel\Adafruit_NeoPixel.
cpp.o
compilation terminated.
*** [.pio\build\STM32F103RC_btt\libecd\NeoPixel\Adafruit_NeoPixel.cpp.o] Error 1

========================= [FAILED] Took 74.74 seconds =========================

Environment      Status    Duration
---------------  --------  ------------
STM32F103RC_btt  FAILED    00:01:14.738
==================== 1 failed, 0 succeeded in 00:01:14.738 ====================
  1. I open BIGTREETECH-SKR-mini-E3-master\firmware\V1.2\Marlin-2.0.7.2-SKR-mini-E3-V1.2\.pio\libdeps\STM32F103RC_btt\Adafruit NeoPixel\Adafruit_NeoPixel.cpp
  2. I add #include <..\..\..\..\Marlin\src\HAL\shared\Delay.h> on a new line after #include "Adafruit_NeoPixel.h"
  3. I press Save and ctrl-alt-b and it starts building.
.pio\libdeps\STM32F103RC_btt\NeoPixel\Adafruit_NeoPixel.cpp:51:10: fatal error:
replace with path to Delay.h file: No such file or directory
 #include <replace with path to Delay.h file>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\STM32F103RC_btt\libecd\NeoPixel\Adafruit_NeoPixel.cpp.o] Error 1

========================= [FAILED] Took 67.69 seconds =========================

Environment      Status    Duration
---------------  --------  ------------
STM32F103RC_btt  FAILED    00:01:07.694
==================== 1 failed, 0 succeeded in 00:01:07.694 ====================
  1. I open platformio.ini and change default_envs = STM32F103RC_btt to default_envs = STM32F103RC_btt_512K
  2. I press save and ctrl-alt-b and it starts building
.pio\libdeps\STM32F103RC_btt_512K\NeoPixel\Adafruit_NeoPixel.cpp:51:10: fatal er
ror: replace with path to Delay.h file: No such file or directory
 #include <replace with path to Delay.h file>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\STM32F103RC_btt_512K\libaa4\Wire\SoftWire.cpp.o
*** [.pio\build\STM32F103RC_btt_512K\lib80b\NeoPixel\Adafruit_NeoPixel.cpp.o] Er
ror 1
========================= [FAILED] Took 73.56 seconds =========================

Environment           Status    Duration
--------------------  --------  ------------
STM32F103RC_btt_512K  FAILED    00:01:13.561
==================== 1 failed, 0 succeeded in 00:01:13.561 ====================
  1. I open BIGTREETECH-SKR-mini-E3-master\firmware\V1.2\Marlin-2.0.7.2-SKR-mini-E3-V1.2\.pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel\Adafruit_NeoPixel.cpp
  2. I add #include <..\..\..\..\Marlin\src\HAL\shared\Delay.h> on a new line after #include "Adafruit_NeoPixel.h"
  3. I press Save and ctrl-alt-b and it starts building.
.pio\libdeps\STM32F103RC_btt_512K\NeoPixel\Adafruit_NeoPixel.cpp:51:10: fatal er
ror: replace with path to Delay.h file: No such file or directory
 #include <replace with path to Delay.h file>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\STM32F103RC_btt_512K\lib80b\NeoPixel\Adafruit_NeoPixel.cpp.o] Er
ror 1
========================= [FAILED] Took 78.10 seconds =========================

Environment           Status    Duration
--------------------  --------  ------------
STM32F103RC_btt_512K  FAILED    00:01:18.104
==================== 1 failed, 0 succeeded in 00:01:18.104 ====================
  1. I delete everything and download a fresh copy again, only changing default_envs in platformio.ini and edit the bltouch and neopixel settings in configuration.h and it builds with no errors, it flashes on the ender 3 pro, but no leds.

at 1 time i had seen the leds turn red/green/blue/white very fast, but never after that again, i cannot control the color via octoprint too.
I hope you can see where my error is @Taomyn thanks.

@CommandoreBombardiero
Copy link

@Mickroz The compiler is telling you exactly what's wrong. You were suppose to literraly replace the <> content at line 51 by your Delay.h file path. As far as I understand, you've created seperate include directive, so just delete the line
#include <replace with path to Delay.h file>
and it should compile without problems. I wrote it this way on purpose, so compiler can qucikly point out the problem (and sollution) in case somebody forgot to edit the file.

@Taomyn
Copy link

Taomyn commented Dec 15, 2020

@Mickroz I don't see anywhere where you actually replace with part with <> in #include <replace with path to Delay.h file> with the correct path, you just keep adding an extra line with what should be going into that line while keeping it so of course it will fail, or am I missing something now?

@Mickroz
Copy link

Mickroz commented Dec 15, 2020

Ah wait, now i see, im in the wrong file, im editing Adafruit Neopixel/Adafruit_NeoPixel.cpp and that line is in Neopixel/Adafruit_NeoPixel.cpp, argh, dunnow why i haven't seen that before :(

@Mickroz
Copy link

Mickroz commented Dec 15, 2020

YES, now it builds correct 👍 it flashes good aswell, but no leds

@Tumicek
Copy link

Tumicek commented Dec 26, 2020

Good day. I fight all day with the settings for NEOPIXEL and SKR Mini E3 V1.2
It can't be compiled, it always throws me an error. I do it according to this setting.
Here is the configuration:

// Support for Adafruit Neopixel LED driver
#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
//edit by RaymondW
//#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800)
#define NEOPIXEL_PIN PC7 // LED driving pin

//Changed by RaymondW
#define NEOPIXEL_PIXELS 8 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)

#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup

// Use a single Neopixel LED for static (background) lighting
#define NEOPIXEL_BKGD_LED_INDEX 25 // Index of the LED to use
#define NEOPIXEL_BKGD_COLOR { 0, 0, 0, 255 } // R, G, B, W
#endif
Error message :

In file included from Marlin\src\feature/leds/neopixel.h:34:0,
from Marlin\src\feature/leds/leds.h:33,
from Marlin\src\MarlinCore.cpp:113:
.pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel/Adafruit_NeoPixel.h:361:3: error: 'GPIO_TypeDef' does not name a type
GPIO_TypeDef *gpioPort; ///< Output GPIO PORT
^~~~~~~~~~~~
Compiling .pio\build\STM32F103RC_btt_512K\src\src\feature\leds\neopixel.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\feature\leds\printer_event_leds.cpp.o
*** [.pio\build\STM32F103RC_btt_512K\src\src\MarlinCore.cpp.o] Error 1
In file included from Marlin\src\feature\leds\neopixel.h:34:0,
from Marlin\src\feature\leds\leds.h:33,
from Marlin\src\feature\leds\leds.cpp:31:
.pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel/Adafruit_NeoPixel.h:361:3: error: 'GPIO_TypeDef' does not name a type
GPIO_TypeDef *gpioPort; ///< Output GPIO PORT
^~~~~~~~~~~~
*** [.pio\build\STM32F103RC_btt_512K\src\src\feature\leds\leds.cpp.o] Error 1
In file included from Marlin\src\feature\leds\neopixel.h:34:0,
from Marlin\src\feature\leds\neopixel.cpp:31:
.pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel/Adafruit_NeoPixel.h:361:3: error: 'GPIO_TypeDef' does not name a type
GPIO_TypeDef *gpioPort; ///< Output GPIO PORT
^~~~~~~~~~~~
In file included from Marlin\src\feature\leds\neopixel.h:34:0,
from Marlin\src\feature\leds\leds.h:33,
from Marlin\src\feature\leds\printer_event_leds.h:28,
from Marlin\src\feature\leds\printer_event_leds.cpp:31:
.pio\libdeps\STM32F103RC_btt_512K\Adafruit NeoPixel/Adafruit_NeoPixel.h:361:3: error: 'GPIO_TypeDef' does not name a type
GPIO_TypeDef *gpioPort; ///< Output GPIO PORT
^~~~~~~~~~~~
*** [.pio\build\STM32F103RC_btt_512K\src\src\feature\leds\printer_event_leds.cpp.o] Error 1
*** [.pio\build\STM32F103RC_btt_512K\src\src\feature\leds\neopixel.cpp.o] Error 1
============================================================ [FAILED] Took 20.45 seconds ============================================================
Environment Status Duration


STM32F103RC_btt_512K FAILED 00:00:20.447
======================================================= 1 failed, 0 succeeded in 00:00:20.447 =======================================================The terminal process "C:\Users\Tumik.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Very thanks.....

@Mickroz
Copy link

Mickroz commented Dec 26, 2020

@Mickroz
Copy link

Mickroz commented Jan 2, 2021

still can't seem to get the leds light up, gonna try a new strip, see if that will work.

@Mickroz
Copy link

Mickroz commented Jan 3, 2021

still no go, both led strips do work on my raspberry pi when using python neopixel library and the 5v pin on the rpi, but not on this board.

@gazzaman2k
Copy link

@Mickroz i had my rgb working on 2.0.5.x i upgraded to 2.0.7.2 and they no longer work ive tried everything but nothing so i think im going back to 2.0.5.x again

@Mickroz
Copy link

Mickroz commented Jan 10, 2021

Ok, but there are people who have it working, so i don't understand why this fails.

@Taomyn
Copy link

Taomyn commented Jan 10, 2021

Ok, but there are people who have it working, so i don't understand why this fails.

You're welcome to look at my still working code here https://github.com/Taomyn/Marlin it's updated many times per week off the latest bugfix-2.0.x

@gazzaman2k
Copy link

Ok, but there are people who have it working, so i don't understand why this fails.

abacabie commented on 28 Oct 2020
This is a copy of a post i left on Reddit and the only way i could get it to work with the skr mini v2.

Search for NEOPIXEL_LED in platformio.ini, you will find it under "Feature Dependencies" and overwrite "Adafruit NeoPixel@1.5.0" with "https://github.com/CommandoreBombardiero/Adafruit_NeoPixel"

when you compile this it will fail, go to the .pio folder in marlin and open the folder that downloaded the CommandoreBombardiero library, open the "Adafruit_NeoPixel.cpp" and find the line that reads "#include " , its near the top, you need to overight and point to the "Delay.h" file that is in marlin, for me it looks like

"#include "C:\Users\ray\Desktop\Marlin-2.0.x\Marlin\src\HAL\shared\Delay.h"",

from #436 you dont need to do the insanity check part

turned out that the leds were working all along a wire has just snapped at solder point near my nozzle on the leds so thats why it stopped working after upgrading lol

@Mickroz
Copy link

Mickroz commented Jan 10, 2021

Ok, but there are people who have it working, so i don't understand why this fails.

You're welcome to look at my still working code here https://github.com/Taomyn/Marlin it's updated many times per week off the latest bugfix-2.0.x

thanks, will do.

Ok, but there are people who have it working, so i don't understand why this fails.

abacabie commented on 28 Oct 2020
This is a copy of a post i left on Reddit and the only way i could get it to work with the skr mini v2.

Search for NEOPIXEL_LED in platformio.ini, you will find it under "Feature Dependencies" and overwrite "Adafruit NeoPixel@1.5.0" with "https://github.com/CommandoreBombardiero/Adafruit_NeoPixel"

when you compile this it will fail, go to the .pio folder in marlin and open the folder that downloaded the CommandoreBombardiero library, open the "Adafruit_NeoPixel.cpp" and find the line that reads "#include " , its near the top, you need to overight and point to the "Delay.h" file that is in marlin, for me it looks like

"#include "C:\Users\ray\Desktop\Marlin-2.0.x\Marlin\src\HAL\shared\Delay.h"",

from #436 you dont need to do the insanity check part

turned out that the leds were working all along a wire has just snapped at solder point near my nozzle on the leds so thats why it stopped working after upgrading lol

this is exactly what i did.

@YoAdriaaannn
Copy link

Hi Everyone,

I have a partially working Neopixel setup. There are a few issues I have not been able to figure out, perhaps someone knows the answer to this.

I am using the CommandoreBombaderio edit of NeoPixel on a completely fresh pull of the 2.0.7.2 repo from BTT. I have wired in 400 ohms worth of resistance and a 1000 uf cap.

The test sequence works. Heating the nozzle and bed sort of works. I get a sequence of lights ranging from blue to violet then the very last 3 of 29 LEDs will turn red and my print begins.

I can select a color of LED in the settings menu, but I cannot turn off the LEDs nor switch to a different color.

I can send an M150 command such as M150 B255 and turn on a blue light, but I cannot get M150 B0 to work. So while Gcode works to turn on the LEDs, it does not work after turning on a LED then trying to switch color or turn them off.

Any ideas to get this working properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests