-2
\$\begingroup\$

I am doing a project of magnetic levitation like this.enter image description here

I have two linear hall sensors which will give me the position of levitating magnet. I have set a specific position of magnetic object by reading the differential output of sensors at that position. After that i calculate the error and run the PID control algorithm to produce a signal that will goes to h bridge which will amplify the signal and provide supply to electromagnet according to control signal. Control signal will be larger if floating magnet will too far and smaller if too neer.But I am not able to levitate an object. Anyone did this? Please come forward and help me. I will provide more details if required.

https://www.youtube.com/watch?v=XjjBqzilkIc

\$\endgroup\$

closed as unclear what you're asking by Dmitry Grigoryev, Enric Blanco, Wesley Lee, Voltage Spike, pipe May 8 '17 at 17:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    \$\begingroup\$ Hi Waseem, provide more details, it is required. \$\endgroup\$ – bummi Feb 27 '16 at 9:29
  • \$\begingroup\$ Sir, i have updated question. If you have any question ask me. \$\endgroup\$ – Waseem Usman Feb 27 '16 at 11:18
  • 2
    \$\begingroup\$ You have shown us a photo of someone else's setup. His is working. Show your setup. You haven't said what is working and what isn't. Please try and imagine what information your reader would need to help you. Then add the information in your original question. \$\endgroup\$ – Transistor Feb 27 '16 at 11:33
  • \$\begingroup\$ You need to test each piece of the system and make sure its working. For example, make sure your actually getting the correct position from the hall effect sensors. \$\endgroup\$ – Voltage Spike May 8 '17 at 15:15
4
\$\begingroup\$

I have done this successfully, but with just a single linear hall effect sensor. I used a position sensing scheme where the field strength of the magnet being levitated was sampled synchronously with the electromagnet PWM, in such a way that the measurements were taken only when the electromagnet current had decayed to zero.

This might be hard to program with the arduino environment, but using the plain AVR-GCC compiler it is trivial to trigger an interrupt for ADC sampling slightly before the end of each PWM cycle.

The sensor was mounted directly on the bottom of the electromagnet. Feeding the field strength samples directly to a PID controller is not optimal, as the readings do not correlate linearly with distance. Thus I calculated a distance estimate with a 10 point linearization curve.

Update:

1-How can we detect PWM's falling edge using internal interrupt ?

You use timer/counter 1 in fast PWM mode, set the output compare unit A to generate the PWM waveform and set the output compare unit B to generate an interrupt a few cycles before the timer overflows (and the next PWM pulse begins). You write an interrupt handler that responds to that interrupt by starting an ADC conversion.

2-Which type of control strategy you used i.e PID or something else.

A single PID control loop.

3-How can we estimate distance with linearization curve.

3) You move the magnet to a known distance, write down the ADC output, move the magnet 1mm closer, write down the output and repeat until you have covered the entire levitation range. Then in your program you find the two closest known values to the ADC reading, and linearly interpolate between the two to estimate the distance in that range.

\$\endgroup\$
  • \$\begingroup\$ Thank you sir. I understood your logic but i have some questions here. 1-How can we detect PWM's falling edge using internal interrupt ? 2-Which type of control strategy you used i.e PID or something else. 3-How can we estimate distance with linearization curve. \$\endgroup\$ – Waseem Usman Feb 27 '16 at 14:45
  • \$\begingroup\$ @Waseem Usman See updated answer. I am on mobile, I cannot write a more comprehensive answer, but I can respond to questions. \$\endgroup\$ – jms Feb 27 '16 at 16:53
  • \$\begingroup\$ @jms: Does this work by sensing the field of the suspended magnet during the 'off' periods? \$\endgroup\$ – Transistor Feb 27 '16 at 16:58
  • \$\begingroup\$ @jms I will try this and will inform you about outcomes. Sir i have directly connected the arduino 5v to Hall sensor A1302 Vcc and also ouput pin of hall sensor directly to adc pin of arduino without any filter. What is your suggestion either i have to filter output or just leave it unfiltered. \$\endgroup\$ – Waseem Usman Feb 27 '16 at 17:16
  • \$\begingroup\$ @jms how many times i must have to read adc in a second? \$\endgroup\$ – Waseem Usman Feb 27 '16 at 17:31

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