[Solved] LM358 pin2 connect - Page 1
Forum section: electronics / beginners

author: g-lock_dk
author_rank: Contributor
timestamp: September 16, 2024, 08:58:06 pm
content: hey allI have a wemos connected to a MCP4725 dac and it works, but the the 5V output from the dac is not enough I need 10V so a asked for help and was told to get a LM358 upamp to boost the output of the dac, but I can´t figure it out how to connect it I use a 12V PSU to the LM358 it will give me 12V output but I just going to make a hard limit in my code in the wemos so it max out at 10Vits for an old light fixture that use a 1-10VDC for dimmerbonus question where do I put the nagative wire from my light fixture on my circuit?pin 1: +0-10V outputpin 2:? what to do about itpin 3: output from the DACpin 4: -12V from PSUpin 5-7: not connectedpin 8: +12 PSU

author: magic
author_rank: Super Contributor
timestamp: September 16, 2024, 09:23:06 pm
content: To go from 5V to 10V you need 2x gain, so you feed back 1/2 of output voltage (pin 1) to IN-.In short, two equal resistors in series from OUT to GND and IN- connected in the middle.Look up how to set up an opamp in "noninverting" configuration if you want to know how it works.You may get away with pin 4 at GND and without a -12V supply. The device you are controlling goes between GND and OUT.But wait, a light fixture dimmer? Mains powered? Are you sure that the 10V control input isn't sitting at some dangerous voltage?

author: g-lock_dk
author_rank: Contributor
timestamp: September 16, 2024, 10:25:55 pm
content: Yes there is a dimmer in my light fixtureI made a circuit diagramI tried to google noninverting and got nowhere I feel like a caveman in a digital age I need HELP

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 17, 2024, 12:16:15 am
content: Here's a caveman edit with some arbitrary resistor values. Not sure what the common is on the dimmer input, but I connected the common from the Op-Amp circuit to what I assume it is. ( Marked with ?? )Make sure you heed magic's warning that "Dimmer-0-10V" might be connected to mains voltage. Itmustbe isolated from "mains power L1" and "mains power N"...

author: g-lock_dk
author_rank: Contributor
timestamp: September 17, 2024, 12:25:04 am
content: thanks Kimgonna try it, after i got some ZZZ its 2.24 here so should be sleeping already but work got in the way

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 17, 2024, 12:25:14 am
content: Can you post a link to this "light fixture"? That way we can check if it's safe to interface with it in this manner.

author: g-lock_dk
author_rank: Contributor
timestamp: September 17, 2024, 12:54:17 am
content: here you go kim but i have already tried it with a variable power supply and it works

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 17, 2024, 03:34:08 am
content: It's probably isolated, but be careful just the same.It's not guaranteed to be isolatedaccording to this article, and from a safety point of view, you should treat these low voltage wires as potentially having mains voltage on them. (In the event of a fault)

author: g-lock_dk
author_rank: Contributor
timestamp: September 17, 2024, 10:50:57 pm
content: hey kim just wanted to let you know that it worked (tested on the bench with a multimester), i give the upamp 12V but the output is only 10V but that is fine the dimmer only goes up to 10Vstill need to do some work on the projekt but the upamp was the hardest partmaybe I write a post when its finished

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 17, 2024, 11:01:02 pm
content: The Op-Amp, via the two resistors, will only go up to 10V with a 5V input. (The ratio of the two resistors sets the gain)If it's not quite reaching 10V, you could increase it's supply voltage to 14V or so. Or use a rail-to-rail Op-Amp instead.

author: Zero999
author_rank: Super Contributor
timestamp: September 18, 2024, 09:04:03 pm
content: Please don't draw op-amps like that. It might help you wire it up, but it hinders your understanding as the pin numbers are meaningless when it comes to how the circuit works. Use the proper symbols. If you want put pin numbers on them, to aid wiring.The unused op-amp needs to be correctly terminated. In this case, the LM358 will work with its inputs at the negative rail, so it can be wired up as a non-inverting unity gain amplifier, with the input connected to ground.To prevent oscillation, it's a good idea to add a decoupling capacitor across the supply rails of the op-amp.

author: g-lock_dk
author_rank: Contributor
timestamp: September 18, 2024, 10:31:39 pm
content: sorry Zero999 Im still a cavemanI was looking for a product but couldn't find anything so I decided to build it,so what is the projekt?The project integrates an old analog 1-10V dimmer with Home Assistant to automate desk lighting. A Wemos D1 Pro controls the dimming via an MCP4725 DAC, but since the DAC only outputs up to 5V, an LM358 op-amp is used to boost the signal to 10V. An LDR measures natural light and adjusts the lamp's brightness for optimal lighting. A 5V relay module is used to control the 230V power to the lamp. The goal is to maintain ideal lighting based on ambient conditions and with the integration to Home Assistant, my zigbee remote controls can now also control the lamp.

author: Zero999
author_rank: Super Contributor
timestamp: September 19, 2024, 07:21:52 am
content: Quote from: g-lock_dk on September 18, 2024, 10:31:39 pmThe pin out is on the first page of the data sheet.You've missed the points about the unused op-amp and supply decoupling.An unused op-amp can sometimes become unstable if left with the inputs unconnected, as you've shown. Pins 6 and 7 need to be connected togeter and pin 2 should go to pin 4.A capacitor should be connected, across the power supply pins: 8 and 4, so provide a stable, low impedance power supply voltage for the op-amp.One problem with op-amps and indeed other elecronic circuits is, it might work on the bench, even if improperly designed, yet be unreliable in the long term, so it's better to get it right first time.QuoteIt is a pain you need an op-amp and 12V power supply. There are lamp controllers which will work with PWM input, or a variable resistor.

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 19, 2024, 08:21:19 am
content: You probably can PWM it anyway. A transistor and a resistor to level shift, and maybe a capacitor to smooth the signal out.

author: g-lock_dk
author_rank: Contributor
timestamp: September 19, 2024, 10:50:46 am
content: Zero999 >> im a caveman I know, I came here for help, not to be mocked. I know I'm so stupid and so bad when it comes to electronics. but I'm trying to learn

author: Zero999
author_rank: Super Contributor
timestamp: September 19, 2024, 06:46:43 pm
content: Quote from: g-lock_dk on September 19, 2024, 10:50:46 amThat wasn't my intention. What did I post which you took to be mocking?What do you not understand? Please ask specific questions.