Arduino Air Bonsai Levitation

54,305

804

66

Introduction: Arduino Air Bonsai Levitation

It's been a long time since my previous tutorial, my work is quite busy and I spend less time on Instructables. This time is a project that I like very much since my first saw it on Kickstarter: Air Bonsai. I was really surprised at how the Japanese made it, really a beautiful and mysterious piece.

Any mystery can be explained by looking inside, where it works. I have learn a lot about air bonsai more than a month ago and it was actually a magnetic levitation. I have also seen many tutorials on how to make magnetic leviation and all of them are making an object levitating from above where there is an electromagnet controlled by the circuit. There are no instructions on how to make a circuit similar to air bonsai.

Take a look at my steps below to make your own bonsai air with Arduino.

Love this instruction? Let vote for me at Microcontroller contest in the end of this instruction. It is motivation for me to continue to do future instructions. Thanks.

Pls note English isn't my native language, be generous with any grammatical errors. :D

Step 1: Instruction Video

Take a look at the video above for a quick look at how to make a magnetic levitation.

Pls note the instructions in the video are very simple and do not fully tips to start. Just take a look at the video and follow all of steps below to make sure you can make your own air-bonsai successfully.

Step 2: How It Works

I find out and realized that the circuit of kickstarter air-bonsai version was quite complex, without any microcontroller, I didn't have any knowledge of its analog circuit, there seems to be no way to do it. After looking careful, I realized its principle is quite simple, that is to make a magnet piece floating above another magnet piece. All of my rest work is make the floating magnet not falling down.

I think to do this with the Arduino actually a lot easier than calculating the analog circuit. And I succeeded in this way, really a lot simpler.

A magnetic levitation consists of two parts, the base piece and floating piece.

  1. Base piece
  • This part is at the bottom, which consists of a magnet to create a round magnetic field and electromagnets to control that magnetic field.
  • Each magnet has two poles: the north and the south. Experiments show that opposites attract and same-poles repel. Four cylindrical magnets are placed in a square and have the same polarity, forming a round magnetic field upward to push any magnet, which has a same pole and in between of them.
  • There are four electromagnets at all, they are placed in a square, two symmetric magnets is a pair and their magnetic field is always opposite.
  • The hall sensors and drive circuits control the electromagnets. Create opposing poles on the electromagnets by diverting the current through them.

2. Floating piece

  • Include a magnet floating above the base piece, which can carry a small pot.

How it works?

The magnet on top is raised by the magnetic field of the bottom magnets because they are the same poles. It however tends to turn over to fall down and attract in each other.

To prevent the top magnet piece from turning upside down and falling, electromagnets will create magnetic fields to push or pull to balance it, thanks to hall sensors.

Electromagnets are controlled in two X and Y axes, resulting in the upper magnet being kept balanced and floating.

Controlling electromagnets is not easy, this requires you to have knowledge of the PID controller, which is discussed in detail in the next step.

Step 3: PID Controller

What Is PID?
From Wikipedia: "A proportional–integral–derivative controller (PID controller or three term controller) is a control loop feedback mechanism widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value {\displaystyle e(t)} as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively) which give the controller its name."

In a simple way to understand: "A PID controller calculates an 'error' value as the difference between a measured [Input] and a desired setpoint. The controller attempts to minimize the error by adjusting [an Output]."

So, you tell the PID what to measure (the "Input",) Where you want that measurement to be (the "Setpoint",) and the variable to adjust that can make that happen (the "Output".)

Get understanding about PID easy in Youtube: https://www.youtube.com/watch?v=UR0hOmjaHp0

The PID then adjusts the output trying to make the input equal the setpoint. For reference, in a car, the Input, Setpoint, and Output would be the speed, desired speed, and gas pedal angle respectively.

In this project:

1. The Input is the current realtime value from hall sensor, which are updated continuously because the position of the floating magnet will change in real time.

2. Setpoint is the value from hall sensor, which is measured when the floating magnet is in the balance position, at the center of the magnets base. This index is fixed and doesn't change over time.

3. Output would be the speed to control electromagnets.

Thanks to Arduino community to write PID library and it really easy to use.

More info about Arduino PID at https://playground.arduino.cc/Code/PIDLibrary

We need to use a couple of PID controller in Arduino, one for X axis and other for Y axis.

Now is the time to start buying the necessary components.

Step 4: Materials List

Below is the list of the components you need to buy for this project, make sure you have them all before starting.

Some of the components are very popular and I believe you are already available in your own stock.

