# Not able to levitate magnet for magnetic levitation project

I am following a hackster project on magnetic levitation here - https://www.hackster.io/jsirgado/magnet-levitation-with-arduino-eeeee4

However, I have followed everything but still, it's not working.

Here are changes to the circuit I made:

1. The electromagnet which I am using is that of 5V instead of 12V
2. The transducer which I am using is ss8050 instead of TIP120
3. Hall sensor is tapped just at the bottom of the electromagnet

Update:-

The best I can do is to make the magnet jump up and down fast but it never levitates. Have tried changing PID setting from the project as aggressive and mild but still didn't achieve the final result.

I need advice from an expert to tell me what I am doing wrong here. All components are in good condition and 5v electromagnet is strong enough.

So what am I missing here?

• "... but still, it's not working." What is not working? Does the electromagnet work when you connect it directly to the 5 V supply? Does it work on a 12 V supply? If not, what is the resistance of the coil? What is the current rating of your power supply? Put all the information into your question and remove the code if that's not the problem. Explain clearly what you expect to happen and what does happen. Give voltage and current readings. – Transistor Mar 30 '19 at 17:38
• It will fail unless you use the correct parts and voltages. Substitutions must have similar or better specs. not worse. or lower current rating and lower input power – Tony Stewart Sunnyskyguy EE75 Mar 30 '19 at 17:43
• Magnetic levitation schemes like this are inherently unstable, so with constant excitation to the electromagnet the magnets will always either fall away or jump to the electromagnet. This means that the only sign of levitation that you'll get is just a hint: you'll see a markedly different ("markedly" as in 1/4 inch or so) distance at which the permanent magnets will fall away from the electromagnet with no excitation, and the distance at which the permanent magnets will fall away with 5V drive. – TimWescott Mar 30 '19 at 17:49
• @SunnyskyguyEE75 the electromagnet, at least, looks like it'll do the job, as long as the drive circuit is adequate for higher current at the lower voltage. – TimWescott Mar 30 '19 at 17:52
• electromagnet works and it's designed for 5v only – suu Mar 30 '19 at 19:31

All CMOS drivers have an Ron resistance with a wide tolerance, for Vout="1","0"

$$\ ~~~R_{on}=\frac{(Vdd-Voh)}{Iol} ,\frac{V_{ol}}{I_{ol}}\$$ 3.3V logic family is 25 Ω, and 5V logic family is 50 Ω ±50%

# $$\I_b=\frac{(V_{dd}-V_{be})}{\frac{(Vdd-Voh)}{Iol}+R_s}\$$

- if using 3.3V logic which is a 25 Ohm driver
- to NPN @ 60 mA base current with specs of VBE(sat)=1.2V @ 80mA, Vbe (on)= 1V @ 10mA
- Choose Rs = 10 Ohms from 60mA=(3.3V-1.2V)/(Ron+Rs) 2.1V/60mA=35 Ohms
- driver Pd= 60mA*3.3V = 200mW shared by driver, Rs and Vbe

- if using 5V logic which is Ron= 50 Ohm driver
- Choose Rs = 13 Ohm from 60mA=(Vdd-Vbe)/(Ron+Rs)

simulate this circuit – Schematic created using CircuitLab

• Would any other experts like to weigh in on my solution? – Tony Stewart Sunnyskyguy EE75 Mar 30 '19 at 20:41
• oops I forgot the clamp diode – Tony Stewart Sunnyskyguy EE75 Mar 30 '19 at 20:43
• Why is the first part of your post a screenshot? – duskwuff -inactive- Mar 31 '19 at 4:03
• I liked the colours invoked with the editor more. Did you like how I pulled out the relevant specs and then concluded the issue was the driver base R meanwhile the 5x 25kg electromagnet is due to it's surface area and only 2x in this situation – Tony Stewart Sunnyskyguy EE75 Mar 31 '19 at 6:44
• I am using 5v external power supply for the electromagnet, will the circuit still be the same? – suu Mar 31 '19 at 11:02