Go Down

### Topic: Resistor for each LED or one for many (for MIDI controller/looper)? (Read 1 time)previous topic - next topic

#### MountainCraft

#15
##### Sep 14, 2018, 11:19 pm
You can wire them in parallel (with one series resistor) but there a couple of issues...    The current is limited by the resistor and is split between the two LED.   But because of that non-linearity and manufacturing variations the current may not split evenly and one LED may be brighter than the other.   You can often get-away with it, but it's "bad practice".

I now understand that it's not worth the trouble, and I might as well just solder a resistor to the end of each LED, cover it with heat shrink and be done with it...

Thanks,
Mark

#### Wawa

#16
##### Sep 14, 2018, 11:21 pm
LEDs, like diodes, have a fairly constant voltdrop across.
Subtract that Vf (working voltage) from the supply voltage.
The remaining voltage drops across the CL resistor.
With that voltage you can calculate resistor value for a certain desired LED current.

Note that you don't have to use max LED current (20mA for most small LEDs).
Most of the modern ones are perfectly happy with 1-10mA.

You bought a Mega, with many pins.
I hope not for 'many LEDs'.
Processors do have pin/port/package current limitations.
Leo..

#### MountainCraft

#17
##### Sep 14, 2018, 11:28 pmLast Edit: Sep 14, 2018, 11:40 pm by MountainCraft
Okay then, all that considered;

The LEDs I will be using are spec'd as follows

Red = 1.8-2.4v, 20ma
Blue = 3.0-3.4v, 20ma
Yellow = 2.0-2.2v, 20ma
Green = 3.0-3.4v, 20ma
RGB = 1.9-3.4v, 40ma

I don't care if the blue is a different brightness than the reds (as long as they are reasonably similar) and so on, but I want all the reds to be the same, and all the blues to be the same, etc.

Is 300ohms a good value for the resistors (LED's directly fed from the Arduino Mega's digital outputs)?  They're gonna be hard to replace once permanently installed (silicon glued to a removable faceplate), so my only two requirements are that they be easily seen from 6 feet away, and that they last long time...

Or maybe a better question is, what is a good value for the individual resistors to achieve those
two goals? I would prefer to be able to see them in broad daylight, but more often than not it will be artificial room light or dark (on stage), but the broad daylight thing needs to be subservient to the longevity thing...

Thanks,
Mark

#### Grumpy_Mike

#18
##### Sep 14, 2018, 11:38 pmLast Edit: Sep 14, 2018, 11:42 pm by Grumpy_Mike
Quote
Is 300ohms a good value for the resistors
Yes.

It would help if you got your terms right.
Voltage is across, current is through. Power is the product ( like in multiplying voltage and current ) is nether across nor through.

Quote
Or maybe a better question is, what is a good value for the individual resistors to achieve those
two goals?
You should only put the maximum rated current through an LED. Whether that is bright enough for a specific purpose is dependent on how efficient the LEDs are at converting current to light. You find that in the data sheet.

#### MountainCraft

#19
##### Sep 15, 2018, 12:01 amLast Edit: Sep 15, 2018, 12:04 am by MountainCraft
Yes.
Thanks!

It would help if you got your terms right.
Voltage is across, current is through. Power is the product ( like in multiplying voltage and current ) is nether across nor through.
LOL.. I know all this.. I have a pretty decent background with these concepts as I was an avionics tech in the military and also civilian side (but ICs were just coming out back then, so much of this stuff was not in existence then), and then later as a Low voltage wireman (Large commerical life safety/fire alarm systems, nurse call systems, etc.), and then later an inside wireman (including process control at refineries, etc.), but it's been a long time since I had to 'think' about this stuff seeing as so much of it is just automatic for me, so thanks for the reminder..

I've always wondered how current/voltage/power of LEDs is considered in a circuit, so this gets me all pointed in the right direction...

Thanks again to all for the explanations...

Next, I gotta tally up all the things that will be going on with this project and figure out how big of a power supply I need for it (for another thread), but at least I can start wiring up all the switches and LEDs now, and start playing with programming the basics for this beast...

I better head over to the 'feasibility' forum too, and make sure the Mega 2560 is capable of doing all that I need this thing to do...

Thanks,
Mark

#### Paul__B

#20
##### Sep 15, 2018, 01:39 am
Bought a Mega later as I need a lot more I/O and memory than the UNO provides..
What makes you think that?  I suspect a Nano would be quite sufficient.

it will involve several relays and several LED's...
Right, for a start, you will need to drive the relays.  They cannot be connected directly to Arduino pins (possible exception; reed relays) so you need driver ICs.  Given that, you can - and should - use ICs such as the TPIC6B595 which are a shift register with 8 driver FET outputs to drive relays or higher power LEDs.  These chain together so that a reasonable number (8 or 10 chips = 64 to 80 relays) are controlled by three Arduino pins.  Do not consider obsolete drivers such as the ULN series.

