W2812s strip not following script when arduino is supplied with 9v battery...

I am working with the W2812s, a strip of 5M. I am writing my scripts on my raspberry pi and uploading them from there. When I test my scripts while the arduino is being supplied by the pi, all works perfect and as expected.

When I attempt to run the same script but supplying the arduino with a 9V batter, sometimes maybe for just one iteration of the loop function it runs as normal but after that it goes crazy. Changing colours blinking on and off when it is not supposed to etc…

The project I am working on is for a friend and the strip is going to be incorporated in clothing for a fashion show so there is no other option but to use a battery.

So my question is has anyone else encountered a similar problem and found a solution?

My set up:

The three inputs from the arduino go into my bread board, I have a 300 ohm resistor from the data input between the arduino and the strip. I also have a 100uF capacitor across live and ground between the arduino and the strip. I am applying the 9V through the external power supply port.

I have read in other posts that battery voltage can be less reliable being DC, but from what I read I assumed that the capacitor would solve any issues with that. Which leads me to believe it might be something else.

I would greatly appreciate any helpful advice.? I am worried that the project could be in trouble if I cannot solve this… Thanks for taking the time to read my post.

Which Arduino. Any other powered sensors. Are you using a common/cheap 9volt battery. A common 9volt battery most likeley can't supply the current needed. Only a fresh alkaline or NiMh battery could (for some time). How are you powering the LED strip. Maybe you could supply the Arduino from that battery with a D/DC converter. Leo..

Hello,

Your description of the circuit is a little ambiguous. Can you provide a schematic diagram?

For example, it sounds as though you may be attempting to power a 5m strip of neopixels with a pp9 battery via the Arduino's 5V regulator. This would be like powering an F1 car with the engine from a lawn mower via an elastic band. Please tell us this is not what you are doing.

Paul

Firstly thanks for the swift replies. And sorry to break it to you Paul but I think that is what I was doing. I only usually power the strip from the arduino which is supplied by my pi. Right now I haven't got a diagram but could supply pictures.

I have been developing the script and so never needed to use the external port. It is only now that the script is nearly finished I am looking to the power. I am sure I am probably making many mistakes but this is new to me as I have no experience with this.

I foolishly assumed it would just be a case of supplying the arduino with the battery and that would take care of the rest, as I have gotten use the pi's supply doing that. As I read your reply I remember seeing circuit diagrams online where the batter power is split, with one side going to the arduino and the other going to the strip. Taking a ground also from the arduino to the strip.

So I take it, that is how it should be done? Have you any advice on how to do it? What would you suggest would be the best way to acheive my goal here.? Would I need 2 5V batteries, one for the arduino and one for the strip.?

And to answer your question Leo,

I am using the Uno, I have no other power sensors. I am using a duracell 9V alkaline battery, pretty common. And I am sure you have already gathered I overlooked a supply for the strip.

Thanks again and sorry for the ambiguity, I will try my best to answer as clear as I can.

5V AC adapter ---> VCC on WS2812 strip ---> Arduino Uno 5V

AC adapter ground ---> WS2812 strip ---> Arduino Uno ground

What to do depends on the length of the strip. The 5volt supply of an Uno shouldn't be powering more than 8 RGB LEDs.

If the strip is longer than that, and you want to go portable... Then the best way is to use a 5volt buck converter to power both Uno and strip. Current capability depending on the length of the strip (number of LEDs). Then you can use a battery with a higher voltage (2C LiPo, 3C Lipo, 8x AA) economically. Leo..

A few questions so we can do some maths. How many leds in the 5m strip? Most are 60 leds per metre, so that would make it 300. How long do the leds need to run during the fashion show? Lets say 10 mins. How large a battery can be concealed in the clothing? Could multiple batteries be concealed? What is the maximum led brightness you need to use and what colours?. If the show is outdoors you may need the max brightness. Indoors, maybe less is needed.

In ws2812 strips, each led can draw up to 60mA. 300 leds would be 18,000mA or 18A. To provide this much current for 10 mins, you need a battery with capacity of 18 x 10 / 60 = 3Ah or 3,000mAh.

An alkaline pp9 battery has a typical capacity of 500-600mAh. Theoretically it would only last 1 to 2 mins. But in practice it can not supply not much more than 500mA, enough to run fewer than 10 leds.

This all sounds like a lot of current and capacity is required. But that is assuming the maximum current draw the strip might need if all 300 leds are showing white at maximum brightness. If all the leds were showing red, green or blue at maximum brightness, that would only require one third as much current. If only one led out of 3 is on at any instant, that would also reduce the current required to one third. Combinations of colours and flashing patterns can reduce the current dramatically.

I suggest you should take some current measurements with your desired patterns running, using a multimeter, to see what the average and maximum current draw really is.

Again I want to thank you guys for your help.

Paul, the strip has 30 pixels per meter (150 total) and never is the whole strip fully on any colour let alone all white. So I am confident the Math for the current draw is a lot more sustainable. There are different designs on the script and so far the most pixels on at one time is 23.

That number may rise but it will go no bigger than 40. I was aware of this being an issue, as I read it can burn out the Uno or even more likely destroy some pixels on the strip. I made my friend aware early on and they were happy to fit that around they're design.

The colours we are using are mostly pink, which is consisting of full brightness of red and 1/3 brightness of blue. We are also using full brightness white in parts, with 23 pixels being most on at once. So that would amount to our highest draw being 23 * 60mA = 1380mA. We may be drawing up to 40 pixels at once, but that will mostly be of the pink mentioned above.

So the pink above at 40 pixels, should probably draw approximately, red --> 20mA + blue --> 1/3(20mA) = 27mA, then 27 * 40 = 1080mA.. Which technically by your suggestion would be nearly covered by 2 pp9 batteries. And that is if the number rises, the effect's we are going could be described like a snake (although it never has been before :) ) as a new pixel turns on the pixel furthest away (23 pixels) will turn off.

So there is a bit of room to conceal the battery, but I was hoping to use no more than two. If that was wishful thinking of course I will wise and meet the needs of the project.

The lights will not need to be on for any longer than 3 minutes. But if there are suggestions for longer I would also like to hear them.

I hope I have covered all your questions. I currently have not got my multimeter but will post results as soon as I can. Can I ask you another question, if I could use two pp9 batteries have you any suggestions the the best way to solder the jumper cables from them to the Uno / strip.?

Maybe this could work. Four rechargeable NiMH AA batteries for the LED strip, and a 9volt alkaline battery for the Arduino. Leo..

Wawa: Maybe this could work. Four rechargeable NiMH AA batteries for the LED strip, and a 9volt alkaline battery for the Arduino. Leo..

I was thinking two packs of 4 NiMH AAA cells. A pack connected at each end of the strip. This should provide enough current for your patterns and plenty of capacity, and still reasonably easy to conceal. One pack could also supply the Arduino. A Nano would be easier to conceal than an Uno.

Example from eBay

If supplying the Arduino from one of these packs, do it through the 5V pin not the Vin pin.

INPORTANT: do not use alkaline/non-rechargeables like this. The voltage will be too high (6V vs. around 4.8V) and could damage the leds or the Arduino.

Thanks Leo and Paul, I feel a lot more confident now. I really appreciate your help. I will implement your ideas and let you know how it goes.

tl;dr

When I attempt to run the same script but supplying the arduino with a 9V batter, sometimes maybe for just one iteration of the loop function it runs as normal but after that it goes crazy. Changing colours blinking on and off when it is not supposed to etc…

the grounds of the arduino, the battery and the ws2812 are all connected together?