Simple Electronics I Think

Discussion in 'General Electronics Chat' started by r_james14, Apr 23, 2010.

  1. r_james14

    Thread Starter New Member

    Apr 23, 2010
    Hi there
    I am currently making a circuit however struggling with one component,

    I have a microcontroller which outputs 5volts, this goes to an electromagnet, i want the magnet to hold a metal object until the 5v goes off, the problem i have is the magnet holds a little voltage.

    I remember from my uni first year something about a pull down resistor? i hoping that when my output from uC goes the any remaining voltage is pulled down? does anybody have any ideas


  2. t06afre

    AAC Fanatic!

    May 11, 2009
    Your microcontroller will most probaly not be able to deliver the current needed to activate the relay. You need to boost the output current. This can be done by a simple transistor. Take a look here section 4, transistor as a switch
  3. SgtWookie


    Jul 17, 2007
    You might consider using a power MOSFET instead of a transistor.

    A transistor's current source or sink current is determined by it's base current.
    A typical uC's source or sink current is <=25mA per I/O pin. There is also a package limit, and limits on current flow for Vdd/Vcc/GND/Vee pins. If you exceed any of these limits, you may damage/destroy the uC. I suggest using no less than a 220 Ohm resistor from an I/O pin to a transistor's base to avoid exceeding the pin source/sink current limit.

    A MOSFET is a voltage controlled device. Logic-level MOSFETs work just fine on 5v. The gate acts more or less like a small capacitor. Charge the gate to where Vgs=5, and the MOSFET turns on. Discharge the gate to where Vgs=0, and the MOSFET turns off.

    "Vgs" is the voltage on the gate terminal, using the source terminal as the reference point.

    You would connect one terminal of your electromagnet to a current source, and the other terminal to the drain terminal of an N-channel logic-level MOSFET.
    The gate of the MOSFET is controlled by your uC, via a resistor.
    The source terminal of the MOSFET would be connected to ground.

    You will need a suitable diode connected across the electromagnet coil in reverse bias (cathode towards the +V supply, anode to the drain terminal) to take care of the reverse-EMF spike that will occur when the MOSFET is turned off. Otherwise, the voltage spike can be vry high voltage, and may destroy the MOSFET and/or other electronic devices.

    You didn't mention how much current your magnet requires. However, here's a nifty N-ch logic level MOSFET capable of sinking 2.5A, and it comes in a very convenient 4-pin DIP package which is great for prototyping and hobbyists: