LM317 Questions - Page 1
Forum section: electronics / beginners

author: Jbouss
author_rank: Contributor
timestamp: March 19, 2022, 10:14:41 pm
content: Hello all, I am working on a project with an LM317 regulator. I am using the LM317 to take 12Vin and get 3.3Vout. I used an online calc to determine the resistor sizes but bumped the 1uF cap to 10uF because I had 10uF caps around, and was told this was ok. My problem is, I am only getting 2.1Vout instead of 3.3Vout.Why is my output lower than expecteed? Is this related to the higher uF cap? If so, can I adjust resistors as needed to achieve 3.3Vout?Another question, I was not planning to use a heat sink for the LM317, should I? As mentioned I am using the regulator to bring my 12V to 3.3V, but I am only using this 3.3V to activate a relay. The LM317 doesn't seem to be heating up, however, I don't know how it would react when running 24/7.Please let me know what kind of questions come up. I appreciate any help and thank everyone in advance.[ Specified attachment is not available ]

author: Circlotron
author_rank: Super Contributor
timestamp: March 19, 2022, 10:18:39 pm
content: You need to swap the position of R1 and R2.

author: tunk
author_rank: Super Contributor
timestamp: March 19, 2022, 10:32:28 pm
content: And I think you have to connect 3.3VO+ directly to the LM317 OUTPUT, not through the resistor.

author: Jbouss
author_rank: Contributor
timestamp: March 19, 2022, 10:43:53 pm
content: There is something wrong with my schematic too, when I switch my resistors to the right place, I only get 0.7V.

author: Jbouss
author_rank: Contributor
timestamp: March 19, 2022, 10:45:02 pm
content: If I take my 3.3Vout direct to +, where do I connect the resistor?

author: langwadt
author_rank: Super Contributor
timestamp: March 19, 2022, 10:59:25 pm
content: fix schematic.

author: Jbouss
author_rank: Contributor
timestamp: March 19, 2022, 11:14:54 pm
content: Thank you langwadt!That was it, 3.3 out:)Any feedback on the heat sink will be appreciated as well. Do I need to add a heat sink or will it be ok without it?

author: Ian.M
author_rank: Super Contributor
timestamp: March 19, 2022, 11:49:33 pm
content: Impossible to tell. A TO-220 package in free air is generally reckoned (rule of thumb) to be good for about 1W dissipation in a 'shirtsleeve' environment. Your regulator will be dropping 8.7V, so if your load averages over 110mA, it will most likely overheat without a heatsink. Detailed thermal characteristics should be in your LM317 datasheet so if you've got the max. ambient temperature, and know the max. input voltage and output current, the need for a heatsink (and if needed, how good it must be) can be calculated.N.B. Unless you can guarantee your 3.3V load *ALWAYS* draws over 6mA, your R1 should be reduced to 120 ohms (and R2 in proportion) to meet the LM317 worst case min. load current requirement of 10mA. Failure to meet the min. load current requirement can result in loss of regulation and overvoltaging your load.

author: Jbouss
author_rank: Contributor
timestamp: March 20, 2022, 12:54:13 am
content: Appreciate the feedback. I should play it safe and use a heat sink.120Ω and 200Ω will create 3.3V as well, I will switch those if those are better values? One question though, I am using the 3.3V to power a (255-1478-ND) relay. The coil rating on the datasheet says 66.7mA is the coil current. Does that mean the load will be 66.7mA?

author: MarkF
author_rank: Super Contributor
timestamp: March 20, 2022, 01:43:57 am
content: You have the absolute bare minimum circuit to have something work.I would at least follow the typical application circuit in the datasheet.

author: Ground_Loop
author_rank: Frequent Contributor
timestamp: March 20, 2022, 02:44:48 am
content: If you're just using that 12 V to drive a relay then you might as well just use a resistor in series with the coil. The 317 is essentially doing the same thing. Nonetheless, I always use an adjustable resistor with 317s as shown in the data sheet. You'll have difficulty getting bang on voltages with fixed value components without a lot of trial and error.

author: not1xor1
author_rank: Frequent Contributor
timestamp: March 20, 2022, 08:12:10 am
content: Quote from: Jbouss on March 20, 2022, 12:54:13 amthat is a 3Vpanasonic relaytwo 68Ω (1/2W or 1W) resistors in series with the relay coil should workof course a 12V relay would be better

author: srb1954
author_rank: Super Contributor
timestamp: March 20, 2022, 04:13:58 pm
content: Quote from: Jbouss on March 20, 2022, 12:54:13 amSwitching to the lower values would be better. The LM317 routes its internal quiescent operating current through to the Vout pin and consequently requires load current of 10mAminimumto sink this current otherwise the output voltage might rise uncontrollably.If you don't have any otherfixedcircuit load to guarantee sinking this 10mA minimum current the normal approach is to size resistor R1 sufficiently low (< 125) to set the minimum load current. R2 is also scaled down, in proportion to R1, to set the required output voltage.

