How to wire this setup? - Page 1
Forum section: electronics / beginners

author: Youkai
author_rank: Regular Contributor
timestamp: May 02, 2018, 06:36:46 pm
content: I am working on planning a setup that will have the following in it:Arduino Board2 single segments (3 LED each) of this RGB LED strip:https://www.superbrightleds.com/moreinfo/flexible-led-strip-lights-color-changing/rgb-led-strip-light-flexible-custom-length-led-tape-light-with-9-smds-per-ft-3-chip-smd-led-5050/3502/3 standard hobby servos. This or similar:https://www.towerhobbies.com/cgi-bin/wti0001p?&I=FUTM0004&P=FR&gclid=CjwKCAjww6XXBRByEiwAM-ZUINEV06Mg8DxJJgtBNvUa7I3OP6c8-Mmx6gegNVy8GxjifDyoEKYcvxoCPT4QAvD_BwE1 momentary press button to control when the arduino runs the LED/ServosThe Arduino will run both the servo's and the LED so I'll probably also need a PWM chip or two to give me enough PWM pins.The Arduino and servo's run off of 5v; and the LED has an operating range between 9v and 15v. My original plan was to use the 12v power supply I scavenged from some other thing to run the LED directly and the Arduino trough a voltage limiter. Then to use some transistors so the Arduino could control the 12V source to the LED.I went to my local electronics parts store and when I was asking about the voltage limiter they also had a voltage booster thing. So now I'm wondering if I want to use the 12V supply and the limiter/transistors; or a standard 5v USB wall plug and the voltage booster.Are both scenario workable? If so is there any pros/cons to one or the other? Please let me know if any of this is unclear or if I have any fundamentally wrong thoughts/assumptions.

author: james_s
author_rank: Super Contributor
timestamp: May 02, 2018, 07:33:43 pm
content: What you are looking for is called a "voltage regulator." In your case I would suggest something simple like the tried and true 7805 linear regulator. If you need more than 1A or want higher efficiency there are switchmode regulators also called buck converters that will work but for running 3 servos and an Arduino it shouldn't really matter.

author: tpowell1830
author_rank: Frequent Contributor
timestamp: May 02, 2018, 07:47:47 pm
content: Quote from: Youkai on May 02, 2018, 06:36:46 pmYou are on the right track with the 12 volt power supply and your buck module, depending on the current capabilities of the 12 V supply. The output of the LM2596S is about 3 amps. What is the current output capacity of your 12 V supply?

author: kjr18
author_rank: Regular Contributor
timestamp: May 02, 2018, 07:55:17 pm
content: Quote from: tpowell1830 on May 02, 2018, 07:47:47 pmFirst photo says 12V 500mA, but he might have some other power supplies.

author: Youkai
author_rank: Regular Contributor
timestamp: May 02, 2018, 08:29:06 pm
content: Quote from: tpowell1830 on May 02, 2018, 07:47:47 pmThe wall adapter I found produces 500mA at 12v (see image attached to the original post). I'm hoping that 500mA is enough to power everything I want in the circuit. I don't think any of these are particular power hogs but I also haven't really looked at how much power they require yet either.

author: tpowell1830
author_rank: Frequent Contributor
timestamp: May 02, 2018, 10:08:21 pm
content: Quote from: Youkai on May 02, 2018, 08:29:06 pmOops, sorry, missed the photo. 500 mA may be a bit slim for what you are doing. I don't know what your buck converter will eat.EDIT: Since you have both the buck and boost converters, the USB - 5VDC option is a good option because the USB will output 2 amps (depending on your PC/USB). The other plus is that you could then power your entire circuit with one of the USB power brick battery devices, as well, without the need for a PC.

author: james_s
author_rank: Super Contributor
timestamp: May 02, 2018, 11:00:50 pm
content: Well the advantage of using a buck converter is the input current will be lower than the output current. 12V 1A or larger supplies are easy to find if needed though.

author: KL27x
author_rank: Super Contributor
timestamp: May 02, 2018, 11:01:43 pm
content: The Arduino and switching circuitry should only need on the order of some few mA at 5V. If you have any indicator LEDs, they may draw more than the Arduino.I'm assuming the LED you wish to switch is not just an indicator LED and is going to draw a lot more than the Arduino.It's generally going to be more efficient to select a 12V PSU and drop to 5V to run the Arduino than the other way around. You don't need a buck converter to drop 12 to 5V. The draw on the Arduino should be so low, you aren't saving much if anything over a linear regulator. Beyond "soft off" draw on a battery powered device, you don't usually need to worry too much about the current consumption of a low power microcontroller in the bigger picture.

author: james_s
author_rank: Super Contributor
timestamp: May 02, 2018, 11:07:06 pm
content: He's using hobby servos too though, those run on 5V and can draw a few hundred mA each depending on the mechanical load they are dealing with.