The components come with a quantity and a suggested link. Most of the suggested links come from Aliexpress where you can buy cheap and free shipping. You can buy in other places as long as you can buy them in the easiest way.

  • 5.6K ohm resistor - X2
  • 180K ohm resistor - X2
  • 47K ohm resistor - X2

  • 10K ohm potentiometer - X2

  • Acrylic sheet A5 size - X1

  • Wooden pot - X1

  • PCB Breadboard - X1

  • 3mm screw - X8

  • Wire

  • Mini plan such as succulent, cactus, mini bonsai

Step 5: Tools

Here is a list of tools, most commonly used by anyone.

  • Soldering iron
  • Hand saw
  • Multimeter
  • Scew drivers
  • Osilloscope (optinal, you can use multimeter instead)
  • Table drilling
  • Hot glue gun
  • Electronic plier

Step 6: LM324 Opamp and L298N Driver and SS495a

LM324 Op-amp

Operational amplifiers (op-amps) are some of the most important, widely used, and versatile circuits in use today.

We use the opamp to amplify the signal from the hall sensor, the purpose is to increase the sensitivity so that arduino easily recognize the change of magnetic field. When only change a few mV at the output of the hall sensor, after passing the amplifier can change several hundred units in the Arduino. This is necessary to keep the PID controller smooth and stable.

Learn more about how op-amp works in this tutorial.

A common opamp IC that I choose is the LM324, it's very cheap and you can buy it at any electronics store. The LM324 has 4 internal amplifiers, which allow you to use flexibly, however in this project I only need two amplifiers, one for the X axis and the other for the Y axis.

You can find how to assemble the LM324 in the follow step.

L298N module

Dual H-Bridge L298N are typically used in controlling motors speed and direction of two DC motors, or control one bipolar stepper motor with ease. The L298N H-bridge module can be used with motors that have a voltage of between 5 and 35V DC.

There is also an onboard 5V regulator, so if your supply voltage is up to 12V you can also source 5V from the board.

In this project I used L298N to control two pair of electromagnet coils and use 5V output to power to Arduino and hall sensor.

Module pinouts:

  • Out 2: pair of electromagnet X
  • Out 3: pair of electromagnet Y
  • Input power supply: DC 12V input
  • GND: Ground
  • 5v: 5v output to Arduino and hall sensors
  • EnA: Enables PWM signal for Out 2
  • In1: Enable for Out 2
  • In2: Enable for Out 2
  • In3: Enable for Out 3
  • In4: Enable for Out 3
  • EnB: Enables PWM signal for Out3

Wiring to Arduino: we need to remove 2 of jumpers in EnA and EnB pin, then connect 6 pins In1, In2, In3, In4, EnA, EnB to Arduino. Detail in the follow step.

Learn more about L298N module in this instructions.

SS495a Hall sensor

SS495a is a Linear Hall Sensor with analog output.

Notice the difference between analog output and digital output, you can't use a sensor with digital output in this project, it only has two states of 1 or 0, so you can't measure the output of magnetic fields.

An analog sensor will result in a voltage range of 250mV to Vcc, which you can read with Arduino's Analog Input.

Two hall sensors are required to measure the magnetic field in both the X and Y axes.

Step 7: Neodymium Ndfeb Magnets

Wikipedia: "Neodymium is a metal which is ferromagnetic (more specifically it shows antiferromagnetic properties), meaning that like iron it can be magnetized to become a magnet, but its Curie temperature is 19 K (−254 °C), so in pure form its magnetism only appears at extremely low temperatures. However, compounds of neodymium with transition metals such as iron can have Curie temperatures well above room temperature, and these are used to make neodymium magnets."

STRONG, that's the word I use to describe the Neodymium magnet. You can not use ferrite magnets because their magnetism is too weak. Neodymium magnets are much more expensive than ferrite magnets.

Small magnets are used to make the base piece, large magnets to make the floating piece.

Caution: You need to be careful about using neodymium magnets, since their strong magnetism can hurt you, or it can break the data of your hard drive or other electronic devices that are affected by magnetic fields.

Tips: You can only separate the two pieces of the magnet by pulling them sliding to the horizontal, you can not separate them in the opposite direction because their magnetic field is too strong. They are also very brittle and easy broken.

Step 8: Prepare the Cover for the Base Piece

I use a small terracotta pot with diameter of 3 3/4 ", which is usually used to grow succulent or cactus. You can also use a ceramic pot or wooden pot, as long as they fit perfectly.

Use a 8mm drill to create a hole near the bottom of the pot, which is used to hold the DC jack.

Tips: You should use a flat wood bit to drill into the terracotta pot, I used an iron drill and it almost burned, really not effective.

Also you can use water to cooling down the drill, avoid making it overheat.

