I need some help with wiring.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


Gigatrix

New Member
Hello,
I have a bench project slowly gathering all the materials to start the build and I would like some wiring advice for some LED's. I have some (little) electronics experience but know the basics of circuit symbols and some other stuff but feel free to talk to me like I'm a novice.

The project is that I have an Arduino and need to power some LED's. but I don't know what voltage requirements, amp requirements, resistance requirements and configuration of the circuit or how beefy the external power sources may be. The Arduino will have this shield: https://www.adafruit.com/products/1411 on top and I plan to use: http://www.expressmodels.co.uk/acatalog/Micro_LEDs_on_Leads.html I will be using 9 red and 7 warm white but I understand I will need a resistor or two in there, again I don't know what one.

The second half of the project is to power with the same Arduino: https://www.adafruit.com/product/1260. this is a little more complex than the standard two pin LED so IDK where to start. The Arduino will have 6 servos off 6 of the channels and may have the possibility of hijacking the shield but I may be talking out of my butt. I will also need to control the brightness of the RGB LED's so I think that may have to use a PWM pin (what ever that is) All I have is the shield and RGB LED's, the Arduino and the servos.

Thanks in advance, Gig

 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

zapwizard

Sr Member
RPF PREMIUM MEMBER
Adafruit has a detailed tutorial to bring you up to speed on LED and wiring them:.

However the sales page you linked to say "Supplied with resistors for 12 - 16 volts", which means you just need to provide voltage to the LEDs using the included resistors. 12V adapter are very common. The amount of current you need is probably 0.01 amps (10mA) per LED. Power adapters are rated by voltage output, and maximum amps. Amps are pulled by the connected device, so as long as the adapter has more amps than you need, your golden.

The Neo Pixel you linked to doesn't work like a normal LED. A Neo Pixel just needs power and data. The on-board processor does all the rest and handles the LED current. You tell the NeoPixel how bright you want it using the Arduino, it handles the rest. You don't need to use the Arduino PWM signals. Adafruit also has tutorials on using NeoPixels, look at the bottom of the sales page.

If you need to dim the other Micro LEDs then you do need to use PWM. PWM is "Pulse Width Modulation", basically the Arduino turns the LEDs on and off very quickly. If they are on 50% of the time and off 50% of the time, then your PWM duty cycle is called "50%", and guess what, the LEDs will be around half as bright as they would be if provided full constant power.

You also use PWM signaling to drive the Servo's, again there is a tutorial on Adafruits sales page for that Shield.
 

Gixxerfool

Well-Known Member
If you go to Adafruit's site they have a link at the top of the page for learning. Once you go there you should be able to search in the learn section for anything more specific. If you need something else answered they have a forum for their products and General Arduino.
 

Gigatrix

New Member
So the LED's I linked just solder them to the copper rails I planned with a resistor on each and supply a 12-16 v current from Arduino and we should be good. I was thinking just solder the led's on the rails and resistor just after the battery pack so I only use 1 resistor but I shan't play with something that isn't broken. and you say we can just plug the neos in to the Arduino with the right pins like + - to battery pack and command lead to Arduino or am I thinking servos?

I thought you had enough of me Gixxerfool. but you guys where a massive help. thanks a bunch.
 
Last edited by a moderator:

zapwizard

Sr Member
RPF PREMIUM MEMBER
First off some ground rules on voltage, current, resistance and power. These are the absolute most basic tenets of electronics. (Ohms Law)
I end up typing these types of long explanations, as I find people learn better when they have context as to why something is, rather then just telling them the answer.

Voltage: (Volts)
Voltage is a potential source of energy, if you have more voltage, then you have more total energy to work with. Voltage is NOT power, and NOT current, it is just part of the equation that determines the other two. Voltage is the one item you control carefully when providing "power" to a circuit.
The analogy often used for voltage is a water tower. You can have a tower of water up on a hill, it have lots of water which is ready to use. The bigger or higher the tower, the more potential energy you have to utilize.

Current: (Amps)
Current is a measure of the actual flow of electricity. The water analogy is like measuring how much water is going through a garden hose. Current is effectively "pulled" by the device. This is often not communicated well in text books. The amount of current pulled is limited by the resistance of the circuit. If you had zero resistance you would have infinite current. If you have infinite resistance, you have zero current.

Resistance: (Ohms)
If you had no control over your source of water (Voltage), and you opened up a hose, the maximum amount of water that could pass through that hose would be determined by the size of the water hose. A garden hose obviously would let through less water than a fire hose. This is how resistance works in basic circuits. A resistor effectively slows down the current, limiting how much gets through.