author: Youkai
author_rank: Regular Contributor
timestamp: May 03, 2018, 02:20:37 am
content: Ok so I'm seeing some conflicting commentary. It seems the 12V supply that I got probably doesn't have the amps to do what I will need it to do.I'm still not sure if I should use a 12V wall plug or a USB wall plug (5V?). Is the 5V source and the buck converter a better option?

author: james_s
author_rank: Super Contributor
timestamp: May 03, 2018, 02:59:33 am
content: You'd need a 12V source and a buck converter, or a 5V source and a boost converter. Generally buck converters are more efficient than boost, so I would go with a 12V source regardless of whether you use a buck converter or linear regulator. Your 500mA unit ought to be enough for testing but might not have quite enough capacity.

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 03:14:24 am
content: I drew a basic circuit diagram. Please take a look and let me know if you see any problems/issues. Points to note:12V power source goes to the LED strip through transistor from Arduino.12V power source goes through buck converter to reduce to 5v.5V powers both Arduino and Servo directly (as opposed to servo being powered from 5v pin on Arduino).I only drew one transistor but in reality there will be three beacuse it's an RGB LED strip. I didn't bother this time for the sake of simplicity. (Actually probably 6 because there will be two strips in different locations and I will probably want to control them independantly)Also there will be 3 servos. Extras were again left out for simplicity.The Arduino will likely not have enough PWM pins so there will be a PWM IC in the final. I think since none of the driving power goes through Arduino (only switching logic) the PWM chip should be able to handle it; but please let me know if you think I'm wrong.Also I tried to diagram this in LTSpice but I couldn't find a "microcontroller" component (not surprising) or a Servo component. Is it possible to diagram this circuit in LTSpice?

