Author Topic: How to wire this setup?  (Read 6661 times)

0 Members and 1 Guest are viewing this topic.

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
How to wire this setup?
« on: May 02, 2018, 06:36:46 pm »
I am working on planning a setup that will have the following in it:

The 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.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to wire this setup?
« Reply #1 on: May 02, 2018, 07:33:43 pm »
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.
 

Offline tpowell1830

  • Frequent Contributor
  • **
  • Posts: 863
  • Country: us
  • Peacefully retired from industry, active in life
Re: How to wire this setup?
« Reply #2 on: May 02, 2018, 07:47:47 pm »
I am working on planning a setup that will have the following in it:

The 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.

You 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?
« Last Edit: May 02, 2018, 07:51:21 pm by tpowell1830 »
PEACE===>T
 

Offline kjr18

  • Regular Contributor
  • *
  • Posts: 198
  • Country: pl
Re: How to wire this setup?
« Reply #3 on: May 02, 2018, 07:55:17 pm »

What is the current output capacity of your 12 V supply?

First photo says 12V 500mA, but he might have some other power supplies.
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #4 on: May 02, 2018, 08:29:06 pm »
You 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?

The 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.
 

Offline tpowell1830

  • Frequent Contributor
  • **
  • Posts: 863
  • Country: us
  • Peacefully retired from industry, active in life
Re: How to wire this setup?
« Reply #5 on: May 02, 2018, 10:08:21 pm »
You 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?

The 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.

Oops, 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.
« Last Edit: May 02, 2018, 11:15:40 pm by tpowell1830 »
PEACE===>T
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to wire this setup?
« Reply #6 on: May 02, 2018, 11:00:50 pm »
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.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: How to wire this setup?
« Reply #7 on: May 02, 2018, 11:01:43 pm »
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.
« Last Edit: May 02, 2018, 11:05:38 pm by KL27x »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to wire this setup?
« Reply #8 on: May 02, 2018, 11:07:06 pm »
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.
 
The following users thanked this post: KL27x

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #9 on: May 03, 2018, 02:20:37 am »
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?
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: How to wire this setup?
« Reply #10 on: May 03, 2018, 02:59:33 am »
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.
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #11 on: May 10, 2018, 03:14:24 am »
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?
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: How to wire this setup?
« Reply #12 on: May 10, 2018, 03:29:08 am »
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.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: How to wire this setup?
« Reply #13 on: May 10, 2018, 03:39:35 am »
[Imgur](
)

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.
« Last Edit: May 10, 2018, 03:52:30 am by KL27x »
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #14 on: May 10, 2018, 04:10:31 am »
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?
Ok 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.


The servos need to be connected to both 5V positive rail and to ground. You have no ground connection on them.
The 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.

The buck converter should have its Vin connected to the 12V supply rail.
I think it does. There is a wire from the 12v+ directly to the buck converter. What am I missing?
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #15 on: May 10, 2018, 04:12:25 am »
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.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: How to wire this setup?
« Reply #16 on: May 10, 2018, 04:35:44 am »
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.

 
Quote
Either way the transistor's collector and emitter has to be in series with the LED strip and run from + to ground, right?
Yeah. 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.
« Last Edit: May 10, 2018, 04:59:53 am by KL27x »
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #17 on: May 10, 2018, 05:24:08 am »
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.
 

Online Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: How to wire this setup?
« Reply #18 on: May 10, 2018, 05:43:45 am »
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.

It 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.
« Last Edit: May 10, 2018, 05:45:41 am by Brumby »
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #19 on: May 10, 2018, 06:04:11 am »
Ah. Cool beans. I'll follow that in the future. Thanks
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #20 on: May 10, 2018, 05:42:51 pm »
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?
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4099
  • Country: us
Re: How to wire this setup?
« Reply #21 on: May 10, 2018, 08:31:07 pm »
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.

« Last Edit: May 10, 2018, 09:18:39 pm by KL27x »
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #22 on: May 11, 2018, 01:36:09 am »
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!
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: How to wire this setup?
« Reply #23 on: May 11, 2018, 05:35:25 am »
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?
 

Online Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: How to wire this setup?
« Reply #24 on: May 11, 2018, 05:41:58 am »
That is a LOT easier to read.   Well done.  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf