Go Down

Topic: [solved] ATTiny85 and Adafruit Neopixels not working (Read 4945 times) previous topic - next topic

sonyhome

I decided to try lighting a LEDstrip with a DigiSpark Tiny85 and it does not work.

*5V/1A USB power bank (spliced a USB wire to tap the +5V and Gnd
* DigiSpark TINY85 (8K flash, 512 sram?, 16MHz)
*Adafruit neopixels, 16 LED strip (WS2812B)

I wired the power to not feed through the tiny board so the power bank feeds LEDs and Tiny85 directly.

Wiring:

Tiny85:
* 5V on Vin
* Gnd on gnd
* LED data on pin 5 (P5, D/A)

LEDs:
* Tiny85 pin 5 to Din
* 5V to +5V
*Gnd to Gnd

USB wire:
*+5V and Gnd are red and dark gray wires, and map to the extreme left and extreme right prongs of the USB.
The other two wires are white and faded green.

Results:
* Tiny85 power LED turns on but seems to turn off  after 20 seconds
* LED strip blinks very briefly on power on but then nothing.


I have tried a few adafruit example programs, shipped with the adafruit library, just tweaked:
* to use pin 5
* to light only 5 LEDs.


What could be wrong?
*If the board's frequency is misconfigured to 8Mhz how can I fix that? And would it screw up LED lighting?
* Could the pin numbers not match the board printout?I tried all pins and I've been able to turn on/off the on board LED with a switch on a pin i programmed.
* I picked pin 5 because it seems the less used one

PaulRB

I have run short strings of Neopixel/ws2812b leds (up to 10) with tiny85 on breadboard at 8MHz, so the clock speed should not be the problem. What does your multimeter tell you is going on, while the digispark's power led is on, and after it goes off?

runaway_pancake

* Could the pin numbers not match the board printout?I tried all pins and I've been able to turn on/off the on board LED with a switch on a pin i programmed.
* I picked pin 5 because it seems the less used one
Physical pin 5 (IC pin 5) is D0, Digital 0.
Is that how you've written your sketch?

"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

sonyhome

#3
May 11, 2015, 09:44 pm Last Edit: May 11, 2015, 09:54 pm by sonyhome
A simpler setup fails:

power pack + board only:
It shuts down after a 5 to 7 seconds

same goes with any sketch, like the tiny85 blink led "Start" sketch (onboard led blinks ok 5 time, once a second, untill power goes off). The voltmeter says power drops from 5V to 1V on shutdown and the power bank status light turns off too.

I don't know why... The arduino board works fine with the same usb power bank.
Could it be the load is too small so the power bank shuts down to avoid drain? should i find a 10Kohm resistor and put it on the 5V input to create a drain?

the board stays on when plugged on the pc.

measuremrnt while powered via usb onboard connector:
- 4.78V on 5V pin when plugged on pc
- 4.88V on 5V pin when on, with power bank
- 0.29V on 5V pin when it shuts down
- adding a 1000uF cap between 5V and gnd doea not change behavior
- same happens on two tiny85 boards
- uno and nano boards do not have that issue

runaway_pancake

"usb power bank"? like for charging phones with?
they require a minimum draw/load (at least, the one I have does)
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

sonyhome

thanks for confirming. I should have googled usb power bank minimum power draw. derp.

it seems a 50 to 100mA min is needed to keep them live, or they turn off their dc converter.

So i can put a 1/4W 100 ohm or a 1/2W 50 ohm resistor, or make sure enough LEDs are on to draw that much.

sonyhome

so back to my original problem...

i tried to use output 1 and 5. when i use 1, the onboard led attached to it is dimly lit, telling me that the attiny is indeed sending data.

since the board pins are labelled 0-5 i will assume they correspond to port B labels, not chip pin labels.

now i wonder how i can detect what frequency is programmed for the chip. all i have is a status led for display.

runaway_pancake

#7
May 12, 2015, 03:39 pm Last Edit: May 12, 2015, 03:40 pm by Runaway Pancake
I don't have one those.  PB5 is a Reset, I think that I would leave it be.

"since the board pins are labelled 0-5 i will assume they correspond to port B labels, not chip pin labels. "
I would not be satisfied with that; having no other information I would get the ohmmeter and trace the IC pins to those "P"-labeled terminals.

I didn't find any solid data on your digispark device, other than it's some crowdfunded thing, perhaps the crowd can supply more information.
Have you ever worked out the rudiments of this thing, validated any assumptions, done some blinky stuff to confirm what's what? Or are you just shooting in the dark?

"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

sonyhome

i forgot that i did trace 5 to pin 1 (dot mark is on it, top left of chip). lemme just do it again:

voltmeter says...

1 pb5
3 pb4
2 pb3
7 pb2
6 pb1
5 pb0

4 gnd
8 top pin of voltage regulator chip

Vin bottom pin of regulator
5V top pin of regulator

runaway_pancake

8 MHz is the internal RC oscillator freq.  Maybe I'm not looking at the right pic, but I don't see an on-board xtal or anything for this "16 MHz".
The ATtiny85 datasheet shows options of 8MHz and 6.4MHz for the internal osc.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Riva

The Digispark IDE shows 16.5MHz for the normal Digispark and I think the NeoPixels need precise timing to work so maybe the speed difference is enough to stop them working.
Don't PM me for help as I will ignore it.

DrAzzy

#11
May 13, 2015, 08:12 pm Last Edit: May 13, 2015, 08:13 pm by DrAzzy
ATtiny85 can also run at 16mhz without an external crystal using the PLL clock option, using the on-chip PLL to jack the 8mhz up to 64, and then dividing it by 4 to get ~16mhz for the system clock. See datasheet section on clock sources for more information - this is an exotic option, only found on a few parts (sadly), but the '85 is one of them.

And yeah, have you even checked that the speed is in the vague ballpark you expect? The first sketch you upload to an MCU should always be blink with a known speed, so you can catch it if the speed is way off.

Some cheap, low end USB power banks don't stop supplying current when the load is very light. Gotta buy and test to find out though - I don't recall anyone ever posting a list of known good ones.

What library are you using to control it?
I know that the ATTiny@8mhz can be used to control WS2812B LEDs. I have controlled strips of them with it using FastLED 3.0.1 - note that I was building w/1.0.6, not 1.6.x, though I doubt that is the problem.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

sonyhome

the led blinking idea is good, i will try it. i just need to code the wait loop properly. I was more looking for a direct way :)

