You are viewing an old copy of my site. See more recent work here.

"Electromagnetic Suspension: A Digital Control System"

Progress log for reference/anyone interested. Hopefully, I will post lots of pictures and use this as a reference later on.

About the author: My name is Chris King and I am a junior in high school. Electronics projects have always interested me. In the past I have completed several other high level projects such as solid state tesla coils, and AVR microcontroler based projects. I hope you find this project interesting. Feel free to contact me by sending mail to: cr99991@gmail.com.

Section 1: A Proposal

I decided to start this log about 2 weeks into this project. I intend to use this page to provide a reference for anyone interested in my project and the work that I did. First a brief overview of what this project intends to accomplish:

Description of Project

The aim of this project is to design and build a digital system capable of holding a small ferromagnetic object stationary and in equilibrium with gravity at any point in a predefined area of space.

This project will be tested in 3 phases as follows:

Phase 1:           Use an Atmel AVR series microcontroller to develop a “One-Dimensional” system capable of suspending an object on any point on a line. A simple analog system has already been built as proof of concept for this design.

Phase 2:           Using two electromagnets rather than one as in Phase 1, design a system that is able to hold a ferromagnetic object at any location on a 2D plane. In this phase, the processing power of the microcontroller becomes very important due to the dependance of the system on completing the necessary calculations in order to hold the suspended object stable in space.

Phase 3:           Provided that phase 2 is a success, Phase 3 aims to hold the suspended object at any point in the area of a triangular prism. Phase 3 involves the use of three identical electromagnets and six Hall effect sensors in a feedback system to hold the levitated object in a stable position.

Electrical Details and Design of System

An “Atmel AVR series Mega128” microcontroller provides the computational power needed to determine the velocity of the suspended object and apply an appropriate amount of pulse-width modulated power to each of three electromagnets in order to hold the ferromagnetic object in equilibrium with gravity. Software and/or hardware dampening will be used to limit any unwanted resonance from occurring in this closed-loop system.

The positioning system consists of six Hall effect sensors (in phase 3 testing) that will be used along with a system of operational amplifiers (op-amps) to accurately sense the position of the suspended object on three axes (X, Y, and Z).

Pulse-width modulation (PWM) was chosen as the method of power control in the electromagnetic switching section of this design over linear regulation due to the absence of an integrated digital- to- analog converter in the design of the AVR series microcontrollers. Using PWM also enables the device to perform with more efficiency than the use of comparable linear technologies would allow.

Power switching of the electromagnets will be accomplished with power MOSFET transistors. Inductive dampening will consist of three Schottky diodes in antiparallel with the primary electromagnets to clamp any inductive voltage spikes produced in the power control process.

Nature of Research

This project falls within the topic of electromechanical engineering and design. Possible applications of the technology are in healthcare, material handling, and industrial applications. A system like the one being developed would allow for precise and isolated control of substances that would normally be very difficult to manipulate with conventional techniques.

Section 2: An Analog Start

Having the basic outline out of the way, lets get to the good stuff. First of all, the idea for this project came from a levitating globe I saw online. I became interested and did some research online.
The site that really caught my eye was http://my.execpc.com/~rhoadley/magsus.htm. The author designed a system similar to what would be found in a levitating globe and used it to hold small magnetic objects. While the design did work for the author, I found the design to be much more complex than needed for the given application. I was off to design my own circuit. From the 10 or so op-amps the aforementioned design used, I cut it down to three op-amps, allowing me to use a single quad op-amp chip and a single PWM controller chip. My design was not only simpler, but it also offered an object dropout protection circuit that deactivated the device when the levitated object fell or was pulled away.

A basic outline of the operation of my analog mark 1 design is as follows:
1. Take measurements of the field strength of the top and bottom ends of an electromagnet using Hall efect sensors.
2. Subtract the readings to null out the the state of the electromagnet.
3. Amplify the subtracted result. Both steps 2 and 3 are actually accomplished at the same time using a differential op-amp.
4. Put the result through a lead-compensation circuit for stability.
5. Amplify the result to compensate for the atuation effect of the lead-compensation.
6. Check the result using a comparer for protection against object dropout.
7. Input the resulting voltage generated in steps 1-6 to the input of a "TL494" PWM chip to generated the output waveform.
8. Feed the generated square wave to the gate of a MOSFET.
9. Use the MOSFET to switch the flow of current into the electromagnet mentioned in step 1 on and off at about 20KHz.

*Useful articles about lead compensation: Here and here (PDF files)

These nine seemingly complex steps are actually done on a very compact circuit board that I etched. The entire device uses 12VDC input at up to about 2a to hold a small object (like a soda can) in equilibrium with gravity.


This mark 1 design actually went through 3 designs before I decided on the one I liked best and etched a board for it.



Section 3: Digital Project Basis

The above analog analog system provided a good model of how this kind of system should behave. This project is focused on the use of a system with three electromagnets rather than one as used in my first analog design.

