0
\$\begingroup\$

Purpose of attached circuit: driving a solenoid (cabinet lock) from microcontroller through relay with a 5 volt coil.

Components:

  1. ATMEGA8
  2. Relay 5 volt with NO Contact
  3. Solenoid 12 volt
  4. power supply 12 volt
  5. Regulator 7805 to generate 5 volts

enter image description here enter image description here

Operation:

  1. On state of controller pin: relay is energized and the contacts close and 12 volt feeds the solenoid and it is working well.
  2. Off state of controller pin: relay is still energized and for sure the solenoid is still active. ( 3.9 volt is still there on the output pin of the controller.)
  3. Off state of controller pin (in case the solenoid is disconnected from the circuit): relay is ee-energized, and it is working well as expected.

Note:

  1. Logic in controller drives the output only.

  2. The 7805 regulator is not mentioned in the above circuit.

    Can you help me to find the issue which leads the output of the controller to be forced to high when the solenoid is connected and the controller output should be low?

\$\endgroup\$
  • \$\begingroup\$ Is it a BJT where "Input from MC" is written ?? \$\endgroup\$ – Sadat Rafi Mar 31 at 17:18
  • \$\begingroup\$ Plus the diode is in the wrong place. It should be across the coil. \$\endgroup\$ – Sadat Rafi Mar 31 at 17:18
  • \$\begingroup\$ @SadatRafi doide between termianl of coil (5)and ground(2) i mean output from mc and input to interface circuit \$\endgroup\$ – Ahmed kamal Mar 31 at 17:25
  • \$\begingroup\$ This circuit totally wrong. Wait I'll give a diagram soon. \$\endgroup\$ – Sadat Rafi Mar 31 at 17:26
  • \$\begingroup\$ @Sadat: The OP's diode is across the coil and it's even the right way up. Have another look. OP is switching relay positive, not GND, and directly from the MCU (which may have been overloaded and the output is now stuck on high). \$\endgroup\$ – Transistor Mar 31 at 17:47
1
\$\begingroup\$

Your circuit should be like this.

enter image description here

enter image description here

These two are screenshots of the proteus simulation results. You have placed diode in the wrong position, plus haven't used a BJT / MOSFET. ATMEGA 8 can have a maximum 5.5 volts. I hope this will work.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ thanks for your help ,the relay which connected to solenoid is 5 volt why i need to add transistor ? \$\endgroup\$ – Ahmed kamal Mar 31 at 17:45
  • \$\begingroup\$ ATMEGA 8 can provide a maximum 40mA current per pin and 200mA per register. That's why you will need a transistor to increase the current. I prefer MOSFET over BJT. \$\endgroup\$ – Sadat Rafi Mar 31 at 17:57
  • 1
    \$\begingroup\$ His diode is in the same position @SadatRafi \$\endgroup\$ – skvery Apr 1 at 10:17
  • \$\begingroup\$ He hasn’t used BJT. \$\endgroup\$ – Sadat Rafi Apr 1 at 20:29
0
\$\begingroup\$

You need a transistor or mosfet to handle the relay current.

For me the simplest would be the circuit below:

schematic

simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ if current of Solenoid is 600ma why i can't use MOSFET direct to control the solenoid without relay in between. \$\endgroup\$ – Ahmed kamal Apr 1 at 12:28
  • \$\begingroup\$ Yes you can. Just make sure that 600 mA is the peak and not the average current or link a datasheet in your question. You can also then use nmos like VN10KM \$\endgroup\$ – skvery Apr 1 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.