Offline
Jr. Member
Karma: 4
Posts: 68
|
 |
« on: January 28, 2012, 07:08:00 am » |
Hello, here is a magnetic levitation project realized with arduino. The suspended ball is a permanent magnet whose distance from the electromagnet is measured by a hall effect sensor placed under the coil. The digital control loop is a PID algorithm that modulates a PWM output to energize the electromagnet through a MOSFET. A voltage regulator is used to provide a fixed voltage and to limit the current in the coil (the schematics can be found in attachment).
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 87
Posts: 9360
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #1 on: January 28, 2012, 09:27:19 am » |
Cool!, well done
Code ?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 4
Posts: 68
|
 |
« Reply #2 on: January 28, 2012, 09:50:27 am » |
You can find the sketch file in attachment. Basically it consists in the following functions:
1) PWM setup to change the frequency from the default value (490 Hz) to 3921 Hz; 2) A command handler used to configure the controller gains and setpoint through the serial line (when arduino is connected to USB cable); 3) A state machine that manages the transition between OFF, IDLE and CONTROL modes (this to avoid the controller to turn on the electromagnet at full power when the ball is not in range); 4) The control loop.
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 87
Posts: 9360
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #3 on: January 28, 2012, 12:40:37 pm » |
I forwarded the tube to a teacher at a technical school this afternoon and he was so enthousiastic he thinks about adding it as a exercise in the semester.
Thanks again (also for the code),
|
|
|
|
|
Logged
|
|
|
|
|
Cairns - Green Island for Winter
Offline
Full Member
Karma: 2
Posts: 148
|
 |
« Reply #4 on: January 28, 2012, 03:50:02 pm » |
Any chance of a picture? Edit - when I logged in am -no videos but schematic pic was there I think videos might have been turned off for a time by the server. Good as gold now thanks
|
|
|
|
« Last Edit: January 29, 2012, 06:10:58 am by tytower »
|
Logged
|
Governments should do what they were designed to do only. Manage the larger issues best done by Government. My Family and my Property are not Government issues. To stop corruption give them 3 times the normal penalty. Have them agree on first appointment.
|
|
|
|
Offline
Jr. Member
Karma: 4
Posts: 68
|
 |
« Reply #5 on: January 28, 2012, 04:17:48 pm » |
I forwarded the tube to a teacher at a technical school this afternoon and he was so enthousiastic he thinks about adding it as a exercise in the semester.
Thanks again (also for the code), good! It' a nice didactical project indeed.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 4
Posts: 68
|
 |
« Reply #6 on: January 28, 2012, 04:22:28 pm » |
Any chance of a picture? Hi, look at the attachment. As you can see the connections are done on a breadboard...it's just an experiment.
|
|
|
|
|
Logged
|
|
|
|
|
Espoo, Finland
Offline
God Member
Karma: 6
Posts: 581
"Oops, try again..."
|
 |
« Reply #7 on: January 28, 2012, 04:43:51 pm » |
Time for a contest! Who can create longest gap!!!
Two of these and I could hang a painting on the air?
Cheers, Kari
|
|
|
|
|
Logged
|
The only law for me; Ohms Law: U=R*I P=U*I Note to self: "Damn! Why don't you just fix it!!!"
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
Arduino rocks
|
 |
« Reply #8 on: February 26, 2012, 04:12:03 pm » |
Thanks much for sharing. I have a very similar project, but I'm driving the magnet through a D/A and then an opamp instead of with a PWM signal. I'm wondering if you ran into problems with the hall effect picking up both the field of the electromagnet and the field of the levitated magnet. I was planning on using two hall effect sensors (one at each pole of the electromagnet) and looking at the difference in the signals. This should give a good reading on the levitated magnet.
Also, how did you come up with your PID values? Did you model the system in Matlab or something similar? Or did you just experimentally come up with the values?
-Patrick
|
|
|
|
|
Logged
|
|
|
|
|
ਪੰਜਾਬ
Offline
Edison Member
Karma: 4
Posts: 1221
WANTED! A Girl with LOVE for me and Arduino!
|
 |
« Reply #9 on: February 29, 2012, 03:42:14 am » |
PID Values? ,How you managed them?
|
|
|
|
|
Logged
|
"Real Men can Accomplish Anything" - Website - skype : nishants5 ਫ਼ਤੇਹ ਕਰੂਂ !
|
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #11 on: March 01, 2012, 11:27:47 pm » |
Super cool! I'll think about making this or having this made. That's the fun of being a teacher, you can order students to make things and that's all for their learning  Considering this for instrumentation course because of PID and its application, also as a PR show item like my rotating stage with POV display. I thought Si had one and thanks for posting so someone looking for this later sees two projects to learn from! I shamelessly saved every file in a folder 
|
|
|
|
|
Logged
|
|
|
|
|
UK
Offline
God Member
Karma: 9
Posts: 895
Twitter: @simonmonk2
|
 |
« Reply #12 on: March 02, 2012, 04:19:26 am » |
At some point, I will update mine to use a Hall sensor - I still have long term dreams of a planetarium ceiling populated with floating, rotating planets!
However, one power outage and it would be raining celestial bodies!
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 87
Posts: 9360
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #13 on: March 02, 2012, 04:12:44 pm » |
An evil genius would use a 2nd hand nuclear reactor from a Borg space ship - or if those are out of stock, a car battery as backup for the power supply. idea ! -> Arduino as intelligent UPS controller 
|
|
|
|
|
Logged
|
|
|
|
|
Hamme, Belgium
Offline
Sr. Member
Karma: 3
Posts: 383
|
 |
« Reply #14 on: March 02, 2012, 05:07:55 pm » |
@robtillaart sssst He is an evil genius and he wrote a book about being it
|
|
|
|
|
Logged
|
|
|
|
|
|