Code Monkey home page Code Monkey logo

simpleneopixeldemo's People

Contributors

bigjosh avatar granjow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpleneopixeldemo's Issues

Don't work on my Arduino MEGA 2560

Hi,

Hi just tried your SimpleNeopixelDemo 'as is' with my Arduino MEGA 2560 and I did not succeed to make it work.

Your code is using PORTB, bit 4, which seems to be the pin 10 on the MEGA. Do you confirm?

When I run the code with rainbow mode, only the first led is lighted and it is strangely blinking. If I remove the wire jump from pin10, all leds finally get a color.
If I plug the wirejump back, nothing change except the first led blinking.
If I remove it, all leds get a new color. The color seems to be consistent with the rainbow cycle.

If I use the official adafruit library everything works correctly.

Any idea of what I'm doing wrong?

I'm on windows 10 with Arduino 1.8.5

Tram frequency issue

Hello,

I'm working with an Attiny85 and I use your code directly into my application code because I have more than 500 sk6812 RGBW to drive in one string. But i'm facing to a weird issue, when I send tram, SK6812 start to display randomly color pattern even if i would like just display only 1 color.
So i have perfom a measurement on tram and ... suprise, I get a 423kHz signal instead of 400kHz... i thing issue come from here.

But, i have set:
-Fcpu to 8000000L
-fuses to desabling clk/8
-internal divider to 1:1
-Calibrate RC oscillaor with Osccal register
And finaly check the output CPU clock on PB4 with a frequency meter (after set the good fuses) and frequency seems to be ok: 8,002000MHz (about)

I know that i have change timer0 parameters for another peripherical, but I thing your code is based on CPU instruction clock, so timer0 doesent matter.

Moreover something strange too, I use _delay_ms() at the begining of my program, and where i set : _delay_ms(1000) and expect 1 Second, i get 1,5 second ! And for 2000ms, i get 3 second etc...

I dont know really where is the problem, maybe my both issues (delay and tram frequency) are dissociated, i dont know...
I will try to run only your code separetly to see if the issue is always here.

Someone have an idea ?

BR
Thanks !!!

Adrien

License file?

Hi! Thanks for the great library and amazing writeup!

Would you mind providing an explicit open source license of your choice on the repository?

Here's an easy license guide to make the choice simple: http://choosealicense.com/

Otherwise people technically aren't allowed to use it :(. The link above has an explanation of why.

Thanks!

updating singular leds

Hi Josh

Just wanted to check my understanding of your code - you must update all leds in the chain each time you call show (which in effect, is just a delay to allow the leds to latch)

The adafruit neopixel library does not require you to update all leds each time because it maintains an internal buffer (3 bytes per pixel) of the current RGB state for that pixel, correct, so when you call leds.show it sends the entire buffer (which is timing data passed down the chain containing state for all leds)

Would it be possible to selectively update individual pixels in the chain with this technique, without a buffer? I am thinking that the answer is no?

arduino uno - doesn't seem to work with USB unplugged!

I have been adapting your assembler code to generate neopixel signals with interrupts enabled between each pixel. The weird thing is - it works just fine when USB is plugged in, yet as soon as i pull USB out most of the pixels go black (with the occasional one brightening up). It's as if with no USB all the timings are too slow. Any ideas?