Now, LEDs.  How many?  You are thinking in crude terms of one to a pin.  Even then you have potential problems with current draw.  If you wire them in a matrix, I suggest that rather than fiddling with a MEGA 2560 and resistors, the proper way to do it would be to use a MAX7219.  The fact that the MAX7219 is actually intended to drive 64 LEDs is of no concern and the extra expense is minor (click on the illustration).

Given that it involves your own wiring for the LEDs in any case, the sensible way to approach this is to buy a couple (just in case) of the rubbish MAX7219 matrix modules - as a kit - and assemble them without the actual matrix and sockets for same, using the PCB to wire to your own set of LEDs.

This gives you perfectly adequate brightness (but totally controllable both as the maximum which is set by the single resistor and overall in steps by code) requiring no code to continuously multiplex the display; you only update the MAX7219s when you want to change the display and the interface is similar to the TPIC6B595 and using the same SPI/ shiftOut process, possibly the same three pins!

It truly is a waste of time and effort doing it any other way!

That's kinda what I thought might be the case..  But I really don't understand how LEDs are measured resistance wise.
They aren't!

I guess I kinda saw them as diodes (switches), but I know that can't be right, otherwise wiring them directly across a voltage source would create a short circuit,
It certainly does.     They are diodes.

meaning they must have 'some' resistance, but it sounds like their resistance changes according to the power passing through them?
They do, and it does, so you do not consider them in that regard.

Even if the LEDs all had constant resistance, adding more branches of the parallel circuit would change the dynamics of the overall series circuit, moving the dividing point of the voltage dividing network...

2 LEDs @ 100 ohms each in parallel = 50 ohms seen by the single resistor  meaning that across a 100 ohm feeder resistor, the LEDs would be dropping a third of the total voltage...

4 LEDs at 100 ohms each in parallel = 25 ohms seen by the feeder resistor, meaning that the LEDs would now be drawing only a fifth of the total voltage..

So each time another LED is added, they all get dimmer...

Thanks, it's clear as mud in my bean now!
It is indeed, clear as mud because you are taking about resistance, which is irrelevant!

So to control the brightness of an LED do I just take it's max rated current draw,
No, you do nottake the maximum rated current, particularly when you refer to longevity.  You will notice little difference in brightness between the maximum rated current and half that, so perhaps 75% of the maximum.

and then use that to calculate how much current flowing through a resistor provides that much current (ignoring the internal resistance of the LED)?
Got that confused!

The fact that the LEDs change resistance according to the power supplied to them is confusing from a design standpoint...  Obviously, thinking of them as regular ole light bulbs doesn't cut it... How is all that calculated?
You don't think of them as "regular ole light bulbs" which in case you do not recall, do not have a constant resistance in any case!  "Regular ole light bulbs" are specified to work to a voltage which you supply at that voltage.  LEDs are specified to work at a current and they have a specification which approximates the voltage they will drop because they are a diode.  You work out how to provide that current either by making a current driver (as you must for high power LEDs) or determining the difference between the LED voltage drop and the supply voltage you have and specifying a resistor to drop that voltage difference at the appropriately de-rated current for the LED.

But the MAX7219 IC does all that for you - one resistor sets the current for a matrix of up to 64 LEDs and the brightness of any LED does not vary with how many are lit at one time.  Different colour LEDs will not necessarily have similar apparent brightness but that it to be expected.  Dual colour (3-pin) or RGB LEDs can be used in the matrix.  Using decent quality LEDs, they will be readily visible in daylight - direct sun might be a bit of an "ask".  I expect my moving message board using these modules to be quite legible.

Warning - for a "real world" project, do not use the on-board regulator on the Arduino from "Vin" or the barrel jack.  You need a 5 V regulated supply feeding the 5 V pin.

#### MountainCraft

#21
##### Sep 15, 2018, 03:17 amLast Edit: Sep 15, 2018, 03:27 am by MountainCraft
I was planning to post all this over in the feasibility forum, but you asked.. lol

I guess I can copy and paste all of this over there after this...

It's going to be a user programmable MIDI controller/effects loop switcher..  There will four switches for switching loops in and out, a switch for choosing amps, and a switch for chain mute.. There will another section with a select button and switches for program up and down..  There will be an LCD readout with buttons for editing/programming, and a rotary encoder..

The unit will have three modes;

'Manual Mode' (the 4 switches control the loops and a red LED lights above the switch to indicate a loop taken out of the chain, the up/down switches move through programs up and down one at a time, the select switch makes the MIDI controller apply the selected program),

