Unable to control WS2812C with custom PCB using FastLED

Good afternoon,

I am not sure if my error is somehow in the Blink example or if I accidently missed something in my attached snippet of my circuit design. My understanding was all I needed was a 300 Ohm resistor from the datapin of the Atmega328PB in series to the DataIn of my first LED (LED0). I have successfully burned the bootloader to use the internal clock (8 MHz) before anyone points out the lack of a crystal for the external clock.

With the code below (from the FastLED Blink example, I just removed the comments to not have it take up so much space here) I am able to turn on as many of the LEDs as I want (currently I have it back down to 1, but if I set it to 4 all 4 will turn on when I program this using a programmer via ISCP (and the Arduino IDE) however that is all that I can get to happen. It will not change colour, it will not turn off the LED until/unless I upload a new version of the code using less LEDs.

#include <FastLED.h>

#define NUM_LEDS 1

#define DATA_PIN 10

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() { 

     FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);  // GRB ordering is typical
  
}

void loop() { 
  // Turn the LED on, then pause
  leds[0] = CRGB::Red;
  FastLED.show();
  delay(500);
  // Now turn the LED off, then pause
  leds[0] = CRGB::Black;
  FastLED.show();
  delay(500);
}

Have you selected the 8MHz cpu frequency in the IDE when compiling the code?

Yes I have, I have been using this configuration in the IDE and then using Uploading Using Programmer to push the bootloader using the ArduinoISP example, then once complete/passed/successful upload I've switched to the Blink Example above, same board settings.

image

Turns out the Bootloader wasn't properly being burned to use the internal 8 MHz, a bit more work at it and it's all working now.

To be precise this is determined by the fuse bits, not the bootloader. For greater convenience, I use the AVRDUDES ( GUI for AVRDUDE), and in this way you have the opportunity to select each bit, but of course this means that you can brick the microcontroller if you are not careful.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.