Step 9: 3D Printing Floating Magnet Holder and Acrylic Laser Cut

3D Printing

Printing the floating magnet holder with the STL file that I have attached.

If you have a 3D printer available, this is really great. Congratulations, you have the opportunity to make everything with this machine. If not, don't be disappointed because you can use a cheap 3D printing service, which is very popular now.

Tips: You only need about 20 minutes to complete this part and infill only 30%.

Laser cut

You should use a local laser cutting service to cut two acrylic pieces with the file, which I have attached as AcrylicLaserCut.dwg. This is an autocad file.

An acrylic piece is used to support the magnets and electromagnets, the rest to cover the surface of the terracotta pot.

Step 10: Prepare SS495a Hall Sensor Module

Cut the pcb breadboard into two pieces, one piece to attach the hall sensor and the other to make the LM324 circuit.

Attach two magnetic sensors perpendicular to the pcb. Note the two sides are engraved of the sensors rotate to each other, fixed welding.

Use the thin wires to connect two VCC pins of sensors together, do the same with the GND pins. The output pins are separate.

Step 11: Opamp Circuit

Solder the socket and the resistors to the pcb following the schematic, paying attention to put two potentiometers in the same direction for easy calibration later.

Attach the LM324 to the socket, then connect the two outputs of the hall sensors module to the op-amp circuit.

Wiring two LM324 output wires to connect to Arduino. The 12V input should be shared with the 12V input of the L298N module, the 5V output of the L298N module connected to the 5V of the potentiometers.

Step 12: Assembly the Electromagnets

Assemble the electromagnets onto the acrylic sheet, noting that fixed at four holes near the center.

Tighten the screws to avoid moving.

Because the electromagnets are symmetric across the center, they are always in poles opposite, so that the wires on the inside of the electromagnets are connected together, the wires on the outside of the electromagnets being connected to the H-driver L298N.

Pull down the wires under the acrylic sheet through the nearby holes to connect to the L298N.

Tips: The copper wire is coated with a insulated layer, so you must remove it with a knife before you can solder them together, remember to use Heat Shrinkable Tube after welding.

Step 13: Attach the Sensor Module and Magnets

Use hot glue to fix the sensor module between the electromagnets, pay attention that each sensor must be square with two electromagnets, one on the front and the other on the back.

Try to calibrate the two sensors as centrally as possible so they do not overlap, which will make the sensor the most effective.

The next step is to assemble the magnets on the acrylic base. Combining two D15*4mm magnets and a D15*3mm magnet together to form a cylinder, this will cause the magnets and electromagnets to have the same height.

Assemble the magnets between the pairs of electromagnets, note the poles of the upward magnets must be the same.

Step 14: DC Power Jack and L298N 5V Output

Solder the DC power jack with two wires and use a heat shrink tubing. Connected DC power jack to the input of the L298N module, its 5V output will power the Arduino.

Step 15: L298N and Arduino

Connect the L298N module to the Arduino following to the schematic above.

L298N ===> Arduino

Out 5V ===> VCC

GND ===> GND

EnA ===> 7

In1 ===> 6

In2 ===> 5

In3 ===> 4

In4 ===> 3

EnB ===> 2

Step 16: Arduino Pro Mini Progamming

Since Arduino pro mini don't have any usb to serial port, you need to connect an external programmer.

The FTDI Basic will be used to program (and power) the Pro Mini.

Follow this Sparkfun instruction to get more info.

Step 17: Preparation of the Floating Piece

Attach two D35 * 5 magnets together to increase magnetism.

Step 18: Calibration Setpoint Value

Load program ReadSetpoint.ino to Arduino, which I have attached. This program will read the values of the hall sensor and send it to the computer via the serial port. Open COM port to see it.

Plug the 12V DC to the DC power jack, you also use osilloscope to readout the sensor value.

Observe the values on the screen, make adjustments by adjusting the two potentiometer. The best value is 560, at which point the output of the sensor is about 2.5V.

After setting the setpoint, place the floating magnet piece above the base piece and shake it to see the change of the setpoint on the screen.

Tips: Mark the pair of electromagnets and potentiometers respectively in the X and Y axes so that you can easily correct them later.

Step 19: Load the Main Program

After calibrate the Setpoint value, now is the time to enjoy the results.

Load the Levitation.ino main program, which I have attached below.

Use the super glue to fix the magnet piece and the magnet holder, which was 3D printed before.

Tips: After loading the main program, you can make small adjustments on the potentiometers to make the floating piece fixed in the center.

Step 20: Put All Together

First attach the DC power jack to the pot, then put the remaining parts into the pot.

Finally, use the remaining acrylic sheet to make the surface of the pot.

