UNO and NeoPixel string issue

I have an Adafruit 100 lite NeoPixel string (Fairy Lights) I'm having issues getting my UNO to simply lights the entire string. I have uploaded my code to an MKR Zero and it runs fine, so I know the string and code are ok.
But when I run the same code on the UNO, either nothing lights, or I get some random colors on the first 20 lites.
Here is my code, any ideas most appreciated:

#include <Adafruit_NeoPixel.h>
#define LED_PIN 6
#define LED_COUNT 100

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(9600);
  Serial.println("Starting");
  strip.begin();
  for (int begLED = 0; begLED < LED_COUNT; begLED++)
  {
Serial.println(begLED);
    strip.setPixelColor(begLED, 1, 1, 1);
  }
  strip.show(); // Initialize all pixels
}

void loop() {
//  Serial.println("running");
}

Is the Adafruit_NeoPixel library compatible with the Uno R4 I wonder ?

See https://github.com/arduino/uno-r4-library-compatibility/blob/main/readme.md

@Grumpy_Mike talked about it in the thread:
Compatability concern - UNO R4 / UNO R4 Minima - Arduino Forum
I believe the 4th message in the thread.

Not sure if it was resolved or not.

Does not look like it has:
I do see an open Issue up on the Adafruit Github:

I'm interested in supporting uno r4 wifi · Issue #363 · adafruit/Adafruit_NeoPixel (github.com)

Support was recently added to the alternative "FastLED" library:

The "FastLED" library has differences from the "Adafruit NeoPixel" library, so you would need to make some adjustments to your code along with the the library switch, but we can surely help you with that in case you have trouble. "FastLED" is a really nice library so I think you won't mind making the switch in the end.

Since the UNO R4 support was added to the "FastLED" library only recently, the release version of the library available from the Arduino Library Manager doesn't yet have that advancement. You would need to use the development version of the library instead. If you are interested in giving that a try, I can provide instructions you can follow to install the library.

2 Likes

I just pushed up a Fork/branch of the Adafruit_NeoPixel library that appears to be working.

At least with my quick test on a 8 pixel Adafruit board.

It is sort of a cross between the Teensy T4.x implementation in the library, which looked like it was doing pretty generic ARM instruction counter stuff. I found the missing defines for the ARM registers in the above FastLED code, and I used some of the register setup code for the IO pin like from my changes to Servo library.

It is up at:

KurtE/Adafruit_NeoPixel at UNOR4 (github.com)

I have not yet done a PR with the changes. Would be good if others tried it out and see if it works for them.

1 Like

I think my issue comes from the LED string I'm using - the Adafruit "Fairy Lights" - they are "Fixed Address"; they don't have the WS2811 chip.

Definitely would be interested in instructions to install the development library.

1 Like

Looking at their product pages.like:
Fixed Address NeoPixel LED Fairy Lights - 100 Wired LEDs : ID 4917 : $34.95 : Adafruit
Industries, Unique & fun DIY electronics and kits

Looks like it uses the Neopixel library, so should work :crossed_fingers:

Add initial support for Arduino UNO R4 boards by KurtE · Pull Request #365 · adafruit/Adafruit_NeoPixel (github.com)

Edit: I tested this with a couple of different setups of NeoPixels.
Adafruit 8 LED stick.
PJRC - special shield from Paul - with Neopixels
PJRC - Special shield from Paul - with GRBW pixels

On Minima - Ran the last one also on WIFI board

OK, here you are:

  1. Click the following link to open the library's GitHub repository homepage in your web browser:
    https://github.com/FastLED/FastLED
  2. Click the "<> Code ▾" button you see on that page.
  3. Select Download ZIP from the menu.
    A download of the ZIP file of the library will start.
  4. Wait for the download to finish.
  5. Select Sketch > Include library > Add .ZIP Library from the Arduino IDE menus.
    The "Select the zip file containing the library you'd like to add" dialog will open.
  6. Select the downloaded file from the dialog.
  7. Click the "Open" button.
  8. Wait for Arduino IDE to show a "Successfully installed library ... notification.

Please let me know if you have any questions or problems while following those instructions.

3 Likes

Worked directly fine for me. Arduino Uno R4 Wifi + WS2811S

Many Thanks

Hi Kurt,

After implementation of you branch, it worked but i got from time to time some flickering in the ledstring. (Arduino Uno R4 + WS2811)
Looked with the scope and discovered that the timing is a little bit off towards the spec:
(running in 400KHz mode)
‘1’
High 1200ns
Low 1460ns
Spec
1200 +-150
1300 +-150

‘0’
H: 700
L 2000
Spec
500 +- 150
2000 +-150

This results in a bit frequency of 364Khz instead of 400Khz which the reclocking circuit sometimes takes and sometimes rejects.. .

Do you have a proper solution for this?

Regards Jan

Sorry, it has been a while since I looked at it. These days not doing much with these boards.

I thought about it back then, but left it as it is, as it had the same timings as another implementation that I believe that @facchinm did, and at the time I figured, if the other library worked well enough...

It might have been, there was not a good timer setup that gave you exactly 400khz. I will try to take a look again soon, but currently most of them are in a box...