Otherwise, with USB in, I can now sample analog AND run neopixels from the same Uno. (it's for a visualiser and i need interrupts between bits/bytes).

compilation issue

following error messages were elicited when I attempted to compile the demo program

Arduino: nightly (Mac OS X), Board: "Arduino Duemilanove or Diecimila, ATmega328"

sketch_may20b.ino: In function 'void sendBit(bool)':
sketch_may20b:56: error: '__builtin_avr_delay_cycles' was not declared in this scope
sketch_may20b:66: error: '__builtin_avr_delay_cycles' was not declared in this scope
sketch_may20b.ino: In function 'void show()':
sketch_may20b:126: error: '__builtin_avr_delay_cycles' was not declared in this scope

putting in the following at prior to line 42 fixes same:

#ifndef __builtin_avr_delay_cycles
void __builtin_avr_delay_cycles(unsigned long __n) {
while(__n)
__n--;
}

endif

Demo sketch (SimpleNeopixelDemo.ino) does not compile for some pins with "impossible constraint in 'asm'" error.

Hi Josh,

Thank you for the opportunity to work with WS2812 without libraries.
But, when I try to change the control pin, for example,

// Mega D14:
#define WS2812_PORT PORTJ
#define WS2812_DDR DDRJ
#define WS2812_BIT 1
or
// Mega A10 (D64):
#define WS2812_PORT PORTK
#define WS2812_DDR DDRK
#define WS2812_BIT 2

, in some cases I get a compilation error "impossible constraint in 'asm'".

A similar problem is described in https://forum.arduino.cc/t/passing-port-and-bit-as-parameters-to-asm-block/584236/8 , but, unfortunately, I did not find a solution that I understood there.
I hope for your help, thank you.

Flicker problem..

I used this directly..it work properly...
But I alloted some memory for storing of r,g and b data.... After that send this sequence wise using alloted memory.... Then I faced flicker problem on some leds...

Not able to display all white

First I want to thank you for the great code.

I'm not able to get all white pixels. For example when I call showColor(255, 255, 255) about the first 90 pixels look white, after that they fade to red. (I have a total of 300 pixels)

Same with 255,255,0 (starts with yellow, ends with red) and with 0,255,255 (start with cyan, ends with green).

Is this a bug or just my strip misbehaving?

No _delay_us() available on Digispark ATTINY85

The platform I was working on, the ATTINY85 Digispark clone doesn't have a delay_us() function available. I wasn't really able to find anything that seemed to reasonably replace it.

The good news is that this delay is ONLY used in the show() function, and my application had a frame delay at the end of each loop anyway. This delay was MORE than long enough that I just skipped a show() function entirely.

ESP8266 / Wemos D1 Help?

I'm having a devil of a time getting this to work on my Wemos D1 ESP8266 board and wondering if you might be interested in helping me out :) I tried the original code and kept getting undefined errors relating to "_SFR_IO_ADDR". I tried the SimpleNeopixel library and after sorting "no such file or directory" errors by placing the library files in the sketch folder I'm getting "Error compiling for board" errors. I am a bit of a newb but I'm generally able to follow complex directions... thanks!

Needs of the datasheet

Hey, so I bought some "NeoPixels" from AliExpress, and while they're obviously a Chinese clone, it turns out that they actually do follow the datasheet.

I took this code and put in these values:


#define T1H  700    // Width of a 1 bit in ns
#define T1L  600    // Width of a 1 bit in ns

#define T0H  350    // Width of a 0 bit in ns
#define T0L  800    // Width of a 0 bit in ns

#define RES 50000    // Width of the low gap between bits to cause a frame to latch

Which is what the datasheet says, and now the Chinese clones work. Not sure if you want to do something with this knowledge? Maybe a comment? Maybe if your NeoPixels work with these values, then maybe have these be the thing?

This technique may not work with GS8208 pixels!

GS8208 pixels are in the category of pixels that work with a broad spectrum of control schemes-- they support from 400kHz to 1MHz bitrates, and the datasheet calls for a 3:1 ratio between T1H and T1L (and a 1:3 ratio between T0H and T0L). And I think they're too smart to fall for this scheme. Which is annoying.

Image of relevant bit of datasheet attached.
Screen Shot 2020-11-13 at 10 36 11 AM

The 10us between code I had assumed meant that the TxL time could be up to 10us long, but that doesn't seem to be working.

I'm doing this on an 8MHz Atmega328p. Based on the (working) 800kHz adafruit code, we're looking for these values:

T1H = 875 (7 clocks)
T1L = 375 (3 clocks)

T0H = 250 (2 clocks)
T0L = 1000 (8 clocks)

The asm is, of course, working properly for the TxH codes, but the TxL codes include the loop time, which (having removed that asm code), is a minimum of 21 clock cycles or 2625ns.

If T1L = 2625, then T1H = 6125 (or 7875 if it's really 3:1)
T0H would be 2625 and T1L would be 6125 (or 7875), less the loop time we're at 3500/5250

That's only 114kHz, which is below the minimum 400kHz, and does not work (first LED lights up white when given red...)

My working theory is that we can send either 8 bits or 24 bits at a time, with up to 10us between them. In theory I should be able to get the loop time low enough to at least hit the 400kHz timing, if not the 800kHz. I will obviously post updates here, but I mostly wanted to flag that I was having trouble getting this particular pixel working in case anyone else ran into the same issues I did.

LEDs just go white...

I've got the code compiling fine and flashing onto the board but for some reason the LEDs just go white and never change.

I've tried debugging this and bringing it back to as simple a task as possible.

Even doing a loop where you do this:

sendPixel(255,0,0);
show();

Will correctly turn on the first pixel but it will set it white as well.

doing something like this:

sendPixel(0,0,0);
show();
delay(5000);
sendPixel(255,0,0);
show();
delay(5000);

Which should effectively give you a blink on the first pixel doesn't seem to do that. Writing some debug statements into sendByte I can see it's got the correct values but for some reason the pixel itself is going full white (even when being sent zeroes).

So the question is - have you seen this before? If so is it something to do with timings?

FYI - I am using WS2812Bs from china however they work totally fine with the adafruit library so I know the LEDs are fine... so it has to be something software related.

Demo Request

Hi Josh,

I'd like to thank you for this awesome demo script. I just have a request/question on how to use this effectively. I wish to receive a spectrum dump over the serial line every 8 to 33ms that contains 7 "bins" of spectrum data(integers ranging from 0 to 100). Based on that data I want to generate a waveform/wave effect that "ripples" through the strip. I know this is vague and generic but I'm wondering how to accomplish this as previous methods involved storing a "buffer" of all the values then shifting each value 1 by 1 but that doesn't seem to be valid with your program. I tried using a buffer to accomplish this but it just made the LEDs randomly flash instead of moving pixel 1 to pixel 2 and pixel 2 to pixel 3 and pixel 3 to pixel 4 etc... I've attached a sample of what I'm trying to do.

My Attempt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.