'Program Mode' (the unit allows manual input of which patches are in a 'scene,' which scenes and order are in a 'song,' and which songs are in a 'set'.. then you select which loops you want in the scene manually, select which program changes, channels, etc are in the scene, and then you can save the whole shebang), and;

'Run Mode' (the unit then uses the 4 switches that are used for inserting removing a loop from the effects chain, for selecting one of the eight scenes.. there will be a blue and a green LED below each of the the switches to indicate which of the 8 scenes is chosen, ie 1/5, 2/6, 3/7, 4/8, and any loops that are switched out of the chain by the program scene will have it's red LED above the switch lit)...

There will be an RGB LED above the 'select' switch to indicate which Mode the unit is running in, sometimes it will flash to ask if you want to select or to save the scene (depending on mode)..

It's be nice to be able to include a tuner powered by the Arduino, and the ability to save/load scenes, songs, and sets to a flash drive.. I want the user to be able to enter names for the scenes, songs, and sets...   I also want to integrate a buffer into the guitar chain...

That's basically what I want to do.. You can see that I'm gonna need a lot of I/O, and as much memory as possible.. I don't know if even the MEGA 2560 can handle all that, and if not, I might need to have it talk to another one..

I know this is going to be a long project, and I will learn a ton doing it.. In the beginning the programming will be pretty easy, but once I want to add the UI and do all the parts with scenes, songs, and sets, I'm thinking it will be a painful learning curve..  But that's okay... Plus, I'm sure there are others that have attempted/accomplished similar pedal board controllers so I can draw from what they did too..

I also bought some LCC110 ICs to use as relays, should I decide to do that.. I was already planning on using three of them to do a delay mute of the whole chain (a few milliseconds) whenever a loop is switched or a guitar amp is chosen, using them as the relays for both the chain mute and the guitar amp relays..

Sounds like I should plan on using them for all switching..  I also have relays.. one is a 4 relay board populated with DPDT relays, LEDs, and some resistors, transistors, etc..  Said it was for Arduino when I bought it.. Pretty sure it supplies power for the relay transformer separately (hence the terminal for 5v)

I bought a 2 relay version too, to use for the guitar amp and mute switches (but I had already decided to use the LCC110s for that so that I can do the delay thing, to avoid pops and clicks when switching loops)

This is the 4 relay board I bought

This is the 2 relay version I bought

I also got these Hex inverters to use for the MIDI outputs

These are the faceplates for the loop switching section, and the MIDI section (there is room for the LCD and programming switches to the left of the up/down/select switches on the MIDI section..

#### Paul__B

#22
##### Sep 15, 2018, 06:02 am
I was planning to post all this over in the feasibility forum, but you asked.. lol

I guess I can copy and paste all of this over there after this...
I would definitely not advise that as cross posting is viewed on these forums with extreme prejudice as a nuisance that simply wastes the time of those who seek to assist and duplicate posting threads will be merged or deleted by the moderators.

OK, it begins to be apparent that you do not actually require many LEDs or relays, so those relay boards will probably be OK with a Mega 2560.  Since I have no idea what your "scenes, songs, and sets" involve I cannot make any suggestion in that regard.

Your photos are pretty useless as - common blunder - they are taken in darkness.    The best way to do this unless your workshop is lit by multiple floodlamps, is to take it outside in full daylight but not direct sun and use a digital camera (that is, not to be confused with a telephone) at least a metre away from directly above (or very slightly offset to ensure all the connections are able to be distinguished) using the (actual - "optical") zoom to just include all parts of the assembly.

#### MountainCraft

#23
##### Sep 15, 2018, 06:17 pmLast Edit: Sep 15, 2018, 06:21 pm by MountainCraft
Your photos are pretty useless as - common blunder - they are taken in darkness.    The best way to do this unless your workshop is lit by multiple floodlamps, is to take it outside in full daylight but not direct sun and use a digital camera (that is, not to be confused with a telephone) at least a metre away from directly above (or very slightly offset to ensure all the connections are able to be distinguished) using the (actual - "optical") zoom to just include all parts of the assembly.
Something is wrong.. I see them plain as day.. They were taken with a digital Canon EOS using flash and auto settings...  They were taken in a room with (9) 5x5 windows all open in broad daylight.. They were originally posted on my facebook page where no one had an issue seeing them..  then transferred without editing in any way up to my website, and then the url sent here (after viewing them in a web browser, where they looked perfect)..

Two of the pictures are simply images on Amazon (I direct linked to them on Amazon)

I don't see any issue with them at all.. This is very confusing..

I didn't get a response when I posted this over there, so I'll delete it (if I'm allowed to), but I'm thinking most who know about MIDI controllers and what not are going to see it here..  But it's already three pages deep without response so I guess that's not happening anyway.. lol..

Scene = a set of patches..
ie, one effect might need to have a program change to call up one effect, and another might need four of them to call up four effects, or to call up an internal MIDI program change that has the four effects and their parameters already assigned as a patch..  In either case, at least one MIDI channel and program change will need to be sent to each effects unit that accepts MIDI.. it would also select from memory which relays would be engaged in order to include or exclude which effects are to be used for part of a song..

So, a scene might look like this..  loop 1 with the wah wah/volume pedal is bypassed, and look 4 with the distortion pedal is bypassed, but loop 2 with the multieffects unit, and loop 3 with the Whammy pedal are engaged..  the red LEDs above switch 1 and 4 are lit, indicating they are bypassed...

At the same time, scene one sends MIDI program change information to the whammy pedal and the multiefects units to tell them which settings/effects to set themselves to...

There would be 8 'scenes' in a song, selectable  by the four (loop selection in manual mode) switches..

'Song' = selection of scenes
A 'song' is simply a set of 1 to 8 'scenes' that are selected and named in the order desired.. They are the scenes that the song being performed might need..  Maybe one part of the song needs chorus and delay, while another song needs screaming distortion and big delay and reverb..  There would be a scene for each part, and simply stepping on one foot switch would select all of that instead of having to push buttons on three or four pedals or even reaching down to adjust parameters..

'Set' = a group of songs
A 'set' would be a series (in selected order) of 1-16 songs (or ideally even more if memory allows)..

ie;
set 1
"still got the blues"
"The Loner"
"Rock Candy"
"Rock the Nation"

set 2
"Tush"
"La Grange"
"Lights out"
"Rockbottom"

Each of those songs would consist of one to eight scenes for however many parts of a song are needed..  Sets would generally be programmed in via the UI the day of a show or a practice, and scenes and songs would generally be programmed in when the song is learned/worked out and then would largely not change much after that..  Sets would be the most commonly changed thing once scenes and songs are worked out and programmed in..

My big question at this point is "Can the Mega handle something like this?"  If so, great, I'll plug ahead..  If not, then where/how will I be limited?

#### MountainCraft

#24
##### Sep 15, 2018, 06:27 pm
Won't let me delete the other post..  Oh well, it's being ignored anyway..  Now 3 pages deep..  It will disappear into obscurity soon enough..

#### MountainCraft

#25
##### Sep 15, 2018, 06:34 pmLast Edit: Sep 15, 2018, 06:37 pm by MountainCraft
What I'm trying to do is something similar to this;  only it will also include a manually controlled loop switcher, the jacks will be a separate section, and it will all be 'built in' to my pedal board...

Free The Tone Audio Routing Controller

#### MountainCraft

#26
##### Sep 15, 2018, 06:56 pm
Just in case someone is not familiar with MIDI, here's a quick explanation..

MIDI Technical Specifications

MIDI Overview

I am only interested in channel, and program change messages (potentially sysex) for this project all the other features of MIDI (notes, velocity, vibrato, etc) are not to be used...

#### ChrisTenone

#27
##### Sep 16, 2018, 10:40 am
Your title should mention MIDI
Atmosphere carries combustion vapors to places where they will do good instead of harm - Mike Faraday's 'History of a Candle': https://www.youtube.com/watch?v=6W0MHZ4jb4A

Whoops

#### Grumpy_Mike

#28
##### Sep 16, 2018, 10:49 amLast Edit: Sep 16, 2018, 10:58 am by Grumpy_Mike
Quote
My big question at this point is "Can the Mega handle something like this?"  If so, great, I'll plug ahead..
It is hard to say with a big project, a lot depends on your skill. But I haven't seen anything that is over complicated that would rule out a Mega.
Unless you need to have some form of GUI, then a laptop might help.

Quote
You can see that I'm gonna need a lot of I/O, and as much memory as possible.
There are always ways of getting more I/O if you need it. Extra memory is more tricky but adding extra SRAM is possible on the Mega, program memory however is not so you might have to upgrade to a bigger processor board. But you won't know until you start.

#### MountainCraft

#29
##### Sep 16, 2018, 06:53 pmLast Edit: Sep 16, 2018, 06:56 pm by MountainCraft
Your title should mention MIDI
I posted a topic in the "Project Guidance" forum about this, that described the project in the title (got no replies), but this thread was originally about the LEDs and resistor question..  I didn't intend to get this far into the overall project in this thread, but it sorta morphed..

Grumpy Mike pretty much answered my question about feasibility, so I don't really need an answer on that other thread now anyway..   Probably won't get too far into the thing here in this one either..

From here on, the electronics/hardware is pretty straightforward (at least until I get into putting together the UI).. Where I'll need a 'ton' of help is in the code, so when I get there, I'll start a new thread and that will mention MIDI controller in the title for sure..

Go Up