Neuroscience request. The Neopixels happen to be at good wavelengths for optogenetic use. With these lights I hope to manipulate neurons. But the timing must be precise (controlled with TTL (PWM to you all) in on the Arduino). The power should be always maximum (changing the ‘brightness’ is actually turning the LED on and off fast, and your eye smooths over the sensation (flicker fusion)). (The optical power is very important as well, but I can control that simply by moving the LEDs away from the tissue). And all LED’s will always be only one color, and that color will only be Red, Blue, Green (or white, but that is for experiment set up).
So, if a pin goes high, turn on all 40 LEDs to the set color. If it goes low, turn it off.
But I cannot seem to drive the LEDs fast enough (1 ms on, 1 ms off). It seems that because I require such basic things, maybe I don’t need the whole library. Does anyone have any idea on how I could strip down the library to make it even faster and more basic?
Neopixels require 30 microseconds per led to refresh. This is not a limitation of the FastLED library, it’s a technological property of Neopixels (WS2812B).
Your setup then takes 1.2ms at minimum only to display the change, without factoring in the code.
If you don’t need individually addressable leds for this, you could use a strip that display the same color on all the pixels. Or use clocked leds such as APA102 which have a very high refresh rate.
Another thing about Neopixels is they have their own PWM control built-in and that is about 400 hz. I do not believe that these LEDS will behave well when you update the data faster than 400 times a second
As it was pointed out, you do not need individually addressable pixels. What you need is RGB (or RGBW) LED strip, something like this:missing/deleted image from Google+
You can control such a strip with any cheap microcontroller (such as Arduino) and 3 MOSFETs, one for each color. An example circuitry is here: https://learn.adafruit.com/rgb-led-strips/usage
And in case you already have TTL level inputs for each channel, you don’t need a microcontroller at all – just use MOSFETs as switches to drive individual colors.