The first aspect of this project I worked on was the mechanical design of the actual electromagnetic coil assembly. I wanted an efficient and neat arrangement so I decided to have the coil forms and support structure laser cut from acrylic. I also designed several circuit boards to hold the six required Hall effect sensors in their proper positions above and below the electromagnets in a symmetrical arrangement. These boards focused on an efficient layout to minimize electrical interference in the signal electronics as well as losses due to eddy currents induced in the copper traces of the sensor boards.

For prototyping this design, I will be using an Olimex AVR-MT-128 board which includes an Atmel Mega128 microcontroller as well as a simple interface and an LCD screen. If time allows, after getting this board working with my design, I intend to design my own "all in one" controller specifically for this project.

I am confident that if i can get a 1 axis system working in this digital configuration the migration to a 2- and 3-axis system will be easier.

I assembled a simple op-amp circuit to test the behavior of the sensors in a differential configuration. The results were positive and I was quite impressed with the accuracy of the system. A diagram of my proposed analog input to ADC section is shown above.

So far this system is being powered by an older computer power supply due its offering of easily available +5v, -5v- and +12v lines. If time permits, I may design or at least modify a power supply for a better integrated solution for powering this project.

Section 4: Basic ADC conversion

I'll be using "AVRlib" for my basic functions because it is easy to use and is released under an open source license. I started by getting the LCD controller working with my board and printing a test message. Next I set up a 10-bit ADC on channel 0, sampled the voltage, and printed it to the screen. All the code for this project will be written in C, and I will be using the free tool "AVR Studio" from Atmel for programming the chip.

I was very happy with the results of this test and the accuracy provided by the ADC section. I was able to see a voltage as low as 15mV registered through the ADC. With an analog gain stage, I should be able to do about 10 times that. Next, I intend to set up a PWM output in an inverse feedback relationship with the ADC input, and test the reliability of a levitation system based on this digital set up.

I added an output section complete with MOSFET driver to the prototyping board I had already made and wrote some code to do the PWM routine. The results of this stage were promising. The magnet was able to be held a short distance away from the electromagnet and was held in equlibrium with gravity. I am still using an eddy current damper at this stage because the analog gain stage has not been built yet and the system lacks much of the sampling rate and resolution it needs inorder to be totally stable. The success of this test marks the completion of phase 1 of this project. I have set up the sensors, the output section, the input section, the digital section, and the mechanical parts for use in a one dementional levitation setup.

1
1

Section 5: Mechanical Construction

My laser cut parts arrived from Pololu and I did a mock up of my design. I also created a test coil, complete with 5/8" solid steel core. The ends of the coilform are laser cut from acrylic and the plastic insulator around the core is made from a custom machined section of PVC pipe (The actual inner diameter of 1/2" PVC is about .615" which I bored out to about .625" for a good press fit with the core). I am waiting to receive my custom designed circuit boards for the sensor arrays. Once I get them, the real fun will begin.

The sensor boards arrived from Gold Phoenix PCB service and they look great. I quickly soldered the sensors on both of the boards and did a few simple tests. It looks like these boards will work great. I'm very happy with the design of these sensor boards and I think my design will do a good job of minimizing any eddy current losses in the system.

1
1

I decided to buy a milling machine for this project as well as a few others. Along with the lathe I already have, this mill should allow me to make many of the aluminum parts I need for this project and for the main electromagnetic “head” unit in this system. Along with the actual machine, I decided to get some endmills, a nice vice, a set of collets, and some aluminum stock to add to the assortment of aluminum bar, UHMW bar, and polycarbonate that I already have. I made a few test cuts and I am happy with the performance of the machine. I should have no problem making the parts I need on this machine.I have not yet decided on a base material to use to support the device; at this point I am considering using either wood or 1/4” polycarbonate. I think the polycarbonate will give a more professional appearance but this may come at the cost of being harder to machine.

1
1

All coils were prepared and wound on my lathe. I held the coil forms between a dead center that I made from 6061 aluminum and a live center in the tailstock. I guided the wire on by hand from a large spool of 23AWG magnet wire. I am very happy with the result of this step as well. I think these coils should have about the right balance between resistance and number of turns. I was at first expecting to have to PWM these coils from around 36V, but now I think ill be fine with as low as 12V as long as I don’t do any “heavy lifting.”

While I was using the lathe, I decided to make a couple of spacers out of 1/4” aluminum stock. These pass a #6 machine screw through and are polished to a nice shine. I believe these should perform well structurally as well as looking good.

1
1

With the coils, sensor boards, and spacers made, I did a test assembly of the head unit. Everything fits nicely together. The completed head unit is ready to accept the mounting bracket which I will machine on my newly acquired milling machine as soon as possible.

1
1

With about a month to go, things I need to do:

  1. Create the controller board
  2. Mill the mounting bracket for the head
  3. Write some software to run the system

My deadline for completion of this project is getting close, but I don’t think I will have any huge problems that will stop me from completing this project fully.