author: Jbouss
author_rank: Contributor
timestamp: March 20, 2022, 05:09:38 pm
content: Thanks for all the comments!Since I am essentially using the regulator as a voltage divider I thought the bare minimum would suffice. I agree I could have used resistors only but since I am new to electronics, I wanted to learn about the LM317 and so far it has been fun to play.I am using a 3V relay because the 3V will be flowing through a series of switches that are rated for 3V. The goal is if one of the switches opens the relay will collapse, and a 12V LED warning light will turn on. I am using the 12V from the LED warning lights power supply to regulate my 3V. Attached is a more detailed schematic of the full project.I am really focused on the circuit working and being safe, so if I need to add more that is fine but I would like to understand why. Currently, the 3V relay draws 60-70mA(this is the only thing the 3V is being used for) and the LM317 is running about 50C. This will be running 24/7, therefore, I want to ensure long-term reliability.Lowering my R1 resistor and adding a heat sink to the LM317 is easy enough so I will make those adjustments. Should I add a bridge rectifier, another cap, and a couple (Zener?)diodes for this application? Does my schematic make sense, or do I need to make adjustments?All the feedback is appreciated, reaching out to the forum has been amazing.

author: TERRA Operative
author_rank: Super Contributor
timestamp: March 20, 2022, 05:28:42 pm
content: Your ring of switches is acting as a dead short across the output from your voltage regulator.....

author: themadhippy
author_rank: Super Contributor
timestamp: March 20, 2022, 06:13:28 pm
content: silly question but why not just use a 12V relay

author: Ian.M
author_rank: Super Contributor
timestamp: March 20, 2022, 06:28:31 pm
content: It depends on whether you want the relay to be energized or deenergized with all switches closed. If energized, the loop of switches needs to be in series with the relay coil.If deenergized is the objective, one way to do it would be to use an 18.7 ohm resistor to make the LM317 into a 66.8mA current source (remove R2, fit 18.7 ohm for R1 and take output from Adj) that can then safely be shorted by the loop of switches as you have the relay and switch section drawn. If you change the relay, you'll need to change the current source to match its nominal coil current. N.B the total on resistance of all the switches *MUST* be at least an order of magnitude less than the coil resistance. However a better approach would be to use a PNP transistor (with a high enough collector current rating for the load) as a high side switch for the LED tower. The emitter goes to +12V, the collector to the resistor feeding the LED tower, and the base is pulled down by a resistor chosen to give a base current of 5% - 10% of the expected collector current. The loop of switches is then wired base to emitter to turn the transistor off till one opens. No moving parts, runs cool (if the transistor is properly specified), so should be far more reliable long term. N.B. an extra resistor chosen to drop 2.5V at the planned base current, or if the base current is under about 25mA, a LED with a Vf of about 2.4V, may be put directly in series with the base to increase the voltage across the switches to about 3.3V for 'wetting', needed if they don't have precious metal or conductive elastomer contacts.

author: Jbouss
author_rank: Contributor
timestamp: March 20, 2022, 06:53:08 pm
content: Again thanks for the feedback.The reason I am not using a 12V relay is that the switches are only rated for 3.3V. That said, I want the relay always to be energized NO, so if one of the switches opens, the relay closes to my 12V supply, and my warning light lights up. The relay coil is around 40Ω, but I am unsure of the switch resistance. I believe it will be very low, basically, the wire connecting them in series, the switch itself is only about 1Ω, but will have to look into the total resistance.I will look into using a PNP transistor instead. If I am understanding correct this would eliminate the need for the relay and LM317? It may take some time for me to figure out, but I will post something if I do.[ Specified attachment is not available ]

author: edavid
author_rank: Super Contributor
timestamp: March 20, 2022, 07:05:33 pm
content: What kind of switch is only rated for 3.3V? I've never heard of such a thing.

author: Jbouss
author_rank: Contributor
timestamp: March 20, 2022, 07:15:40 pm
content: The switches are custom pressure switches that measure water flow.I should say, the switches are only ever used with 3.3V, as for the rating, I do not have the actual spec. I am playing it safe based on what I know.

author: tooki
author_rank: Super Contributor
timestamp: March 20, 2022, 08:27:33 pm
content: In that case, don’t control a relay with them at all, especially without a freewheeling diode: if those switches are really not capable of more than 3.3V, the inductive kick of a relay will smite them instantly.I’d definitely use a semiconductor based solution, like a solid state relay.

author: MarkF
author_rank: Super Contributor
timestamp: March 21, 2022, 11:14:02 am
content: I don't see how you're going to apply 3.3V across each switch if they are all in series.Are the contacts in the pressure switches separate from the power?