Power: (Watts)
Power is a voltage multiplied by the current. Power is the amount of actual energy used in the circuit. Since resistance is typically fixed, that means if you have more voltage you get more current. Because you can't directly control the current, most people focus on voltage. And this is why so many people confuse voltage for power.

Now, onto your actual questions:

You should use a single resistor per LED, this is because your source voltage is fairly high (12V), compared to the LED voltage (~2.5V) If you know what your doing, you can use a single resistor for multiple LEDs. However, resistors are dirt cheap and not worth saving money on, compared to LEDs.

How resistors work, is literally by converted all the other current that would have otherwise fried the LED, and converting it into heat. Leaving only a small amount of current for the LED to use up.

Here is the math:

12V source voltage, minus 2.5V for the LED, leaves you with 9.5volts of power across the resistor. (12-2.5=9.5)
In a series circuit, current is constant no matter what part of the circuit you measure. If we assume the LED is pulling 10mA (0.01A), then you can figure out exactly how much power the resistor is soaking up. You use Ohms Law for this. 9.5V across the resistor multiplied times 0.01 amps is equal to 0.095W, or basically one Milliwatt.
You would now have to know how many watts your resistor can handle. If it is a small resistor with axial wires, it is most likely a 1/8W (0.125) or 1/4W (0.25).
0.095 is very close to 0.125, so basically, one resistor per LED.

However! There is something very important that perhaps was missed.
The Arduino can only accept voltages either 5V or 3.3V depending on the model you purchased.
If connecting the LED directly to the Aurdino, your LED source voltage cannot be higher than 5V or 3.3V! If you connect a 12V signal to any of the Arduino pins you most likely will fry it.

Now, the PWM Shield you listed is rated to 6V, which means you also can't a 12V source of power for your LEDs. The solution is to use a 5V or 6V supply for your LEDs and half the resistance value for each LED. You can use the resistor they provided without any trouble either, the LEDs just may be a bit dimmer. (Less current)

The NeoPixel is basically have their own microcontroller on-board. You provide them with the voltage that is specified in the LED datasheet. They then use a control signal wire to get data from the Arduino. The NeoPixel has a built-in resistor for the LEDs. The Arduino sends a small string of 1's and 0's (Digital serial data) to the NeoPixel, telling the pixel what LED brightness value and color to use.

The servo's sort of work similar to NeoPixels, in that they are provided with power, and a control signal. Their control signal isn't actually digital persay, the PWM signal is basically a 0% to 100% analog signal, telling the Servo to turn between its fully left and fully right position. The shield you purchased is actually a servo controller, this is a small processor similar to what is in the NeoPixel. So the Arduino isn't actually sending any PWM signals to the controller, it instead is sending digital data, telling that controller what to do.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

xl97

Master Member
you can NEVER (ever) supply 12-16v current (whatever that even means) from an Arduino..

Arduino are +3.3v or +5v platforms..
(not 100% clear why you started a new thread?)

you can do parallel or serial.. or serallel for wiring leds...

question:

1.) what is powering your 'copper rail'?
2.) with what and how are you 'controlling' this copper rail?


RE: neopixels.

they need +5v (no more!)
Yes you can control these using only one pin/wire... but as explained before.. using Neopixels with OTHER THINGS GOING requires a specific coding approach..