author: KL27x
author_rank: Super Contributor
timestamp: May 10, 2018, 03:29:08 am
content: All kinds of wrong.The transistor (which shall be NPN, I presume; you're missing an arrow) probably needs the emitter connected directly to ground. It's a 12V unit, right?The servos need to be connected to both 5V positive rail and to ground. You have no ground connection on them.The buck converter should have its Vin connected to the 12V supply rail.

author: KL27x
author_rank: Super Contributor
timestamp: May 10, 2018, 03:39:35 am
content: ()You of course will need some extra caps for both the buck regulator in/out and some decoupling caps might (definitely) be needed on the 5V rail closer to the servo and Arduino supply pins.

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 04:10:31 am
content: Quote from: KL27x on May 10, 2018, 03:29:08 amOk so maybe I have the transistor on the wrong end of the LED. Either way the transistor's collector and emitter has to be in series with the LED strip and run from + to ground, right? So I fail to see how the diagram is fundamentally wrong in that respect. Please elaborate or provide a sample diagram.Quote from: KL27x on May 10, 2018, 03:29:08 amThe servo is connected to the buck converter (positive) and the ground (negative). The triangle symbol is ground isn't it? At least it is in LTSpice. Additionally the control wire goes to the Arduino.Quote from: KL27x on May 10, 2018, 03:29:08 amI think it does. There is a wire from the 12v+ directly to the buck converter. What am I missing?

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 04:12:25 am
content: Oh I didn't notice you posted an image in your second post. I looked at it and yours is definitely organized better but I think they basically show the same thing. Or at least your image and mine are the same thing in my mind. I'm just using the 12V+ as the "12 volt rail" in your image. so it splits to the transistor and buck converter.I think your image basically confirms I was on the right track. Also it gives me a better idea of how to structure these diagrams. Thank you.

author: KL27x
author_rank: Super Contributor
timestamp: May 10, 2018, 04:35:44 am
content: Ahh..A little triangle is commonly used to denote ground, but it conventionally points down. An arrow pointing up usually denotes a power rail. Even despite this, I still see some minor errors in the schematic. Or maybe it's just too confusing for me.QuoteYeah. If you are trying to switch on the high side, with a transistor between the 12V rail and the LED strip, then you are going to have a problem. If you are using an NPN, then you will need to put something higher than 12V on the base to get a base-emitter current going, and the Arduino will output only 5V. If you are using a PNP on the high side, the Arduino pin will be exposed to 12V, and the ESD protection diode on the input pin will pull the base down to 5.3V. The Arduino will be unable to turn the PNP off. There is no way you can control the LED on the high side with only a single transistor without adding parts. (Or using a common positive rail and having -5 and a -12V rails.)The easiest way to do it is to switch it on the low side, like I have shown, using an NPN transistor or an NFET.The easiest way to switch it on the high side in this case, if that were necessary for some other reason, is to use a PFET or PNP transistor and switch that with an NFET or NPN transistor. And connect your Arduino to the base/gate of the N transistor.

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 05:24:08 am
content: The LED strip has a 12v pin and separate RGB pins. So the transistor would need to go on the low side to control each separately. I just drew my initial diagram bad. It will go on the low side.

author: Brumby
author_rank: Unknown
timestamp: May 10, 2018, 05:43:45 am
content: Quote from: Youkai on May 10, 2018, 04:12:25 amIt took me a while to make sense of your original circuit - because layout conventions guide our thinking.The general structure is something like this: Power rails tend to be horizontal lines, with potential (usually) defining their height: +V at the top, 0V at the bottom. If you have a split rail supply, then it will (usually) be +V at the top, 0V in the middle and -V at the bottom. Inputs from the left, as are power supplies (frequently); Outputs to the right; Feedback paths go wherever they need to go. Also pay attention to earth and chassis connections as well as off-page connections.Of course there are many circuits where you can't follow this 100% - but if you get the major logical process flow to run from left to right, you will have something easier to read.

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 06:04:11 am
content: Ah. Cool beans. I'll follow that in the future. Thanks

author: Youkai
author_rank: Regular Contributor
timestamp: May 10, 2018, 05:42:51 pm
content: KL27x what is the purpose of "Rb" in your diagram? Will too much current flow from the Arduino pin without it? How would I pick a value for that resistor?

author: KL27x
author_rank: Super Contributor
timestamp: May 10, 2018, 08:31:07 pm
content: B is for base. Without a base resistor, there is nothing limiting the current drawn from the Arduino pin. You should limit the base current to something around, say, 1/10th or 1/20th the current which is drawn by the LED strip. This is the energy "tax" for using a bipolar transistor. You might get away with less. The "Hfe" of the tranasistor can be found in the datasheet. An Hfe of 100 technically means that the transistor could switch up to 100x the base current; and there are transistors that go even higher. But due to variation between devices and other stuff I never bothered to learn, myself, I understand it is common practice to simply shoot for a base current of 1/10th the current of the load, when using a BJT as a switch.You could alternatively use N channel MOSFETS. A gate resistor is often used to prevent ringing, and to prevent temporary high draw from the Arduino while charging the gate. But it can often be omitted. OTOH, a pulldown resistor on the gate would be desirable, but not strictly mandatory, as well. So while it is totally possible to use an NFET driven directly by the Arduino without any additional resistors, it is common to use a gate resistor AND a pulldown resistor for a FET in this type of usage. You can decide if you would need those, yourself. I often drive (small!) FETs directly from a micro pin but there are often minor annoyances that can occur when leaving out the pulldown resistor... e.g., the LED strip might be energized before the Arduino starts to do what it is supposed to, and the LED strips might temporarily blink on when you first plug in the power because the gate of the FET happens to be floating high. Omitting a pulldown resistor on a FET gate can also leave the FET much more susceptible to death by static electricity when it's not plugged in. Common values for something like this might be 10R for the series resistor, 100K for the pulldown.The max current one of your Arduino pins is probably around 25mA, plus or minus 10mA. So your LED strips should be max of maybe 250-500mA draw if you want to switch them with single BJT. But don't use this 25mA max as what you will get without any base resistor. If you don't limit the current with a resistor, the pin will suffer internal voltage drop and heating and will not necessarily work as you think it will.Ohms law, voltage/resistance = current. Voltage from your Arduino is 5V, minus the drop across the B-E junction, which you can fudge at 0.6V. So 4.4V. Figure the current you need and you get your resistance. 4.4V/desired base current in amps = resistance in ohms.

author: Youkai
author_rank: Regular Contributor
timestamp: May 11, 2018, 01:36:09 am
content: There is a lot of good information there. Thank you.The current draw of my LED says it's 38mA (I'll round to 40 for the math). Attached is a picture of the "data sheet" from the assortment of transistors I got. My LED only needs 30mA or 0.0038A. So I could use the "smallest" transistor which is rated for 0.2A correct?Using your rule of thumb (10% of current) I want 4mA from the Arduino pin at 4.4v. That means an 1100 ohm resistor correct?According to the data sheet the transistor has an hFE of 200. So does that mean 200:1 amplification. I can't even get 200 times less current than 38mA from my Arduino pin can I? So would I just pick a resistor that reduces the current from Arduino to 1mA? Or do I use the standard 10% rule and a resistor on the emitter to prevent it from drawing too much current?Thanks again for all your help!

author: Youkai
author_rank: Regular Contributor
timestamp: May 11, 2018, 05:35:25 am
content: I worked on a new version of the diagram with your help. Hopefully this version is clearer/more correct. Also it has a little more detail. Please let me know if you see any errors or issues with the way I drew it.I do have some questions about the verbiage in the diagram. I tried to follow KL27x phrasing but I'm a little confused. Are (Vin, Vdd, Power) not all effectively the same terms? Is there some reason they are not all just labeled "Vin"? I guess it probably has something to do with the "type" of device they are? Same goes for (Ground, Vout, Vss). I guess in the case of the Buck I understand why there is Vin/Vout/Ground. But for the Arduino and the Servo it seems that Vdd/Power and Vss/Ground are the same thing. Any reason not to label them similarly? Also is the labels from the power rails and to the ground even necessary; or are they just on there for clarity?

author: Brumby
author_rank: Unknown
timestamp: May 11, 2018, 05:41:58 am
content: That is a LOT easier to read. Well done.

