Make an Ultrasonic levitator

Wanna know how to make the ultrasonic levitation project along with its coding

1 Like

Welcome to Engineer’s Asylum

You have to add more details when creating topics. Which microcontroller or development board are you planning for use?

You need to buy at least one HC-SR04 module and an L293D H-bridge module for this. Replay, which microcontroller are you planning to use?

I have arduino nano ,ultrasonic sensor

Hi, You have to buy an L293D H-bridge motor driver for this project.

Make an Arduino ultrasonic levitator

First, you have to desolder the two transducers from the HC-SR04. These transducers can operate at a frequency of about 40khz. Then connect the analog Pins A0 and A2 of Arduino to channel 2A and 1A of the L293D motor driver. Connect the two transducers to 1Y and 2Y of the motor driver as shown in the below circuit.

After that upload the below code to your to Arduino nano.

byte TP = 0b10101010; // Every other port receives the inverted signal
void setup() {

  DDRC = 0b11111111; // Set all analog ports to be outputs
  // Initialize Timer1

  noInterrupts(); // Disable interrupts
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  OCR1A = 200; // Set compare register (16MHz / 200 = 80kHz square wave -> 40kHz full wave)
  TCCR1B |= (1 << WGM12); // CTC mode
  TCCR1B |= (1 << CS10); // Set prescaler to 1 ==> no prescaling
  TIMSK1 |= (1 << OCIE1A); // Enable compare timer interrupt
  interrupts(); // Enable interrupts


  PORTC = TP; // Send the value of TP to the outputs
  TP = ~TP; // Invert TP for the next run

void loop() {
  // Blank


Now position your transducer about 20mm apart. You’ll find the exact distance by trial and error.

The distance must be accurate to create a standing wave with sufficiently strong regions of high and low air pressure. You can calculate the distance by,

343000mm/sec / 40,000Hz = 8.575mm
where 343000mm/sec is the speed of sound.

Now, you can find standing waves at 8.575mm or at multiple of that value. But the distance between the transmitter screens is not the same as the area enclosed by the sound wave, so the result won’t be quite right. You’ll end up moving things around slightly until you get it working. At last, you may use a tweezer to place a small styrofoam ball where the standing waves are formed. Remember it’s not that easy to do it, take your time to place it correctly. Have patience.