Author Topic: [Solved] LM358 pin2 connect  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
[Solved] LM358 pin2 connect
« on: September 16, 2024, 08:58:06 pm »
hey all

I 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 10V

its for an old light fixture that use a 1-10VDC for dimmer
 
bonus question where do I put the nagative wire from my light fixture on my circuit?

pin 1: +0-10V output
pin 2: ???? what to do about it
pin 3: output from the DAC
pin 4: -12V from PSU
pin 5-7: not connected
pin 8: +12 PSU
« Last Edit: September 18, 2024, 10:40:13 pm by g-lock_dk »
 

Online magic

  • Super Contributor
  • ***
  • Posts: 7215
  • Country: pl
Re: LM358 pin2 connect
« Reply #1 on: September 16, 2024, 09:23:06 pm »
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?
« Last Edit: September 16, 2024, 09:31:32 pm by magic »
 

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: LM358 pin2 connect
« Reply #2 on: September 16, 2024, 10:25:55 pm »
Yes there is a dimmer in my light fixture

I made a circuit diagram

I tried to google noninverting and got nowhere I feel like a caveman in a digital age I need HELP
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1713
  • Country: ca
Re: LM358 pin2 connect
« Reply #3 on: September 17, 2024, 12:16:15 am »
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. It must be isolated from "mains power L1" and "mains power N"...
« Last Edit: September 17, 2024, 12:20:25 am by Kim Christensen »
 
The following users thanked this post: g-lock_dk

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: LM358 pin2 connect
« Reply #4 on: September 17, 2024, 12:25:04 am »
thanks Kim

gonna try it, after i got some ZZZ its 2.24 here so should be sleeping already but work got in the way :)
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1713
  • Country: ca
Re: LM358 pin2 connect
« Reply #5 on: September 17, 2024, 12:25:14 am »
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.
« Last Edit: September 17, 2024, 12:27:32 am by Kim Christensen »
 

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: LM358 pin2 connect
« Reply #6 on: September 17, 2024, 12:54:17 am »
 here you go kim but i have already tried it with a variable power supply and it works
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1713
  • Country: ca
Re: LM358 pin2 connect
« Reply #7 on: September 17, 2024, 03:34:08 am »
It's probably isolated, but be careful just the same.

It's not guaranteed to be isolated according 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)
 

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: LM358 pin2 connect
« Reply #8 on: September 17, 2024, 10:50:57 pm »
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 10V

still need to do some work on the projekt but the upamp was the hardest part

maybe I write a post when its finished
 

Offline Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1713
  • Country: ca
Re: LM358 pin2 connect
« Reply #9 on: September 17, 2024, 11:01:02 pm »
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.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19937
  • Country: gb
  • 0999
Re: LM358 pin2 connect
« Reply #10 on: September 18, 2024, 09:04:03 pm »
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.
 

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: LM358 pin2 connect
« Reply #11 on: September 18, 2024, 10:31:39 pm »
sorry Zero999 Im still a caveman

I 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.
« Last Edit: September 18, 2024, 10:50:19 pm by g-lock_dk »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19937
  • Country: gb
  • 0999
Re: LM358 pin2 connect
« Reply #12 on: September 19, 2024, 07:21:52 am »
sorry Zero999 Im still a caveman

I was looking for a product but couldn't find anything so I decided to build it,
The 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.

Quote
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.
It 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.
 

Offline ArdWar

  • Frequent Contributor
  • **
  • Posts: 695
  • Country: sc
Re: [Solved] LM358 pin2 connect
« Reply #13 on: September 19, 2024, 08:21:19 am »
You probably can PWM it anyway. A transistor and a resistor to level shift, and maybe a capacitor to smooth the signal out.
 

Offline g-lock_dkTopic starter

  • Contributor
  • Posts: 10
  • Country: dk
Re: [Solved] LM358 pin2 connect
« Reply #14 on: September 19, 2024, 10:50:46 am »
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
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19937
  • Country: gb
  • 0999
Re: [Solved] LM358 pin2 connect
« Reply #15 on: September 19, 2024, 06:46:43 pm »
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
That wasn't my intention. What did I post which you took to be mocking?

What do you not understand? Please ask specific questions.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf