Controlling intensities of an 12v electromagnet using PWM signals

Hi everyone!

I'm new to electronics stuff :sob: & pls pardon me for my stupid questions.

Here is what i'm going to do:
I want to suspend a magnet+weight(variable(0-250g)) in midair by using an electromagnet.
For sensing the position of the hanging object, i'm using 2 ratiometric hall effect sensors above & below the electromagnet.
If the object is near to electromagnet(by the signals of sensors), i need to control the intensity of electromagnet by PWM signals to move it down & in the same way if the object that is hanging is moving away from the electromagnet because of increase in weight i need to pull it up to the specified position.

The gap between the electromagnet & the object(with permanant magnet) should be 1.5 -2 cm.

Please help me in:

  1. How many no. of turns in electromagnet & which thickness of magnet wire should I choose to be wound around a soft ferrite rod for a 250g weight to get suspended in midair. The permanent magnet which i'm using with the object is N52 neodymium magnet.
    2)Can i directly connect this electromagnet with PWM pin? Will the arduino blowup as load is inductive?
  2. How can i vary the intensities of the electromagnet according to the values from hall sensor? As arduino output is only 5v, here electromagnet takes 12v. I need a circuit for this.
    I want the valves & schematic diagrams for the above. I need them soon to start my project.

Please someone help me in my Project :confused: . Any help is appreciated.
Thanks in advance

What you are trying to do is generally possible but maybe not the way you try to aproach it. Pm me and i'll send you a text on magnetism. It is essential that you comprehend this fully before attempting trying to do what you are trying to do.

For your questions:

  • that depends on the dimensions of the magnetic circuit. Read the text and you will know more.
  • In order to vary flux and flux density you will have to vary current. Also this current will be much higher than the arduino pins can handle. So you will need some kind of current controller, possibly with some built in hardware feedback
  • What you are trying to do is difficult. The force exerted in a magnetic circuit is dependent on flux denisity. When the force is strong enough to lift the magnet/weight the reluctance of the magnetic circuit will lessen. This will increase the flux density and thereby the force making it very hard to balance the force against gravity. I guess you will have to regulate against both the absolute value and the derivative of the flux density

I haven't made one of these myself, but I found a pretty good selection of schematics on Google by searching "magnetic levitator". Here's an excellent tutorial about the subject:

http://amasci.com/maglev/magschem.html

When each Hall switch is turned on, it pulls down on the voltage at the base of the first NPN transistor. This turns that transistor off. As a result, the 10K resistor can pull up on the base terminals of the two power transistors. This turns the NPN PWR transistor on, and it turns the PNP PWR transistor off. This connects +24 volts to the electromagnet coil, and a current appears in the coil. A magnetic field appears, which turns the Hall switch off, and this causes all of the transistors to change state. The current in the electromagnet coil reverses, which turns off the Hall switch, and the whole cycle repeats. As a result, the device acts like a buzzer, the Hall switch turns on and off very rapidly, and the magnetic field wiggles north and south a little, but the average field is zero. When a magnet pole approaches, the Hall sensor starts keeping the coil switched to north longer than to south (or vice versa) in order to cancel out the field, keeping the field inside the sensor averaging at just about zero.

Based on the above description , it would seem that the Hall sensor could be replaced by an arduino controlled mosfet (or transistor ie: 2n2222 ) and a resistor to pull down the transistor base by a current set by the resistor. Possibly a PWM pin would work , using an analogWrite statement.