I recently designed my own LED board, It has a atmega328p-au with 24 WS2812 LED. The board is capable of being powered by either USB or other power sources. I powered it via the 5V on my nano, and it works great with bright greens and blues and reds! I then switched over to USB power where a lot of the LED were flashing and glitching and not working properly. I am guessing that there is either not enough voltage or current being sent to the LED.
The USB 2.0 port on my laptop by USB standard can supply 5V at .5 Amps. Is the nano capable of supplying more than .5 Amps, even though it is being powered by my laptop?
I also inserted the circuit schematic below. The LED are powered by the RAW POWER flag, and get data from the DATA OUT flag. I couldn't fit everything into one image.
The USB 2.0 port on my laptop by USB standard can supply 5V at .5 Amps. Is the nano capable of supplying more than .5 Amps, even though it is being powered by my laptop?
I doubt half an amp is enough anyway.
The Op's image:-
I am not quite sure what your diagram is supposed to show; it has a few glaring mistakes and does not resemble an Arduino Nano. So your description of your problems may well demonstrate design faults.
So, all sorts of observations:
The "USB standard" may well indicate a supply of 5V at 500 mA but many USB ports are not so limited and can supply considerably more.
24 WS2812 LED could draw 1.3 Amps at full white (with a minimum at black of 24 mA) and the USB port may supply this or maybe just an Amp. You may never ask it to do so, a single primary colour on all LEDs would be limited to 500 mA but it is clearly dodgy.
You show the USB connector as "raw" power and feed it into a 5 V regulator. That makes no sense, if you feed 5 V into the regulator it cannot possibly feed 5 V out to your "clean" power. And unless you provide a heatsink, it may heat up in the process and cause all sorts of odd behaviour - like the regulator on the Nano or UNO.
You show pushbuttons connected to whatever passes as "5 V" but no pull-downs so will not work properly at all. Pushbuttons should connect to ground and if not connected by any significant length of wiring or external to the PCB, can use INPUT_PULLUP without an external pullup.
That is probably more than sufficient things to foul up this project.
@Paul__B The diagram is the circuit I designed, It is not a nano. I am just using a nano as an external power source. As far as other circuit issues, I will fix them since I do plan on ordering more boards.
I do appreciate the circuit critiques, but that doesn't really answer my question as to how to nano can supply enough current to sufficiently power the board, while my laptop can not. Is there any other circuitry I am missing?
but that doesn't really answer my question as to how to nano can supply enough current to sufficiently power the board, while my laptop can not.
Are you saying that your nano is powered from the laptop and then powers your circuit and that is fine, but when the laptop powers your circuit directly it can not?
We need a diagram that actually illustrates how your system is set up in order to make sense of the question.
yes. The circuit is getting its power from the 5V from the nano, the nano is plugged into my laptop. It is all glitchy and does not work well when the circuit is plugged directly into my laptop.
I took a USB battery pack that can supply 2.1Amps at 5V and plugged it into the circuit. The LEDs still were glitchy. Could the power coming from the battery pack and the laptop be causing noise in the data line? If you look at the circuit up top, the DOUT flag goes directly into the data in pin of the ws2812.
Well that doesn’t make much sense. I would correct your problems with the switches in the circuit first as that is more likely to be the direct cause of your problems rather than the power supply itself.
Could the power coming from the battery pack and the laptop be causing noise in the data line?
No.
The problem is likely to be one of grounding and earth loops than anything fundamental. Either of those circuits should work if everything else is fine. When things are not fine, like your push button switches it is then this is likely to be the cause of intermittent operation.
I would also put a 0.1uF ceramic capacitor across C4 & C5 to help with high frequency stability. And while you are at it put them on the power pins of the processor as well.
P.S. not a terribly helpful diagram, I was expecting more of a schematic showing what is connected to what and through what pins rather than a floating arrangement of pictures with arrows.
When you power the circuit using the Nano, you said you were using the 5V pin on the Nano, I think, and that you powered the LEDs directly with that. But how were you powering the circuit, exactly? Through the "raw power" or "clean power"? And when powered directly from the laptop, how then?
The 5V output from the Nano, when powered through usb, is not 5V. It's about 4.7V, because of a diode on the Nano designed to protect the laptop if you connect the Nano by usb and power the Nano from an external power supply of at least 6.5~7V.
If you power your circuit from that 4.7V, your ams1117 regulator will drop a further 1.3V, so your atmega's output pins will be at best 3.4V, and the LEDs receive the 4.7V power. So the data signal is around 72% of the supply voltage.
When powered directly from the laptop, the LEDs receive 5V, but your regulator still drops 1.3V, so the data signal is around 3.7V, and the data signal is around 74% of the supply voltage.
I can't explain why 72% works and 74% does not work. But I think you are lucky that either works, because the LEDs probably need a data signal which is at least 80% of the supply voltage. Plus you are lucky that the atmega chip runs correctly with a 16MHz clock at those voltages. In theory it needs 3.8V minimum for 16MHz.
So the solution is to power your circuit by connecting the 4.7V from the Nano or the 5V from the laptop directly to the "clean power", bypassing the ams1117 regulator. You only need to connect to the "raw power" when powering the circuit from an external supply, which must be at least 6.3V. If you do that, 6.3V will be too much voltage for the LEDs and damage them. If you connect the LEDs to the "clean power" and connect the external 6.3V power supply, the ams1117 will not be able to provide enough current for the LEDs and it will be damaged. Your only solution to that is to use an external 5V supply, in which case the regulator is not needed at all.
@PaulRB Thanks for the advice, and the analysis. Should I drop the voltage regulator all together? I put it there to prevent the circuit from breaking if someone plugs it into a power supply that provides more than 5 volts. Also should the LEDs be powered by Clean Power just like the microcontroller or should the LEDs get their own power source, maybe a switching power supply?
That is what both I and PaulRB have been telling you.
You have to decide how you are going to power this. If you have 5 V, you power it (everything) with 5 V. If you have a power source with a higher voltage, you need a proper switchmode "buck" regulator capable of regulating 1.5 A or more, to drop that to a regulated 5 V, not an AMS1117. It is one or the other.
In fact, in your case, what you have termed "clean power" is actually "grubby power" or some similar term I won't mention.
I have decided it will be powered by my laptop, nothing else. What would be the best way to power the LEDs and the microcontroller if I am powering it off of my laptop? Someone suggested a switching power supply for the LEDs
Someone suggested a switching power supply for the LEDs
It is only necessary to use a switching regulator if the supply voltage is higher than 5V, which if you are using the USB from a laptop it won’t be.
So you simply run the power into your circuit and the LEDs.