the attiny85 can run 3 frequencies with internal clocks, up to 16mhz with config, and can boost up to 20mhz i believe with an external crystal. if the frequencies are off it will be the issue. i expect the board to be configured for pll/16mhz, but i wanted to check that. however i dunno how to read/write those config registers in C.

the digistump modified arduino ide comes with a (broken) ws2812 example, that i tried, as well as adafruit's neopixel library, neither work. I tried all the pins. I can try this suggested library too.


For the USB powerbank, it is solved: it needs at least a 100ohm load or it turns off.

Riva

What exact model DigiSpark do you have (supply a link if possible). I have one like the link I supplied in #10 but have not soldered headers on yet. If it's the same I will take it into work over weekend and try it with a neopixel strip (if I can find one)
Don't PM me for help as I will ignore it.

sonyhome

I have finally managed to get an example working on pin 1 today using a different library than adafruit.

I also figured out how simple the keyboard library is to use to print out infos. F_CPU is set to 16.5mhz.
However i dunno if that is the real frequency because i can't read the fuses. Maybe i will be able to when i become mpre familiar with the arduino platform.

i did try to blink a,led using a loop i timed on the uno, and a portion that uses a sleep, to get a 50% led duty cycle. the board led is on pin 1 on my board. result is the cpu is at 16mhz ish because it blinks the same on the uno and nano, as the attiny.

so this is solved on my side. If there are questions i'll try to answer. I will also try to get adafruit to work, but their asm in the library is full of different versions and idk which one was compiled in. most likely the wrong one causing it to not work... probably a missing architecture define... the library states that at 16mhz it can handle 16.5 too.

Go Up