edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
CiferTech
Published © GPL3+

How to Make an Ultrasonic Levitator Using Arduino

Today I will show you how to make your ultrasonic levitator using an Arduino Nano.

IntermediateFull instructions provided10,229
How to Make an Ultrasonic Levitator Using Arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Dual H-Bridge motor drivers L298
SparkFun Electronics Dual H-Bridge motor drivers L298
×1
Ultrasonic transmitter
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

.__40khz.ino

C/C++
byte TP = 0b10101010; //jeder 2. Port bekommt das umgekehrte Signal

void setup()
{
 DDRC = 0b11111111; //Alle Analogports als Ausgang definieren
 
  // Timer 1 initialisieren
  noInterrupts();           // Interrupts deaktivieren
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;

  OCR1A = 200;              // Compare Match Register setzen (16MHz / 200 = 80kHz Rechteck -> 40kHz Vollwelle )
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS10);    // Prescaler auf 1 ==> kein prescalling
  TIMSK1 |= (1 << OCIE1A);  // Compare Timer Interrupt einschalten
  interrupts();             // Interrupts aktivieren
}

ISR(TIMER1_COMPA_vect)          
{
  PORTC = TP; // Den Wert TP an die Ausgange senden
  TP = ~TP;   // TP invertieren fr den nchsten durchlauf
}

void loop(){
  // hier bleibt  nichts zu tun brig:-(
}

Credits

CiferTech
50 projects • 243 followers
I'm known as Cifer. I'm an Electronic, Embedded sys, Robotic, IoT Engineer - PCB Designer.

Comments