author: KL27x
author_rank: Super Contributor
timestamp: May 11, 2018, 07:51:19 pm
content: QuoteI'm not even sure what the second D in Vdd means. I use it because that's what it says on the datasheet, lol. But I understand at least one of the D's is for "drain," and that Vdd is used to denote the supply pin of device that is composed of mostly CMOS/FETs or to denote the logic bus/rail. In my domain this is usually a microcontroller or logic chip. When BJT logic chips were the thing, it was Vcc, not Vdd - presumably one of those C's was for "collector." Perhaps it stands for Voltage Drain-to-Drain, for CMOS logic push and pull output transistors.So as far as I know, Vdd is the same thing as power/supply, just a little more specific. The only reason I can come up with for not using Vdd/Vss for anything is that someone may come along and correct you, lol. Is there any reason to use Vdd/Vss, at all? Personally, I find it useful because it is very short and unambiguous to write and read, and it sorta designates what voltage is your logic rail. CMOS stuff typically operates at 1.8 to 5V, but depending on your circuit, it could be anything between.QuoteI dunno why I put those on there. Certainly not necessary until it is necessary. And here, it is not necessary.Yeah, your calculation of base resistor is fine. It's more of a stupidity check. It's not that critical. In this case, I'd use whatever resistor I had between 1K to 2k. Anything from 300R to 4K would probably be fine, depending on your duty cycle, perhaps. The higher you go, you might get less draw through your LEDs. I think maybe the Hfe will show how much the transistor would draw from an ideal power source, e.g., voltage source with zero impedance.* So you would add the impedance of the transistor to that of the LED strip, and you might not get "full power" when you go much higher than 1.1K, and it will dissipate some extra heat in the transistor, which is probably the main failure concern when you use too little base current. But as long as the transistor doesn't get hot at 99% duty cycle and the LED does what you want it to, then you have enough base current.*But this would depend on the absolute voltage, so I'm missing at least one piece of the jigsaw puzzle as to what Hfe is exactly a measure of. For most of the reasons one would have to know this stuff, the work is already done for us. We have opamps, voltage regulators, and buffer IC's to choose from, galore.The new schematic looks fine, to me.

author: Youkai
author_rank: Regular Contributor
timestamp: May 15, 2018, 06:12:02 am
content: I started doing a test wire up to see if it would work and I ran into a weird issue. I set my 3 PWM pins in arduino to have a 100% duty cycle so the LED would just be on and I could test the circuit. Then I started wiring it up. My green LED activated before the circuit was complete.If you look at the wiring diagram (left side of the graph paper) you can see how it was wired. When I attached the green wire to the collector (I think) of the transistor; the LED lit up even though the emitter was not connected to ground.On the right side of the graph paper I tried (and probably failed) to show you how the breadboard was wired; in case I have some very fundamental misunderstanding of how this should be hooked up. In that drawing the + is the 12V from the wall outlet. The arduino is being powered by USB from the computer.Additionally attached is a picture of the breadboard though I doubt that will be terribly helpful.Finally when I was doing some testing I plugged in the wall outlet and tested it with a volt meter. It read 17V even though the thing says it's 12VDC. Is that normal?

author: KL27x
author_rank: Super Contributor
timestamp: May 15, 2018, 10:09:59 am
content: It's been a lot of years since I used a TO 92 transistor.The first datasheet I pulled up for a 3904 NPN transistor shows C and E being reversed from what you have, there. That said, I tend to get it backwards on his particular package despite having the thing in front of me.If you have Arduino connected to base and the green LED strop cathode to the emitter, it's possible you have put enough reverse voltage on there to kill your transistor. There's a maximum Veb on a transistor. 3904, for example, is guaranteed for 6V minimum. You might also damage the Arduino.You also have no current limiting resistor on either of those transistors. This could damage the transistor, too. And it's not very nice to the Arduino, but probably not a killer by itself (if you had it wired the right way, at least).You also don't have a ground connection between the arduino and the breadboard/PSU. Even if they are both earth referenced, it's probably a good idea to add a direct connection so's your voltages are more stable.

author: Youkai
author_rank: Regular Contributor
timestamp: May 15, 2018, 05:31:29 pm
content: Yeah I didn't put the resistor from my wiring diagram in because I was just doing a quick and dirty test to see if I could get it to work and if my soldering as good. I only planned on running it for a minute so I figured if a little more current went through than was idea I would probably be ok.This post from earlier has the back of the package for the transistors:https://www.eevblog.com/forum/beginners/how-to-wire-this-setup/msg1531484/#msg1531484If I'm looking at the diagram correctly then; if you are facing the flat side the collector is the left-most pin. I believe I used the BC557B transistor.