For a power supply, I am considering a computer SMPS because they offer all the voltages I need and I currently have several that would make good candidates. I also have the custom made variable SMPS that I built as a bench top unit about a year ago. So far this power supply has been very useful in testing because it is variable between 2.5V and 24V. I would prefer to simply use one computer power supply though, as my custom unit only produces one voltage at a time.

1
1

I decided to test a few different head mounting bracket solutions to see what I am most satisfied with. These parts are currently made from UHMW, a material that is very easy to machine and seems like a good plastic for this job. I also received my aluminum stock that I had been waiting for. If time allows, I may remake the bracked with aluminum, however this is not top priority at this point.

1
1

Section 6: Main Controller Board

Having explained much of my construction process, I should at least touch on how the whole system will be assembled. This device consists of four primary electrical assemblies: A magnetic head- the unit that holds the three electromagnets and the six Hall effect sensors, A main board- a custom made circuit board that holds the op-amp sections and the power handling section, A microcontroller board- a product from Olimex which handles the math processing, the ADC conversion, and the interface, and a large switching power supply. Most wiring will be done with either 22-18AWG stranded wire or female to female jumpers. The sensor board will interface with the main board through two 8 conductor ribbon cables of about 12” in length.

One major milestone in the completion of this project will be the successful design and construction of the main controller board. This board will contain the 3 main differential op-amps, the lead compensators, the MOSFET drivers, and the power switching section. This board was designed by me in Eagle CAD, and should be a good layout for the main controller. This board should be rather compact at 2.6” by 4.5”. I attempted to etch this board a few times, but my attempts did not give results that I was satisfied with. In the end I found that the problems were caused by my toner transfer method. The problem seems to be that my old Laserjet 4 printer is just not up for the job. In the future, I will either get a newer printer, or try a photo-etching method which should give much better results. In the end, I did get the board to etch correctly using a different printer this time. The board looks very nice and now needs to be populated and tested.

1
1

With the board etched, I proceeded to drill and solder all the needed parts on. The board is looking good and will hopefully work without any major problems. Next up is connecting this main controller board with the interface board and the head unit.

1
1

Section 7: Base, Mounting, and Electrical

After making the controller board, I decided to make the IDC cables that connect the sensor boards to the main controller. These cables are made with an 8 conductor ribbon cable and 2 IDC connectors each. I actually used a length of 40 conductor IDE CDROM cable to make these IDC cables.  I tested the sensor boards now with the main controller actually connected through the eight pin cables I made. All six of the sensors work as they should. I am very happy with the performance of the system so far.

1
1

With the electrical system working and tested, I did most of the mechanical construction. I first created the arm assembly by bending some 1/2” OD aluminum tube and turning a steel “plug” to fit in one end of it. I then tapped the end of this assembly and cut the tube to length. The arm was then attached to the head unit.

1
1

Next, I put a block of UHMW on the lathe and turned it to make a base for the arm mount. I drilled three holes in it on the mill, and tapped two holes for set screws. This bracket should be very strong and should provide a very stable mount for the head.

1
1

I needed a base to mount the completed system on. I decided to go with polycarbonate because I had plenty of 1/4” sheet on hand. The base is tapped with #6 and #8 holes to allow me to screw the boards and mounting bracket in with machine screws. All of the physical construction of the base took about 2 hours. I then did a quick assembly of the system. Everything lines up nicely and looks good.

1
1

With all of the hardware in place, the project is getting near completion. At this point, the system needs the software that will actually run the system. Next up: Software and testing. This is where it gets fun.

Section 8: Software

Software to power the system was written in C, using some AVRLIB functions. The software that this system runs is instantly upgradable using a USB based programmer. Some example code is show below.

while(1)
{
//lcdInit();
// rprintfInit(lcdDataWrite);

u16 a = a2dConvert10bit(0);
a=a*5;
if (a > 1020)
{
a = 1022;
}

a = 1023 - a;
timer1PWMASet(a);


u16 b = a2dConvert10bit(1);
b=b*5;
if (b > 1020)
{
b = 1022;
}

b = 1023 - b;
timer1PWMBSet(b);

u16 c = a2dConvert10bit(2);
c=c*5;
if (c > 1020)
{
c = 1022;
}

c = 1023 - c;
timer1PWMCSet(c);

//rprintfNum(10, 4, FALSE, ' ', a);
//rprintf(" ");
//rprintfNum(10, 4, FALSE, ' ', b);
//rprintf(" ");
//rprintfNum(10, 4, FALSE, ' ', c);
//delay_ms(10);

}
return 0;
}


Section 9: Results and Stability

After setting up all the required software, I tested the system. I was able to successfully levitate an object between all three of the coils. Stability was problematic until I upgraded the lead compensation stage. With better noise rejection, the system became stable. I was able to levitate small objects with good results.

 

All text and images on this page are the property of the author.
If you wish to use my design for profit or as part of your own work, please contact me to arrange something.