Arduino LED flickering problem

I have that 4 identical figure lights. And they haven’t got any flickering problem at the time. And their original circuit diagram is on the figure-1.

And then I want to add bluetooth feature to them with arduino. The circuit diagram I used is on the figure-2.

As a power source I used 5v 2.1A USB adapter (I measured it with multimeter and results are 4.3v-4.9v and 2.5A) connected to the 4 port USB hub. Then I connected those figure lights to the USB hub.
And I having this flickering led issue (LEDs are kind of fluctuating) even though I connect them directly to the USB charger one at the time.

	void setup()
 	   pinMode(LED_ARDUINO, OUTPUT);
	void loop() 
	  if (BTSerial.available()) 
	    char cmd =;
	    if (cmd == 'A') 
	      digitalWrite(LED_ARDUINO, HIGH);
	    if (cmd == 'a') 
	      digitalWrite(LED_ARDUINO, LOW);

Common mistake. You show the power connected to “Vin”.

Do not use “Vin”, it is basically useless for most purposes.

You have a Nano - you connect it via its USB connector.

Where are the series resistors for the LEDs? You must not attempt to draw more than 30 mA from a Nano pin.

Your connections to the Bluetooth module are completely wrong. I trust you did not **actually** wire it like that. :roll_eyes:


You are driving 6 LEDs with a digital output, which should not be used as a power supply. It can drive maybe one LED but not much more. The maximum current before damaging the output is 40mA.

One solution is to use a transistor controlled by the digital output

OK then I gonna connect the power and ground through the USB mini socket.

So about the resistors, I didn’t touch anything on the original LEDs wiring stuff. I mean I just cut the power and ground wires from the battery then I connected them to the Arduino. So they probably used different kind of LEDs from we usually used for Arduinos I guess, but it was working correctly with the double 1.5v AA batteries before. And it did not harmed LEDs for weeks except the flickering problem after with my Arduino and HC-05 extension :laughing:

For HC-05 connection I used this diagram as a reference:

I hope, I didn’t make it wrong. Is it just wiring diagram wrong or I just did it wrong :sweat_smile:

Does it harms LEDs if I connect LEDs to the 5v pin and connect ground pin of the LEDs to digital pin so that way I can have control over the LEDs? does it makes any sense at all? That’s just my hobby so I don’t have a strong knowledge, sorry :grimacing:

Yes, those LEDs will operate from a 3 V battery.

But the Arduino is not 3 V and its pins cannot safely supply more than at the very most, 40 mA.

It most certainly will not harm the LEDs. It may well damage the Arduino though.

That diagram is correct, but your first diagram shows something totally different. :astonished:

Ok! I had a similar issue with my lighting I did on an R/C car! Is it possiable for you to get a few
relays? is this a space limited project? 'Cause I recommend using relays since they don’t have any flickering!

Yeah actually, I’ve done a bluetooth controlled 10w lamp with the help of relay and it doesn’t have any issues at all.

No it’s the same thing, same limitations, you cannot sink or source more than 40 mA absolute max (15-20 mA recommended max) from a digital pin, they are made for signalling, not driving

Yeah you’re right, I didn’t take that into account, I should have use resistors.

And about the diagram again, I checked my wiring stuff and my wiring was OK but my drawings totally not, sorry :roll_eyes: :grin:

I recommend getting a few cheep relays off Amazon or somewhere and use those! It is much more reliable!

Ohh I get it now, that’s much more clear, thanks

1 Like

Yeah, you was so right about that, I have tested it.

I gave the power to Arduino from the USB mini cable which is connected to the USB hub then the USB charger.

Yep, fluctuations gone and LEDs are even got brighter.

And that’s my last question it’s about resistors. These LEDs seems different to me from the LEDs I used with Arduino. So how do I know how much ohm resistor I need?

What are you going to power the relays (+LEDs) from… same problem.

That will depend on how many LEDs you propose to put in parallel - if you still want to drive them directly from an Arduino pin.

If you are just using the LED string, a single 100 Ohm resistor between the Arduino pin and the LED string will be appropriate. The LEDs may be somewhat dim, but you will be doing the important thing of protecting the Arduino.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.