Adafruit Neopixel Library- only the first 16 LEDs respond
When something works, but not completely, it's often due to power issues.


Embedded things, microcontrollers/Arduino are fairly robust and "logical".
Hence, if your Arduino program works today, it'll work tomorrow.

Analog devices, or electricity is (in my eyes) often a bit vague. A chip can get enough power to run, but not enough to work properly.

The NeoPixel

Adafruit has an extremely elaborated tutorial/userguide.


  Powering the NeoPixels


This also seems to fit your problem.



You could try powering the strip from the middle.
Since your voltage isn't stable, your amperage might not be as high and the resistance may be a little big. It's actually quite impressive that it works.


  Each NeoPixel can draw up to 60 milliamps at full brightness.


2000mAh does not mean it can (always) deliver 2000mA. It depends on the "C" or discharge rating of the battery. So if your battery is rated 0.5 C it'll only be able to supply 1000mA (for 2 hours).

60*21 would be well over 1000mA, actually 60*16 is just below 1mA, so this would fit your problem.


  The voltage of a battery depends on how much charge it has.


Check google for: "LiPo voltage drop"


  If all else fails


There is a chance that that particular LED is broken. The signal will not continue to the other LED's and thus the light of the strip will end there.
Try to drive the LED's behind the LED that fails. (With the power supply closer).

I'm also not sure if you can supply 3.7V and then use 5V logic. Things like that would often break a microcontroller (when running on 3.3V, you usually can't receive 5V?)