Step 21: Prepare the Plant

Attach the wooden pot to the floating magnet piece.
I used a small cactus to plant. You can use cactus or succulent or any mini bonsai that is symmetrical or small and lightweight.

Step 22: Finish and Enjoy

Enjoy your results, your efforts will be met with a bonsai air pot on your own desk, which is made by yourself.
Please vote for me and follow me to see my next instructions.

Microcontroller Contest

Grand Prize in the
Microcontroller Contest

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Metalworking Contest

      Metalworking Contest

    66 Discussions

    Awesome project !

    And very good and complete instrucable. I'm trying to get it done.

    Unfortunately, there is something that I don't understand : Did you use PWM pins for ENA and ENB ?
    Your wiring on this instructable says no (Pin 7 and 2 on arduino) but your "Levitation.ino" program doesn't match with your wiring (ENA and ENB on pins PWM 6 and 5).
    So, we must change the wiring or the program ?
    Thank you very much advance

    Excellent instructable

    (Clear explanations, detailed steps, great engineering at its best : kudos !)

    - I think you did use no integral (makes sense) and 1% differential. Is this D factor useful ?

    - I didn't locate the information about actual power consumption while levitating.
    Did you measure it ? (it's obviously under 2A at 12V)

    Thx for sharing this interesting and well done project.

    2 more answers

    Firstly thank you very much for your compliment.

    - In the PID function, since the magnet is floating and continuous rotation, I didn't use integral. It's really not usefull. Proportional and derivative are very important and indispensable component, you can calibrate D to achieve balance.

    - Power consumption is about 800mA - 1A on startup, and below 200mA when balance and continuous rotation.

    Best!

    Hi! I made your instructable! But when I put it on, the elektromagnets got really hot and the power consumption was about 2A, (and it didn't work yet) Any idea how this can occur?

    What are the dimensions of the wooden pot?

    if op amp power supply is 12v as shown in circuit it can damage the arduino analog pin

    1
    None
    Mattsc

    6 weeks ago

    Thank you for sharing your project.

    In your guide you indicate that ENA and ENB should be connected to DIGITAL pins 7 and 2 respectively. Shouldn't they be connected to PWM pins instead since they control the speed of the motor or in this case the strength of the magnetic field of the coils?

    It is nice, but the cost are WAY more than buying a NEW one, working, so why not buy a new one and just make a new floating one?

    I seriously don`t get this one, cool you build it, but it`s the cost that kills this direct. for 45 USD you got a new one the biggest, your 4 coils cost 14 usd a pcs is total of 56 USD, and then the rest .. so sorry to say this but this is how i see this.

    WannaDuino

    5 replies

    DIY is about doing and not buying. :) While making it you learn how it works and perhaps can improve on it. Like making the levitation height adjustable. Or trying to find a solution for making it rotate in the direction you prefere. Connect it to you mobile. So many possibilities.

    just LOOK at aliexpress where you ordered the coils or go to banggood i ordered 2 for 70 USD. new complete with housing just use levetaiting as find string.

    I just bought these two

    $70: https://www.amazon.com/gp/product/B015EPNFOS/ref=o...

    $45: https://www.amazon.com/gp/product/B074MZLHZ5/ref=o...

    Of these, the 'Power TRC' is much more stable than the ICStation.

    However, I still plan on making this just to see if I can add more magnets / Height, be able to ramp up the power to lift up from ground level (would be awesome for a Halloween trick) and just because it's so damn cool.


    And kudo's to the author for an awesome Instructable.

    You say 'your 4 coils cost 14 usd a pcs is total of 56 USD', If you had followed the link the author gave for this and read it properly, you would see that the actual cost per piece is USD2.82 / piece as below:

    The Third Generation Coil of the 100 System Coil of Magnetic Levitation Coil

    Rated4.0/5 based on1customer reviews 4.0 (1 votes)

    9 orders

    Price:
    US $14.09 /lot 5 pieces / lot , US $2.82 / piece
    I would rate this instructable, one of the best I have read since discovering & reading many for the last three months, congratulations & well done to the author.

    enter this in the planter contest! the prize is great and you'd probably win!

    Hi Funelab, can I use your tutorial for bulb levitation like flyte? Do I need another component to make it happen? Thanks

    0
    None
    huminsky

    Question 2 months ago

    Very Nice job.

    I ask about PID_v1.h library.

    where is that?

    Thanks

    1 more answer

    Excellent! (Ok, I just watched the video and skimmed the instructable, but from what I did see, awesome work!) I just love it when people combine technology and nature to create art! Lovely video work too, I aspire to be that good someday. Best of luck as a finalist in the microcontroller contest!