Controlling several groups of LEDs together

Thank you!

About adding up the Vf- if I have one string with 4pcs of 3.2v LEDs - the total is 12.8v while the arduino board outputs only 5v. What should I do?

I'm a mechanical engineer not electronic engineer so i'm not familiar with circuit design at all.

It does not bother me. You broke the rules, and you blame me for your actions. When I break the rules, I accept the results of my actions.

3 Likes

It's just a post in a forum.. if I could delete it by myself I would. Trust me..
Thank for your help, now if you can't help with the issues please stop spamming this post

You are welcome. I am not spamming this post, I identified a correction.

Relays and power supplies...

Thank you for the example.
How can I preform the fading in and out groups? As I know relays are only for on/off and can't control the current.

Guy

Fading would need voltage changes over time. PWM can be used (from the Arduino).

I do not know how to do it with a resistor, capacitor circuit - but know the larger the resistor, the slower the charge/discharge, and the larger the capacitor, the longer the charge/discharge.

Hey all
I've played a bit with the WOKWI and the codes and managed to control the LEDs as I want.
For now I will use only one main ON/OFF switch for turning the whole thing on.

A few questions:

  1. I want the fading LEDs do not fade to zero, but maintain on low brightness on the lower section. I've tried to play with the array, but without any luck.
  2. How can I determine if the total current on each output is ok and the board will handle it?
  3. The constant LED on pin 13 seems to not being fully bright - how can I control it? it should be a beacon.
  4. I see that the Arduino simulator does not take into conisidration the current limitations. How I can calculate the resistores depending on the voltage each one need?

Thank you
Guy

You are fading over 256 steps using a lookup table. The table gets down to some very small brightness values.

You could loop over only that portion of the table that is bright enough.

You could change the table so the 256 values varied only between a minimum and a maximum of your choice.

You could add to any table value some minimum brightness, just make sure to limit at the bright end so the value is never greater the 255. This last one would make a long(er) period at the maximum, so the LED would get bright and then not change as it flew along the roof, so to speak. That might be visible and undesirable.


More likely @xfpd noticed and bothered to mention it. If I had noticed, I might have bothered myself. Often we don't even involve you, instead choosing to "rat you out" to the moderators. And let them decide we right, this should be combined.

Why it is a problem: it is dismaying to ask a bunch of questions for the 2nd (or Nth) time, or to provide detailed answers, only to find the same ground has already been covered.

Even if you think you are on a new sub-problem or idea w/ you project, the context is important. Very often, you will see if you read these fora, the OP doesn't understand a problem well enlugh to decide what to say and what to leave out. Sometimes getting a clear picture is an excruciating multi-post group effort. Imagine finding such effort had already been expended elsewhere…

So take it personally or not. It isn't personal. To a first approximation, it is usually best to continue with the original thread, or now that they have been combined, this complete thread on your stuff.

a7

3 Likes

You can use a separate power supply, say 12 volts, like a common wall wart or hard drive power supply or whatever, then use the Arduino to switch power to you LEDs in the same manner as does a relay, using instead a regular transistor or MOSFET.

Please meet Nick Gammon

HTH

a7

1 Like

Think of it this way. You have a 12 Ton unit to lift and only have a 5 lb jack, what would you do? I would either split the load or get a bigger jack! Good Luck!

1 Like

Thank you all, I've learned a lot!
Now I want to combine transistors in the circuit - can find a good simulator to test my idea. Wokwi doesn't have transistors in their libraries.

In general - there is any good simulator that will show errors in current calculations or correct choosing of resistors?

Thank you

So I used Tinkercad and this is what I was using transistors.
The 9v battery will be 5500mAh or a Lipo 12v with a voltage regulator (TBD)

A few questions:

  1. How do I choose the exact transistors I need? According to the current it needs to supply?
  2. How I determine the resistors? Do I need to divide the 9v by the sum of the Vf of the LEDs in parallel?
  3. I used PNP transistor - is it good or the NPN is better? Will it affect the performance?

Thank you

There may be, but it's fairly straight ahead and prolly stuff you should learn quick anyway.

Ppl tend to use one of only a few MOSFETs, I'll let someone suggest one or two.

Ppl tend to use one of only a few transistors, again let's see who suggest a favorite.

There are LED resistor calcuators that google will turn up, again the equations are fairly simple as is the concept of limiting the current given an operating voltage and a forward voltage for a particular diode.

a7

Thank you for the explanation about the lookout table.
When I set my minimum value different than 0 (I set the minimum to 10) - the LEDs behave strange and there is a strange blink (or double blink) in the middle of the scan.

Please see the video: https://youtube.com/shorts/ICFWqlYCqwQ?feature=share

Did. Please post the code that was running.

If you don't go below some minimum, and don't go above 255, the LED should not do anything like what you filmed.

a7

For some reason I can't copy using my smartphone..
The link for the project is: f-16 LIGHTS - Wokwi ESP32, STM32, Arduino Simulator

You hacked at the table and the result was only 177 entries. So when you go to read out a gamma value, lotsa times it's just grabbing garbage from memory you should not be reading.

Make the table big enough for the number of steps you take.

or

Restrict the for loops to only address as many table entries as you have.

Let the compiler count them in either case, and use that count instead of the magic 255 you know have:

const nEntries = sizeof gamma8 / sizeof gamma8[0];

Be careful out there!

a7

Hey guys
After learning about transistors and trying to build a circuit on a breadbored, I figured out that I can't use transistor on the fade in/out group of LEDs, because the transistor will switch its state even with the most lower current, and my fade table starts from 10, so it will be always ON.

What other optios do I have to connect 5 LEDs (different Vfs, each has its own resistor, each 20mA) in parallel and fade it in and out all together at the same rate?
The fade shouldn't reached 0 value?

Edit never mind. I now see you are using already… thought you were asking about something you didn't already have running in front of you.

The Arduino boreds have a sorta fake analog output made by PWM. Pulse Width Modulation.

This is perfect for fading LEDs.

  analogWrite(theLEDPin, brightness);

with brightness from 0 to 255. Feed that to a transistor or MOSFET that switches all you LEDs between off and on. This will be rapid enough to appear dimmer as you dial down the brightness.

Check your Arduino board type, only certain pins support use of PWM.

You can try it without the transistor driver, just use one or two LEDs to play with and keep the current below the pin maximum.

a7

The issue is I don't need it to fade to 0, I need it to stop lighted a bit (~10) and because of that the transistor stays on (closed)