It’s very exciting to see something floating in the air or in free space, which is what the antigravity project is about. The object (essentially a small piece of paper or hot glue) is placed between two ultrasonic transducers that produce sound waves. Objects float through the air due to these seemingly gravity-defying waves. Not only is this a cool looking Arduino levitation project, but it has many practical applications.
Arduino Uno / Arduino Nano ATMEGA328P
Ultrasonic module HC-SR04
IC or L239d H-bridge module L239D
Vero Board Embellished Vero
Capacitor (PF) 104
Additional requirements for 8v to 12v power supplies
LED drive power supply 12V 2Amp
Additional materials: some hookup wires, male, female-to-female jumper wires
Ultrasonic levitation circuit diagram
The complete Arduino floating circuit is shown in the figure below, and the working principle of the circuit is very simple. The main components of this project are an Arduino, L239D motor driver IC, and an ultrasonic transducer collected from the Ultrasonic Sensor Module HCSR04. Generally, ultrasonic sensors emit sound waves with frequency signals between 25khz and 50kHz. In this project, we use the HCSR04 ultrasonic transducer. We have done many ultrasonic sensor projects before, among which HCSR04 is mainly used to measure distance. In this project we solder the transducer out of the module.
According to the datasheet, this ultrasonic transducer operates at 40 kHz. So the purpose of using an Arduino and this little code is to generate a 40KHz high frequency oscillating signal for my ultrasonic sensor or transducer and apply this pulse to the input of a dual motor driver IC L239D (from pins 2 and 6 of the Arduino A0 & A1 pins) to drive the ultrasonic transducer. Finally, we apply this high-frequency 40KHz oscillating signal together with the driving voltage through the driving IC on the ultrasonic transducer (usually 8 to 12 voltages, Vcc2, given on the 8th pin of the L239D IC). Thus, ultrasonic transducers generate sound waves. We put the two transducers facing each other in opposite directions so there is some space between them. Sound waves travel between the two transducers, causing objects to levitate.
Please note that the L293D has dual voltage inputs, one is to power the IC itself, in this project powered by the Arduino 5v, and the other Vcc2 (8 th ) is used to output the component driving voltage, this VCC pin can accept voltage up to 36v. The IC has 2 enable pins, 4 input and output pins, and 4 ground pins. The concept of using this IC comes from the concept of using microcontroller and this chip, we can change direction and speed of 2 motors individually by giving logic or digital signal from microcontroller.
In this circuit we are using only two inputs of IC L293D, input pin 1 (2) and input pin 2 (7). To enable these two pins we have to keep IC Enable PIN 1 high, so we launch this pin to IC pin 16 which is input Vcc 1, to know more follow L293D datasheet.
The use of 100nf capacitor is optional and is only used to keep the IC power supply, as power supply we use 12V 2Amp LED driver and then use voltage regulator IC LM7809 to drop the voltage to 9v and provide to pin 8 of L139D with common ground . According to the Arduino, Cc, and Arduino forums, the Arduino UNO board supports 7 to 12 volt inputs, but it’s safer to put 9V Max.
Programming Arduino for Ultrasonic Levitation
The code is very simple, only a few lines. Using this small code with the help of timer and interrupt functions, we are making high or low (0/1) and generating oscillating signal at 40Khz for Arduino A0 and A1 output pins.
First, start with the phase shift array.
byte TP = 0b10101010;
Every other port will receive this opposite signal. Then under the void setting, we use this line of code to define all analog ports as outputs.
DDRC = 0b11111111；
Then we initialize Timer 1 and disable all interrupts to zero.
With this code,
TCCR1A = 0；
TCCR1B = 0；
TCNT1 = 0;
Then, configure Timer 1 to trigger compare interrupt clock at 80KHZ. The Arduino runs at 16000000 MHZ ÷ 200 = 80,000 kHz, use this function to generate a square wave.
OCR1A = 200;TCCR1B |=
（1 《《 WGM12）;
TCCR1B |= （1 《《 CS10）;
Afterwards, this line becomes active and the compare timer is interrupted.
TIMSK1 |= （1 《《 OCIE1A）;
Finally, use this code to activate the interrupt.
Each interrupt inverts the state of the analog port, which converts the 80 kHz square wave signal to a 40Khz full wave circular signal. We then send the values to the Arduino output A0 and A1 ports.
port C = TP;
TP = ~TP; // reverse TP for next run
And there’s nothing to put or need to run under a loop.
Build an Ultrasonic Levitation Device
Note that for this project it is important to mount the ultrasonic transducer correctly. It is very important that they should face each other in opposite directions and they should be on the same line so that the ultrasonic waves can travel in opposite directions and intersect. For this you can take two small pieces of wood or MD boards, nuts bolts and glue. You can drill two holes to fit the transducer perfectly. On the stand you can hang the ultrasonic transducer unit.
In this case I used two pieces of cardboard and then fixed the ultrasonic transducer with the help of glue from a glue gun. Later, to make the stand, I used a simple junction box and glued everything together.
Here are some pictures of ultrasonic levitation showing the project in action.
Ultrasonic levitation or acoustic levitation can also work if an ultrasonic transducer is mounted on one side, but in this case a reflector is needed as an obstacle so that it can be used in future hoverboards and anti-gravity transport.