author: Youkai
author_rank: Regular Contributor
timestamp: May 15, 2018, 05:46:21 pm
content: Oh! Hmm. I looked at the data sheet/that picure again. I guess the 557b is a PNP. I should use the 547b (an NPN) I guess. Does that provide a reason for this activity?EDIT: after a quick google of PNP transistors it seems that this is likely the cause. My arduino pin was acting as ground and current was flowing through without the need of the third terminal. If someone could confirm that would be appreciated.

author: Youkai
author_rank: Regular Contributor
timestamp: May 16, 2018, 07:50:18 pm
content: OK so I switched to NPN transistors and the circuit works now; at least the Red, Green, and Blue light up correctly when the Arduino tells them to.New problem though. The LED are SUPER dim. Also they are the same brightness whether the 12v supply is plugged in or not. The Arduino is using USB from the computer for power right now. So I guess that for whatever reason only the Arduino voltage is getting through.After a short web search I found this but I don't really understand it.https://electronics.stackexchange.com/questions/152960/bc547-bc548-with-5v-at-base-cant-control-12v-at-collector-emitterCan someone explain what is going on? Will a transistor not work? Is it just wired wrong? I'm using the wiring schematic from my earlier image:https://www.eevblog.com/forum/beginners/how-to-wire-this-setup/msg1531745/#msg1531745

author: james_s
author_rank: Super Contributor
timestamp: May 16, 2018, 08:48:57 pm
content: If you're using an NPN transistor, you need to set it up as a low side switch with the emitter grounded and the load between +12V and the collector. If you try to switch the high side with the collector connected to +12V what you will get is an emitter follower, the voltage on the emitter can never be higher than the voltage on the base. The circuit drawing you have looks correct for an NPN transistor.

author: Youkai
author_rank: Regular Contributor
timestamp: May 16, 2018, 09:08:47 pm
content: Ok thanks for that james_s. Still having weird issues though. Specifically the LED is super dim.It's wired like my diagram but for the sake of re-iteration it is working like this:+12V > LED common Annode > LED Red pin > Transistor CollectorArduino pin > 1k resistor > Transistor BaseTransistor Emitter > Ground (the ground of the 12V power supply)Using this setup the switching works correctly but the LED are VERY dim. What is wrong? Is it possible the arduino just isn't supplying enough current to fully turn on the transistor?

author: james_s
author_rank: Super Contributor
timestamp: May 16, 2018, 09:12:55 pm
content: Possible, how much current does the LED string draw? What's the gain of your transistor? A 1k base resistor is going to result in around 4mA base current, which with a typical small transistor should give you up to around 400mA.

