I have been attempting to control my WS2812B led strip with my ATtiny85. I use an attiny programmer similar to SparkFun and it works fine with the blink sketch with a normal led. Even programming through Arduino doesn't fix the issue, so I know it's not a programming issue. When I use Adafruit's Neopixel library to control my led strip, nothing happens. I've never once gotten the strip to light up. Here is my wiring:
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 4
#define NUMPIXELS 30
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
pixels.begin();
}
void loop() {
for(int i=0;i<NUMPIXELS;i++){
pixels.setPixelColor(i, pixels.Color(0,150,0));
pixels.show();
delay(delayval);
}
}
It doesn't matter which pin the led strip data pin is connected to on the attiny. It doesn't have to be 4 specifically for my project.
Oh, and my power supply is 5v 2a, in case that matters.
No, it isn't. You are using a little board with a linear regulator that has a typical maximum current spec of 500mA, but it is actually limited further because you're applying 9V in. Assuming a power dissipation limit of 500mW, this means you can draw something like 0.5W / 4V = 125mA from it before the regulator starts overheating and will enter an infinite startup-shutdown cycle.
Given the use of 30 pixels and assuming somewhere in the vicinity of 50mA per pixel if fully lit up, you'd need a power supply capable of sourcing at least 1.5A to safely use that strip. Your breadboard power supply is under-dimensioned by more than an order of magnitude!
Where do you get the "9V" from? My interpretation is that their power supply is 5 V, meaning the breadboard rail will be a 5 V minus the dropout of the linear regulator.
Regarding the current requirements, my suggestion would be to start simple by changing this line:
True. But even then it is limited by the lack of heatsinking of the regulator. This "breadboard power supply" suffers from the same limitation as the Arduino UNO and Mega 2560. You should not attempt to power it from the "barrel jack".
You can power it by feeding into the USB connector (but you need a "gay" adapter cable ). Even that is not going to work here because the ATtiny adapter is plugged into it!
That said, the fact that the LED strip does not even flicker suggests that the ATtiny is not clocked at a suitable speed. It cannot be 16 MHz because there appears to be no crystal present!
That there says "whatever comes out of that little linear regulator board is not getting anywhere near 2A ever". It does go into the led strip though. Oops.
That is my suspicion as well. I am not sure how this works with ATtiny85 though. can you actually connect an external Crystal ? Ah yes looking at the pinout i see the pins marked 'xtal' But when i selected the board in the IDE, the options for 'clock-speed' do not contain 'external' so i am not really sure how to select it.
If the fuses are set correctly, it might actually be OK, An ATtiny13 can control WS281x strip, and it does n ot need an external clock for that. But then still one should select '16MHz' not the default '16.5MHz' since that is not supported by the Adafruit Neopixel library (this may actually fix it...)
This does all depend on which core is being used of course, and since i don't think anyone asked., let me be the one @lonelyx Which core are you using ?
Nope, they are rated at a maximum of 600mA (or maybe 800mA) but they do (i figure 1 of them is a 3.3v version) have heatsink on the PCB.
Just to be on the safe side, i suggest to connect only 1 or 2 LEDs for now.
I'm not sure I were looking at the same thing, but the metal part sticking out of the 1117's is just the tab. I don't see a heatsink on those PCB's and neither is it common to find any in combination with regulators like those. 800mA - no way, 600mA also not with 9V in. 150mA on a good day and not for too long is all you can expect; that's already 600mW at 9V in 5V out.
I am looking at the copper-fill which surrounds the regulators, assuming that that would be connected to that tab. Any sensible PCB designer would do that. Though hard to see, and a little speculative, but i think i can make out that about 40% of the top layer is in a single fill around what must be the 5v version (near the USB plug) The other area probably for the 3.3v regulator is much smaller, but i suspect that would get it's Vin from the 5v. The idea of the SMT package is to use copper fill on the PCB as heatsink.
The normal rating for that package is 600mA, but i would agree that the heatsink is to small for that, but i am confident that 300mA or even 400mA should be no problem (mind you in both 5v & 3.3v combined if the 3.3v get Vin from 5v) speaking from experience. Although i would also use any surface on the back of the PCB.
Either way, the whole thing should be able to power 1 or 2 LED's 30 maybe not, though ws2812B's are quite power efficient.
It turns first one LED on and adds to it. Never bothers to empty the buffer at all, but initially it should work.
Not sue what happens to 5v LED's at low power, but 12v LED actually start to change color at lower voltage, but still keeps working. If power would be the issue, the PCB should heat up until it completely shuts off when the regulator overheats. This is not the case (for now)
The copper fill surrounding the regulators is in fact, a ground fill which is generally the default for layout software. In case you do not recall, the tab is not the ground on these regulators, rather the output, so it takes very deliberate design - and adequate space - to provide heatsinking.
So the copper pad for the tab is exactly that - barely half a mm larger that the tab itself. How can I be so absolutely sure? Well, half a dozen of the exact board have been sitting on the desk in front of me for some months now.
As I (repeatedly) point out, these "breadboard power supply" modules have extremely limited uses (and thus, still sitting here ), not for any project requiring more than a hundred milliamps or so (which rules out quite a lot) unless powered "back" through the USB connector. Quite inappropriate in this situation here.
So they should, since the WS2811 has a shunt regulated 5 V supply for the chip (which itself requires about 1 mA) provided by a separate resistor to the supply.
Well that's pretty useless, yeah i know that the tab is actually connected to Vout. All i can say is then that it is a poor design, and i would rate it a t approx 120mA (with a TO-92 package it would be 100mA, the tab has to count for something) Anyway in that case i would recommend to solder a heatsink onto the tab, that should make it a bit more useful.
I know the ws2811 design, these are ws2812B's Thing is the ATtiny should able to keep up 16MHz as long as 4.5v is provided.
I may just be on an older version. I have Spence's core (or what he is maintaining) installed.
The red wire goes to + and white to - in your picture, usually by convention it is the other way round. Cannot see where it goes afterwards, but I’d double check plus goes to plus and minus to minus.
Yes, he has the wrong colours, but they swap at the JST connector so positive goes to red on the LED strip wire and negative goes to white, which is correct.
He appears to have the old double fake going. They are reversed at the board and reversed again at the connector, aggravating but correct. However I just bought some fake 8X8s that the DIN is the DOUT and the reverse, so as you say, who's to tell?
Obviously, I returned the 8X8s.
Ah yeah, quite common, I had PCBs where on one side TX RX markings were swapped around, I had amplifiers that had +- marked for speakers incorrectly so you would end up with out of phase sound, good job it was instantly recognisable, boards where left and right headphones out were swapped around.
I have a Mega where on the silk TX & RX are reversed for Serial1 (it was cheap)
I have made mistakes on the silk of PCB's i designed. It happens.
Cause can be that the strip came with cable and connector that only fits another one that is reversed in colors.
As a rule i try and prevent this sort of thing, and throw plugs like that out in the rubbish.
If you connect the polarity the wrong way round, they will probably never light up anymore.