Ingeimaks Ingeimaks
Published © Apache-2.0

Ultrasonic Levitation with Arduino UNO

Here is my latest crazy project, ULTRASONIC LEVITATION, it is a very simple project but at the same time interesting and amazing.

IntermediateFull instructions providedOver 1 day5,624
Ultrasonic Levitation with Arduino UNO

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

STL

Schematics

Schematics

Code

Code

C/C++
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() {
  // Nothing left to do here :)
}

Credits

Ingeimaks Ingeimaks

Ingeimaks Ingeimaks

14 projects • 45 followers
Giovanni Mannara is a Maker. Thanks to Massimo Banzi I have traversed this path of Digital Creator ... I LOVE ARDUINO !!!

Comments