(and if you plan to use servos with it, you will need a special library (TiCo library I think its called?...been a while)...

* The above is said using the Arduino connected to everything.. as you had mentioned in the other thread.. you are buying a 'servo shield'.... so hopefully the Neopixels dont interfere with this.. however you still need to approach this in a particular way so you can actually send commands to the servo shield.. (Neopixels require specific timing to run...and they keep the Arduino pretty busy all the time... so you need to be able to not be stuck in a loop to be able to send I2C signals to the servo board.)


Those leds you linked to (as mentioned) are rated for a 12-16v power supply.. why are you trying to use those?

Unless I have a 12v or 24v specific component.. I normally use a +7.4v li-ion pack.. its enough to power everything I normally use.. enough current.. but not such a high voltage pack, that my voltage regulars are burning up waste all the excess power as heat (which will lead to letting the magic smoke out of your electronics)

Example: you supply a 12v power source to Arduino.. it has a +5v voltage regulator... any over that +5v is being waste.. and turns into heat.

If you really have a need for such power source.. you may need to get two.. a smaller and a bigger one (dont forget to connect grounds together)
 

nomuse

Sr Member
RPF PREMIUM MEMBER
Think it would help to see a better overview of your project; the lighting and servo effects you are hoping to achieve, the choices in servo and LED you are thinking of using. Then some of the people here can advise about whether you are going to need that PWM board, what kind of power supply, etc. As it is there's too many options to allow anyone else to really be concise and clear.
 

Gigatrix

New Member
Thank you zapwizard for digging up all my old school physics and dusting them off and putting them nicely on a little display pedestal. It helps a lot. I don't need the stander micro LED's to be 100% brightness. more just they are there so I don't mind running them off the shield if that will work. I am going to have an external power source to the shield anyways.
xl97 I know I cant supply more than 5v from the Arduino but I don't mind using them if they will be dimmer. I chose them because they are 1mm across and thought I might do something like have them in a separate circuit that's activated by an Arduino if the worst came to it. but I again don't mind running them at half capacity. I also started a new thread because I figured you guys had had enough of kicking the brick wall that was me but your more than welcome to stay as you had the patience of a saint and helped out loads. and the copper rails are just so the + is on one and the - is on the other and makes it so I can maintain electrical contact with them whilst they are mounted in a revolving component.
nomuse here is a full inventory of what I want to use and what I have.
servo- http://www.hobbyking.com/hobbyking/...41A_Analog_Nano_Servo_0_7kg_0_12sec_4_3g.html x6
motor- http://www.hobbyking.co.uk/hobbykin...bbyKing_Pocket_Quad_V1_1_Quadcopter_4pc_.html x1
LED's- https://www.adafruit.com/products/2226#tutorials x3 (I made a mistake in the LED link earlier) and http://www.expressmodels.co.uk/acata..._on_Leads.html x9 red x7 white
Solenoid- I am still hunting for a long stroke one but I think I will have to put it on a separate circuit with an electrically controlled switch as it will require 12-24 v

Arduino- https://www.arduino.cc/en/Main/ArduinoBoardUnoSMD
Shield- https://www.adafruit.com/products/1411#tutorials

The LED's I want to be able to control the brightness of the RGB ones and just have the single colour turn on and off on command of the Arduino, The motor I would like just to turn on when I want and off when I want. the solenoid I want to retract on command and extend immediately after. I was thinking supply it with current to do this, it retracts, cut the current and a spring resets it. And the shield controls the servos. as for a power supply I was assessing what components I have before I make a decision.

 
Last edited by a moderator:

nomuse

Sr Member
RPF PREMIUM MEMBER
Err, thanks, but not what i needed. The end goal, not the path you hope will get you there.

For instance, I can tell you that you can run six servos from the Arduino's own PWM (assuming you haven't used up all the pins on stuff that didn't make your list above) but the onboard power supply will barf at anything other than micro-servos.
 

Gixxerfool

Well-Known Member
Sorry for the derail, it is only temporary...
xl97 please clear your inbox.

Thank you.

...you may now return to your regularly scheduled thread.
 
Last edited by a moderator:

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Gigatrix

New Member
ok, well tbh I want to wire all this up to the Arduino and controlled by it. and I want to control with the code flexibly all the functions. things like the small motor, solenoid and 1mm LED' are an on off deal whilst the RGB servos need a bit more control (as you would imagine) and I can surly take care of the code to do all that later? all I want to know is how you would connect all this up, I have the 6 servos just being put into the shield (no biggie) all 16 of the 1mm LED's in parallel with the resistors but don't know how that will connect with the Arduino. and the RGB LED's I am assuming you have a + - and command like the servo and ask if I cant just treat them like a servo and wire them into the shield? and also if I wire them all in series or parallel and what to do with the command lines. If you could I would put them all in the same pin as they will all do the same thing. but again that might just be cobblers. as for the solenoid, I'm gonna leave that for now. I may add it later but don't worry about it. There where 3 little components that didn't make the list and that's a toggle switch and 2 push button switches. of witch I want to program chains of events when each are activated but what the components do will be left to the programming.
 

zapwizard

Sr Member
RPF PREMIUM MEMBER
You can't use a spring to reset a Servo. Servo's are geared down motors, you can only move them using the actual servo. So if you want it to go back your control program has to handle that.

As far as connections:

-Connect the servo's to the servo shield
-Connect any normal LED you want brightness control to the servo shield also, any static LEDs just to power. If you want to turn those static LEDs on and off by microprocessor, then use the servo shield, or use a transistor to boost the power from a control line on the Arduino.
-Connect the NeoPixels control line to the Arduino directly. Follow their tutorials, you have to use their code anyways to control the NeoPixels. The NeoPixels aren't controlled like the servo's, Adafruit has the software code you need to control them.
 

xl97

Master Member
Err, thanks, but not what i needed. The end goal, not the path you hope will get you there.

For instance, I can tell you that you can run six servos from the Arduino's own PWM (assuming you haven't used up all the pins on stuff that didn't make your list above) but the onboard power supply will barf at anything other than micro-servos.


And thats probably NOT under a load.. a servo can pull up to 1A under a load! ( a single Arduino pin can only supply roughly 20-40mA.. and 200MA total for the board I think)



@Gixdxerfool - all cleaned out bud! :)
 

