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
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:
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.
How can I determine if the total current on each output is ok and the board will handle it?
The constant LED on pin 13 seems to not being fully bright - how can I control it? it should be a beacon.
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?
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.
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.
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!
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?
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.
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.
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:
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. PulseWidthModulation.
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.