author: Youkai
author_rank: Regular Contributor
timestamp: May 16, 2018, 09:36:44 pm
content: According to the specifications section of my LED strip (https://www.superbrightleds.com/moreinfo/flexible-led-strip-lights-color-changing/rgb-led-strip-light-flexible-custom-length-led-tape-light-with-9-smds-per-ft-3-chip-smd-led-5050/3502/) it draws 113mA per foot and I'm using only one section (3 led) which is well under a foot.What is the "symbol" for gain? This post farther up has the specs from the back of the package. I'm using the one on the far left.https://www.eevblog.com/forum/beginners/how-to-wire-this-setup/msg1531484/#msg1531484If gain is "hFE" then it's 200.

author: MarkF
author_rank: Super Contributor
timestamp: May 16, 2018, 09:58:55 pm
content: Quote from: Youkai on May 16, 2018, 07:50:18 pmFrom your last drawing, the 2N3904 transistor are wired backwards (emitter and collector swapped) and you are missing a bunch of grounds. See attachment #1.QuoteThe circuit referenced to is to turn on and off a 7805 regulator. Not really what you are trying to do. But, Q1 is acting like a high side switch and R2 pulls the base high to keep the transistor turned OFF (its normal state). Q2 is used to pull the base of Q1 low and turning it ON when a high signal is provided to the base of Q2. However, R1 should not be there and there should be a current limiting resistor is series with base of Q1. See attachment #2.

author: james_s
author_rank: Super Contributor
timestamp: May 16, 2018, 10:59:24 pm
content: I couldn't tell how the transistors are wired based on that schematic since the arrows are not shown, but for NPN you do want the emitter tied to ground and the collector to the load.

author: Youkai
author_rank: Regular Contributor
timestamp: May 17, 2018, 01:47:13 am
content: Attached is the most accurate diagram I can draw of my current test circuit. The LED is on the collector side of the transistors; ground on the emitter. The 3 grounds joining is all three going to the same rail in my breadboard.The Arduino is powered by USB so both the +V and GND are coming from the USB cable. The LED is powered by my wall outlet which is going to the +V and GND rails on the right hand side of the breadboard.In the picture of the breadboard the jumper wires are the color of the LED they are powering. From the left is the arduino pins. The short loops are the Emitter-to-ground. From the right is the cathodes of the LED strip.The Yellow/Black next to each other are +/- from the wall respectively. The black wire slightly lower in the positive rail goes to the LED common annode.Hopefully these two pictures will help you determine what my issue is. Thank you.

author: MarkF
author_rank: Super Contributor
timestamp: May 17, 2018, 04:09:09 am
content: Your circuit should look like attached.Looking at your breadboard picture, the emitters and collectors are swapped.The Arduino GND and the 12V GND should be connected together.Your 12V supply IS isolated?Correct?How many LEDs of each color are you trying to drive? Each LED will drop somewhere in the 1V to 2V range depending on the color. Driving them with 12V, you will only be able to drive about 6 LEDs of each color. I'm assuming the LEDs in the strip for each color are connected in series. I can't tell from the spec sheet.You will need a resistor in series with the collectors to limit the current for each LED color. To obtain the same brightness for each color, they will be different values because the volt drop across each LED will depend on its color.If you want to drive more LEDs, you will need a higher voltage with appropriate current limit resistors.

author: MarkF
author_rank: Super Contributor
timestamp: May 17, 2018, 04:30:11 am
content: Guessing from the picture of the strip, the current limit resistors (R4, R5, R6) are part of the strip for each group of 3 and you don't need them in your circuit.Each group of 3 would be in parallel and multiply the amount of current required to drive them.

author: Brumby
author_rank: Unknown
timestamp: May 17, 2018, 04:48:21 am
content: Quote from: MarkF on May 17, 2018, 04:09:09 amThis would be the FIRST thing I would attend to.

author: Youkai
author_rank: Regular Contributor
timestamp: May 17, 2018, 05:42:49 am
content: Quote from: MarkF on May 17, 2018, 04:09:09 amIf you look at the circuit picture I posted in the top right is the transistor image. I'm pretty sure on my transistor the C/E are swapped from the picture you posted. Am I really just completely brain farting on how I'm interpreting the image? I swear I tried this before and it caused some sort of weird crossover. I turned the transistors around and it's working now at a much more reasonable brightness. So one problem solved. Yay!Quote from: MarkF on May 17, 2018, 04:09:09 amAlso looking at your diagram how do I connect the arduino and grounds from the LED together? Do I just run a wire from the ground rail on my breadboard to the ground pin on the arduino? Won't that cause all of the current to run through the arduino? I would think that might be bad for it. In the final product everything will be powered by the 12V supply so if I use that ground for everything then it is effectively tied together correct?Quote from: MarkF on May 17, 2018, 04:09:09 amWhat does this mean? I don't know how to answer.Quote from: MarkF on May 17, 2018, 04:09:09 amOne segment of the strip currently so 3 LED. Eventually I will be using 2 segments so 6 LED total. I'll also be running the arduino and 3 servo's off of the power supply. The arduino and servo's after it goes through a buck converter. So I need to make sure the power supply has enough amps/voltage to run all of that?Quote from: MarkF on May 17, 2018, 04:30:11 amSomeone said in an earlier post that those were current limiting resistors. My current power supply only produces 500mA. Do I need to find a supply that produces more amps? Does the voltage of it matter; or will the current limiting resistors keep that to a value that will work for the strip? Where would I go to look for a wall outlet power supply? I tried the thrift shop to get this one but I'm guessing I should just find a site online that can sell me exactly what I need.MarkF, what tool did you use to draw your diagram?

author: MarkF
author_rank: Super Contributor
timestamp: May 17, 2018, 01:49:09 pm
content: Quote from: Youkai on May 17, 2018, 05:42:49 amI downloaded the spec sheet for a 2N3904 transistor:http://www.onsemi.com/pub/Collateral/2N3903-D.PDFQuoteYes. Just run a ground wire from the Arduino ground pin to the ground on the breadboard. This provides a reference for the Arduino signals to turn on/off each transistor.Dave did a video on "How not to blowup your scope" that maybe helpful:QuoteTHIS IS IMPORTANT FOR THIS AND OTHER PROJECTS YOU CONNECT YOUR ARDUINO TO. IF YOUR PROJECT GROUND IS NOT FLOATING, YOU COULD SEND A VOLTAGE INTO THE GROUND PIN OF THE ARDUINO AND DESTROY IT. MOST LIKELY, THE USB PORT CONNECTED TO YOUR COMPUTER IS PROVIDING A GROUND THROUGH TO COMPUTER'S POWER SUPPLY.Isolated (or floating) means there is NO connection between the AC Power of the 12V supply and the DC output.I would disconnect your wall-wart and do a continuity check between each AC prong and each DC output pin.QuoteI can only address the LED strip requirements. You will have to determine your total power requirements. I don't know what more you intend to do.QuoteI have attached a drawing of how I think the LED strip is wired. According to their picture, the big white objects on the strip are the LEDs and the little black objects are the current limit resistors. For individual LEDs the typical max current is 20mA with a voltage drop of 1V to 2V as a first guess in general terms without knowing the actual LED of interest.According to the link for the LED strip in your first post, each segment requires 9V to 14.8VDC with each three LED segment requiring 38mA. So, your 6 LED strip will use 76mA at 12V. Your 12V power supply will be sufficient for the LED and Arduino power conversion portions of your project.QuoteI'm using DipTrace to draw my circuit diagrams and layout PCBs. Their FREE version is limited to 300 pins on the PCB (Which is a lot for small boards). You can request a Non-Profit license for FREE that increases the PCB to 500 pins. The PCB tool also has a nice 3D visualization of the PCB before you send it out to manufacture.Download the DipTrace 3.2 Freeware version fromhttps://diptrace.com/download/download-diptrace/

author: MarkF
author_rank: Super Contributor
timestamp: May 17, 2018, 01:59:28 pm
content: Be aware the most of my 12VDC wall-warts actually output 15V.

author: Youkai
author_rank: Regular Contributor
timestamp: May 17, 2018, 05:17:09 pm
content: Ok lot of information there. I'll review later.I'm still a little confused about how to check if the power supply is isolated. Not quite sure what you mean by "DC output pin". I assume I need to use my multimeter to check for a circuit between each of the two prongs in the wall plug and some point on my breadboard. I'll try googling "check if power supply is isolated" or something similar to find a tutorial.Also yes I checked the voltage of my power supply and it actually runs at 17V. Good times.Quote from: MarkF on May 17, 2018, 01:49:09 pmIt looks like I cut it off in the picture but the asterisk on my package next to 2N3904 indicates that it has a "Different pinout". Looking at the diagram from the package (attached here again) it seems that the C and E are swapped on the BC547B (what I have) vs. the 2N3904 (your spec sheet). I attached a picture of the actual transistor if that helps.Just to triple check the cathode from the LED strip should go to the Collector of the transistor correct? If that's the case then that's the configuration that makes it very dim using the diagram on the package. If I turn it around so it's using the collector as described by your data sheet then it appears at normal brightness.Anyway thanks for all your responses. I'll do some testing and see what I can find.

author: james_s
author_rank: Super Contributor
timestamp: May 17, 2018, 11:38:42 pm
content: The vast majority of power supplies are isolated so that shouldn't be an issue. If you connect the ground from it to the ground on your Arduino and nothing blows up then it's isolated.

author: KL27x
author_rank: Super Contributor
timestamp: May 18, 2018, 12:26:31 am
content: QuoteNot exactly logical. Connecting the grounds together on this circuit should never cause anything to blow up whether or not either of the PSU's are earth referenced or isolated.*Because his circuit is working after getting the C and E's the right way around (and still devoid of any ground jumper), it is pretty obvious that both his PSU's are earth referenced. It's still a good idea to add a direct connection between both grounds to reduce any deviation from ground loops/leakage or whatnot.And OP, it's completely improper to draw up the schematic the way you did with a separate "USB ground" and "wall wart ground." If the two power supplies were actually isolated from each other, the circuit could not work. The transistor has two currents going on, one at 12V and one at 5V. But if you look at it, there are only 3 pins. Both currents, the Ice and the Ibe must flow through the emittor. Quid pro quo, the emitter must be connected to the negative rail of BOTH power supplies. Quid pro quo, both ground rails must be connected. Without the jumper wire, your psu's grounds ARE connected, but depending on what receptacle you plug your wall wart into, this connection could mean 10 or 20 feet or ground wire. There is going to be some voltage drop across this ground wire in your house's walls, depending on what's going on at either end of this wire. This little differential, if any, can be eliminated by adding the jumper wire locally, at your circuit.If you wanted to keep both power supplies isolated from each other, you must switch the current with some other device than a transistor. Such as an optocoupler or a relay of some sort.BTW, I went over all your problems in my post from 2 days ago.*OTOH, if you connected the positive rail of one PSU to the ground rail of the other, and "nothing blows up," then you can be sure that at least one of those power supplies is isolated.

author: Youkai
author_rank: Regular Contributor
timestamp: May 18, 2018, 02:28:02 am
content: Quote from: KL27x on May 15, 2018, 10:09:59 amAH I see KL27x. I must have just completely missed this as it went over my head. I understand it better now that I have a little more context. I'll run the jumper between the arduino GND pin and the breadboard ground rail.Thanks for your assisstance everyone. I'll update again later when I have some more progress.Anybody know where/what I would search for to find a wall wart that would be more appropriate for my use? (i.e. more amps) Is there some industry term for those things that I can google?

author: KL27x
author_rank: Super Contributor
timestamp: May 18, 2018, 03:38:13 am
content: I am partial to MPJA.com out of Florida. Overstocked and obsolete PSU's are their bread and butter. You can find what you need for very cheap, but there's a minimum shipping charge of something like 10.00 which might kill the deal, unless you need higher quantities and/or some of the other junk they sell. You pretty much need to know the voltage and the amperage you want, and you want to look at the PSU's that are cased/enclosed. Years ago I purchased a handy dual 12 and 5V brick for like 8.00 that would have met your needs, but this was probably a discontinued product. What they carry at any given moment will never be the same. Not good fora long-term volume project, but great for tinkering and one-offs.

author: KL27x
author_rank: Super Contributor
timestamp: May 18, 2018, 05:17:34 am
content: QuoteThe first important bit of almost every power supply is a transformer. The current that is induced on the other side of this transformer is completely isolated from everything else. Any potential created across the two leads of the secondary only exists between those two wires and nowhere else.In a simple DC PSU, there is a next a bridge rectifier and some filter caps. The bridge rectifier turns the AC into DC, and the filter caps smooth it out a bit. So now you have two wires with a DC potential between them, but they are still isolated from anything else. So either wire could be likened to the terminals on a battery. If you taped up one of one of the output (the positive or the negative), you could stick the other one anywhere you want, and nothing would happen. You could stick it in a toaster, you could stick it in a electrical socket, you could put it on your tongue (while standing barefoot on wet concrete), and nothing would happen. But don't do any of that. The PSU output wire won't affect the mains, but if you were not properly insulated from earth when you did it, you could be electrocuted.In most switching PSU, the negative wire is attached to the earth wire for safety reasons in case of a fault. This PSU is now earth-referenced. It produces X volts relative to earth grounding (and both rails have reference to mains live/neutral as well!). In many non-switching PSU, there is no connection. The most obvious way to tell is to count how many prongs are on the plug. 2 means it is definitely isolated. 3 means it is most likely earth-referenced, but to be sure you can just stick one probe on the 3rd ground prong and one on the negative output rail and do a continuity check. (While the psu is unplugged, of course). But your Arduino and transistor switched LED circuit, while a bit more complex in parts, is another way to confirm.

author: Youkai
author_rank: Regular Contributor
timestamp: May 19, 2018, 04:53:29 pm
content: Ok guys. I think I got it working. I have the arduino and the led strip wired and they work. After a fair amount of frustration I was able to write a program that cross-fades between an array of colors. That's all good.One minor issue though is if I useanalogWrite(pin, 0)it works great for the Green and Blue LED. They both turn off completely. When I use it on the Red LED though it stays on very dim. I assume this is because there is a tiny bit of current flowing still and the reds forward voltage is less than green and blue. Is this correct? If so what do I do to fix it?I think I need to add a resistor to bring the forward voltage on red below the threshold. Would I need to increase the resistor value for the base resistor that's already there or do I need to add an emitter resistor into the circuit?Thanks again for all your help guys! I'm almost there

author: MarkF
author_rank: Super Contributor
timestamp: May 19, 2018, 06:08:05 pm
content: Add a diode between the transistor emitter and ground. This will raise the threshold of the transistor base by 0.7V. The Arduino output pin will then pull the base below the threshold and fully turn off the transistor.

author: james_s
author_rank: Super Contributor
timestamp: May 19, 2018, 06:08:26 pm
content: With the transistor off it shouldn't matter what the forward voltage is. Do you have a leakage path somewhere that is allowing the transistor to partially turn on?

author: Youkai
author_rank: Regular Contributor
timestamp: May 19, 2018, 08:26:29 pm
content: A little more testing; if I pull the red transistor then the green would turn on. But if I pulled the green and red; blue would stay off. Weird. Anyway:I turned the transistors around. The package for my transistors says the pinout for my model is different than the other ones you guys looked up. I think they are going the correct direction now. This is the orientation that was super dim in the past. This time though I have that jumper between the arduino ground and wall wart ground so they are tied. I wonder if that fixed the dimness issue. Anyway with this orientation they turn completely off; and are working at full brightness.Seems to be fine now.

author: james_s
author_rank: Super Contributor
timestamp: May 19, 2018, 10:56:18 pm
content: Yeah it sounds like that's right then, if they're working then you have it connected properly. I'm not entirely sure what was going on before, maybe the protection diodes in the IO pins of the microcontroller were conducting enough current to switch on one of the other transistors.

author: Youkai
author_rank: Regular Contributor
timestamp: May 21, 2018, 06:30:32 pm
content: I wonder if not having the grounds tied together before is what was causing it to be super dim when it was wired with the transistor in the correct orientation. That's the only thing I can think of that has changed between then and now. I didn't have the jumper from Arduino ground to Wall Wart ground before.

author: MarkF
author_rank: Super Contributor
timestamp: May 21, 2018, 07:24:37 pm
content: I believe that was exactly the cause of the LEDs beinig super dim. There would not have been any return current path for the Arduino outputs. You could try to verify this by removing the ground jumper to the Arduino.Sorry it took me so long to reqlize you were using the BC547B transistor instead of the 2N3904 and that you had them wired correctly in the first place.

author: Brumby
author_rank: Unknown
timestamp: May 22, 2018, 05:02:05 am
content: Quote from: Youkai on May 21, 2018, 06:30:32 pmThat is why I said this:Quote from: Brumby on May 17, 2018, 04:48:21 amWithout a solid ground connection, any voltages between the two sections of your circuit would have been from parasitic and non-obvious sources. Gettinganythingto happen was a miracle.