nomuse

Sr Member
RPF PREMIUM MEMBER
Yah -- I've run three micro servos off the on-board power supply, but they were pulling nothing but 1" cubes of expanded polystyrene.

With 20ma per I/O port you can handle a single superbright LED no problem. The Arduino tends to be robust on the I/O ports, and I've gotten away with three or four LEDs ea ...but then I'm usually running PWM on them or blinking them. The big advantage to the PWM shield for the OP's application is it uses an independent power supply; it isn't tapping the Arduino for anything but digital data. I think it is 2-wire, meaning you can daisy-chain the shield along with neopixels, but you don't need to; the more recent versions of the neopixel library let you set almost any pin for data.

Other nice thing is that both of these (neopixel and PWM board) are free-running, meaning you don't have to get crazy with real-time code (unlike when you imbed software PWM in the main body of your program...can you tell I mostly work with ATtinys, which don't have all those lovely timers free for hardware PWM?)


Anyhow, for the OP -- you are going to need a power supply, and with any more than 4-6 neopixels you are going to need a regulated 5v power supply (you can run about that many off the Arduino's own regulator, but more than that will choke it). Servos and LEDs are relatively agnostic in that you can usually come up with a direct-to-battery solution for them and not have to use a regulated supply. LEDs require ballasting, and above 12V or so that ballast resistor starts getting large. Hi power -- 1 watt and above -- LEDs are another game entirely, but for the common 3mm and 5mm and "Piranha" types a quarter-watt resistor and a supply between 3.n and 12 volts will be fine.

NORMALLY you need to put in a driver; transistor, Darlington, relay, or something like that PWM shield or even a motor shield (Adafruit has a nifty one) to run any kind of motor, but from your picture those are those tiny vibration motors. As long as you are using them in that mode and not trying to actually turn anything other than the built-in offset weight, you can actually get away with hanging one or two on an Arduino I/O port.

But you don't need to for your ap. That Adafruit PWM shield will handle LEDs and servos simultaneously (and is stackable, meaning you could have more than 16 channels). I can't find anything on the Adafruit pages as to how many milliamps each channel can handle; I'd have to read up on the chip to discover that. Safe bet is one LED per. From the looks of it, the PWM shield isn't really designed to handle beefy currents...I wouldn't want to put a bunch of motors on it, even if they are just vibration motors.



But, really? This is ambitious. Take baby steps first. At the least, breadboard everything before you start gluing it into the prop. Better yet, make a couple of simpler circuits with one or two LEDs, something blinking, a basic servo setup, etc. That PWM shield is not there to make the learning curve less steep. If anything, it is there for when you can already do everything and you are doing so much of it you've maxed out your Arduino. So start just plugging an LED or a servo or a neopixel into a "naked" Arduino and get comfortable with making that work.
 

Gigatrix

New Member
zapwizard I meant reset the solenoid with a spring but I'm taking that out the equation now. And you say I can run all the LED's off the shield and the static ones off the Arduino and the motor?
And I am taking baby steps with the programming, doing the blinking one then a switched blinker and a servo one and a servo switch. Anyways I could understand if running the servos straight off the Arduino meant a baby could beat it in the strong man Olympics but you can connect a external power pack and people use the shield to build walkers so does that still not work? I think if I might be so bold that I can take the servos out because I know how to wire them up and I know they work. I think they may be confusing this chat. Unless anyone has any problem with the wiring and power of them with a external power pack could we focus on the LED's and just to ask if people could do a circuit diagram of how this would all fit together that would be a great help. (I can read one if you didn't know) Thank you.
 
Last edited by a moderator:

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

nomuse

Sr Member
RPF PREMIUM MEMBER
There's really no alternative to learning enough to count amps. You need to be able to look at the specs of the various things you want to control and figure out how many amps (usually, milliamperes) they are going to pull. And looking up the specs on Arduino and shield de jour for how many amps it can supply. And these are both per channel, and total. (The Arduino can swing 20-30 ma per I/O pin, but even if you had thirty pins it also can't do more than about 350 ma total. The typical regulated on-board power supply is probably good for 500 or so.)

And this also requires understanding which are power leads and which are data leads. Servos and neopixels have both; the data lead is for all practical purposes not a problem for amperage. The amperage is supplied through separate power rails, which are limited not by the data channel (Arduino I/O port or shield channel or whatever) but by whatever power supply you've hooked to.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Top