author: srb1954
author_rank: Super Contributor
timestamp: March 21, 2022, 01:32:24 pm
content: Quote from: Jbouss on March 20, 2022, 06:53:08 pmThere is no need to go to the complexity of having a separately regulated supply just for the switch circuit.A much simpler solution would be to just use a NPN transistor to directly switch the LEDS. Connect the base of the transistor to the +12V supply through a resistor, say 2k2, and connect the series-connected switches across the base and emitter of the transistor. The emitter is connected to 0V and the top of the LED string is connected to +12V while the bottom of the LED string is connected to the tansistor collector.When all the switches are closed the base is shorted to the emitter and the transistor is switched off and no current flows through the LEDS. If any switch is opened the short is removed from the base-emitter and the transistor turns on illuminating the LEDs. The maximum voltage that appears across any switch is limited by the 0.7V drop across the base-emitter junction of the transistor.The circuit complexity is reduced to just 2 components rather than 6 and you are eliminating an expensive relay.

author: Jbouss
author_rank: Contributor
timestamp: March 21, 2022, 11:42:11 pm
content: Tooki, thanks for pointing out the need for a flyback diode. If I go this route I will add one in.I am working on a transistor solution based on the feedback, but am not sure if I drew it out correct? Also, how do I go about picking a transistor for my application, any recommendations?[ Specified attachment is not available ]

author: Circlotron
author_rank: Super Contributor
timestamp: March 22, 2022, 12:27:41 am
content: The GND (negative supply rail) connection should be on the emitter of the transistor.Also the LEDs are drawn connected reverse polarity.The transistor type is not very critical. Something simple and readily available like say a 2N2222 should do just fine.

author: Jbouss
author_rank: Contributor
timestamp: March 22, 2022, 12:37:03 am
content: Great, Thank you!I have learned a lot through all the feedback. I am going to order the transistor, and test it out:) Is the 2k2 resistor ok?[ Specified attachment is not available ]

author: edavid
author_rank: Super Contributor
timestamp: March 22, 2022, 01:10:26 am
content: I think you are getting ahead of yourself, because you have not explained what these "switches" are.If they are mechanical switches, there is no way they would be limited to 3.3V.If they are electronic sensors, you have to provide power somehow. Putting them in series is highly unlikely to work.

author: Jbouss
author_rank: Contributor
timestamp: March 22, 2022, 01:33:49 am
content: They are pressure switches activated by water flow. There is a dome-like structure inside that collapses when enough flow is present and that closes the switch. During their normal operation, they are connected to a system that uses a 3.3V signal to tell whether the switch is open or closed. This is how I know they can withstand 3.3V. In all likelihood, they could probably withstand 12V, but I do not know.Out of the system, the switch works the same, when enough water flow is present the switch is closed, if water flow is lost, the switch opens. I want a light to indicate if an open event occurs, so my thinking was: If the switches are in series and closed with 3.3V running through them activating a relay(or transistor), as long as my circuit is wired correctly, if a switch opens, it will collapse my relay and turn on 12V to my light.I'm sorry, I am new to electronics and am having a hard time understanding why putting the switches in series will not work? Thank you for your feedback.

author: Circlotron
author_rank: Super Contributor
timestamp: March 22, 2022, 01:42:56 am
content: If they are switches with mechanical contacts similar to what a relay has, i.e two pieces of metal that touch, then all should be good. If they have some kind of semiconductor switch e.g. Hall effect then that gets a bit more tricky. But from your description it sounds like it should be perfectly okay.

author: edavid
author_rank: Super Contributor
timestamp: March 22, 2022, 01:48:49 am
content: OK, that clarifies things a bit.Since they are mechanical switches, you can put them in series.Do you have a datasheet?(BTW, are they pressure switches or flow switches? Those are 2 separate things.)

author: Jbouss
author_rank: Contributor
timestamp: March 22, 2022, 01:53:23 am
content: Unfortunately no datasheet:(I think they are flow switches. They use water pressure to activate, but, ~1.2PSI of air pressure will activate them on a bench.

author: Circlotron
author_rank: Super Contributor
timestamp: March 22, 2022, 02:07:09 am
content: How many wires come out of each switch? If there are only two then it sounds like they are a mechanical switch.

author: edavid
author_rank: Super Contributor
timestamp: March 22, 2022, 02:18:27 am
content: Quote from: Jbouss on March 22, 2022, 01:53:23 amWhy do you think they measure flow?And if they are pressure switches, what is the point of using more than one of them? Isn't the pressure the same everywhere in the system?

author: Jbouss
author_rank: Contributor
timestamp: March 26, 2022, 01:46:15 am
content: Hi Again, I got my transistor kit and tried out the below schematic, and there is something wrongCurrently, when I apply power, my LED tower just comes on.[ Specified attachment is not available ]

author: srb1954
author_rank: Super Contributor
timestamp: March 26, 2022, 05:29:38 am
content: Quote from: Jbouss on March 26, 2022, 01:46:15 amShould work. What transistor did you use? Have you triple checked the transistor leads are connected in the right order?You can check that the transistor is working by applying a direct short between the base and emitter - the LEDs should go out.N.B. your drawing title is confusing - this is a actually an NPN transistor, which is the correct type for this circuit configuration.