milespeterson101
Published

Ultrasonic Levitation | Acoustic Levitation Experiment

Ultrasonic Levitation! It's real life Anti-Gravity!

IntermediateFull instructions provided2,958
Ultrasonic Levitation | Acoustic Levitation Experiment

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
You don't need the circuit board part of this component, you only need the sensors.
×1
Arduino UNO
Arduino UNO
×1
Qunqi L298N Motor Drive Controller Board Module Dual H Bridge DC Stepper For Arduino
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
This will be helpful if you need to connect the 9 volt battery to the circuit.
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Schematic

Here is the schematic for the project. This will help a lot!

Code

Code

Arduino
Here is the code, put this in your Arduino software and upload it and the project should work!
//made by milespeterson101
//published on 6/17/2022
//heres the code (:

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
}
ISR(TIMER1_COMPA_vect) {
  PORTC = TP; // Send the value of TP to the outputs
  TP = ~TP; // Invert TP for the next run
}
void loop() {
  // Code ends here (:
}

Credits

milespeterson101

milespeterson101

0 projects • 4 followers

Comments