See the sketch... I successfully was able to trigger solenoid with a 741-OP-AMP and a TIP42 Transistor. How I thought I was suppose to wire it up did not work but after some trial and error it works the way it is wired up in the sketch.
My question is that even though this works the way I have it setup... is it a correct way to go about doing so?
Do I even need the '741'?
I thought the '741' would act like a digital relay and assuming the 'Output' pin7 would be 12v- once enabled by an input. But in fact I get 10v out Pin7 when high. So I used the 'TIP42' to not only carry the load but to supply 12v to the solenoid.
Without a proper schematic drawing I won't attempt to try and figure out how you have everything wired. Learning electronics includes learning how to communicate via schematic drawings and symbols. It is the universal language of electronics. You are just hurting yourself by skipping that step. Breadboard set-up should be performed only after first creating the design in schematic form, not the other way around.
You don't need an op-amp. A transistor has enough voltage & current gain to drive a solenoid. You need a current-limiting resistor on the transistor's base and you should have a protection diode across the coil to protect the transistor from the "kickback" when you turn the solenoid off. Look for some examples.
You also don't use PWM with solenoids. PWM is used for things like dimming a light/LED or for controlling the speed of a motor. A solenoid is either on or off.
An op amp doesn't "act like a relay". It can be used in a lot of circuits and a lot of different ways, but a solid-state relay has optical isolation and is a whole different animal.
You don't need a relay either. You can build a solid state relay from an opto-isolator and a transistor, MOSFET, or TRIAC, etc. Or, you could actually build a mechanical relay from a solenoid and a switch!
DVDdoug:
You don't need an op-amp. A transistor has enough voltage & current gain to drive a solenoid. You need a current-limiting resistor on the transistor's base and you should have a protection diode across the coil to protect the transistor from the "kickback" when you turn the solenoid off. Look for some examples.
You also don't use PWM with solenoids. PWM is used for things like dimming a light/LED or for controlling the speed of a motor. A solenoid is either on or off.
An op amp doesn't "act like a relay". It can be used in a lot of circuits and a lot of different ways, but a solid-state relay has optical isolation and is a whole different animal.
You don't need a relay either. You can build a solid state relay from an opto-isolator and a transistor, MOSFET, or TRIAC, etc. Or, you could actually build a mechanical relay from a solenoid and a switch!
That is what I thought that I could just get by using a transistor. I think I found a MOSFET IRFZ44 will work.
PWM on a solenoid is used all the time I thought? (Fuel Injectors, TCC modules, etc.) Depending on the solenoid operating range of HZ for the duty cycle.
So back to my existing setup with the OP-Amp and the TIP42. The circuit work perfectly how its suppose to. When the potentiometer is low the solenoid is open, when I ramp up the potentiometer the solenoid starts ramping from a 10% duty cycle all the way up to 100%, obviously how I have it written in code to do. But wiring the transistor how it says the correct way to does not work. So this is how I got it to work...(OP-In(P2) = 5v PWM), (OP-V-(P4) = 12v-), (OP-V+(P6) = 12v+), (OP-Output(P7) to Base (1) of Transistor), (Collector(2) to 12v-), (Emitter(3) to Solenoid (-)).... So I don't know. It works and I get a pulsed 12v to the solenoid while the being triggered from 5v.
If I remove the OP-Amp and just use the Transistor it doesn't give me 12v output nor the with an LED inline to see the LED never goes low it only pulses low. :0
The 741 is a very poor choice of op-amp (in fact its a waste of money in digital circuits) as it needs both +ve and -ve voltages! use one of the upto date single rail op amps.
If I remove the OP-Amp and just use the Transistor it doesn't give me 12v output nor the with an LED inline to see the LED never goes low it only pulses low.
That is because you have wired the transistor wrong. You have an emitter follower instead of an amplifier configuration.
Grumpy_Mike:
That is because you have wired the transistor wrong. You have an emitter follower instead of an amplifier configuration.
That is one problem - just one. The op-amp is being used to act as a logic level converter because the transistor is wired incorrectly.
I haven't seen anyone else comment on the crazy 220 ohm resistor between the Arduino ground and the 12V supply ground. That must tend to foul up the operation sooner or later. This seems to be one of the more commonly misunderstood concepts here, that when separately powered circuits are connected, all the grounds must be connected together.
This seems to be one of the more commonly misunderstood concepts here, that when separately powered circuits are connected, all the grounds must be connected together.
So apart from an isolated system using isolated couplers when would you not connect the grounds together and still have it work?
Grumpy_Mike:
That is because you have wired the transistor wrong. You have an emitter follower instead of an amplifier configuration.
That is one problem - just one. The op-amp is being used to act as a logic level converter because the transistor is wired incorrectly.
I haven't seen anyone else comment on the crazy 220 ohm resistor between the Arduino ground and the 12V supply ground. That must tend to foul up the operation sooner or later. This seems to be one of the more commonly misunderstood concepts here, that when separately powered circuits are connected, all the grounds must be connected together.
So the op-amp took the 5v logic from the Arduino and made it a 12v logic??
I did find out later that yes, all grounds should be tied together without a resistor. I just didnt update my sketch.
Feeding a 741 with a 12V supply you are never going to get 12V on the output. But you persist in ignoring all advice to ditch the 741.
Fantastic, I just love people who do that, arrange these words into a well known phrase or saying as they used to say on the TV.
Waster Time.
What else have you forgotten to do?
Well provide a schematic of what you are trying to do for a start as retrolefty requested for starters.
You have to be accurate and tell the truth if you want sensible advice and guidance here.
I see why your called Grumpy Mike.... I was simply trying to make sense of what I had with those two components (741, and TIP42) and how they are working together to accomplish my end result.
I appreciate everyone's input on this because it does help.