Introduction: Acoustic Levitation With an ATTiny 4/5/9/10

WARNING::: Recently found out that the TC4427 driver fails after several hours of heavy use. Leaving this up incase someone wants to work off the schematics to make something better.



My previous Instructable featured a 555 timer with a hex inverter used to generate a 40 kHz square wave and drive the ultrasonic transmitters. As you can see, the circuit is pretty large. I thought I could avoid using an overpowered MCU for such a simple task, but found that an ATtiny (4/5/9/10) was simple enough to generate both the 40 kHz noninverted and inverted waves with only a few lines of code! This work is based on the design by Asier Marzo. The ATTiny come in SO-23 packaging and are smaller than a grain of rice allowing us to make things very small! If the smaller ATTiny 4-10 are difficult to find in stock, you can also use a larger ATTiny 85 or other MCUs with a few modifications to the attached EagleCAD schematics and code.

Supplies

ATTiny (4/5/9/10) At the time of creating this Instructable, only ATTiny 9's were instock at Mouser for .37c a piece, But any ATtiny (12/13/25/45/85) will work with a few minor modifications to the code. 85's are common enough to get off Amazon.

6 pin So23 DIP breakout boards

USBasp programmer such as this (an Arduino is also required to update the firmware if you want to program ATtiny 4-10 out of box but not 12 or higher)

TC4427 Noninverting Mosfets. I used these SMDs from a previous project with associated breakout boards, but you can find DIP versions too.

Two 16 mm 40 kHz transducers. You can find a small assortment of transmitters and receivers off Amazon.

12V DC Power Source

5V 7805 Linear Voltage Regulator- These are available from many sources.

Capacitors: Two 100 nF, One 330 nF, One 4.7 uF

M2 Nylon Screws and Spacers

Step 1: Method 1: Breadboard/Protoboard: Mount and Program ATTiny

If you opt to go with the ATTiny 4-10 and can't find it in DIP package. It helps to mount it on a SO23-6 breakout board. I additionally built an easy adapter to connect the ATTiny to the USBASP programmer. Use this hook up and programming guide as a reference. You may need to update the firmware on your USBASP programmer to enable TPI (Tiny Programming Interface) using this guide. Load the Arduino sketch (attached) into the Arduino IDE and select the 1 MHz clock frequency for the ATTiny corresponding to your MCU and upload using the USBASP.

Depending on what type of TC4427 you get access to, you may also want to mount it on a SSO8 break out board.

Step 2: Method 1: Breadboard/Protoboard: Verify Outputs of PB0 and PB1

Power the ATTiny with a 5V source or build the voltage regulator circuit to stepdown your initial 12V to 5 V. Using ideally a two-channel oscilloscope, verify the outputs of PB0 and PB1 are 40 kHz square waveforms that are 180 degrees out of phase and 5 Vpp with respect to ground.

Step 3: Method 1: Breadboard/Protoboard: Build the Circuit Depicted in the Schematic

If you haven't already built the voltage regulator portion of the circuit, do so and feed the 5V output into VCC of the AT Tiny. Feed the outputs from the ATTiny into IN1 and IN2 of the TC4427 gate driver following the schematic and power it with 12V directly from the source. This should boost your square waveform signals from 5V to 12 V. The outputs of the gate driver are directly connected to the two ultrasonic transmitters. I used nylon screws and spacers to adjust the transducers ~17 mm apart. If you are using 12 mm tall transducers, use two 20 mm hex spacers and a 1 mm nut in between the boards. The 41 mm separation minus two 24 mm for transducers results in 17 mm between the emitting surfaces. This allows 4 nodes to form.

Step 4: Insert Styrofoam Particles in Between the Transducers

Using a wire/plastic mesh, insert Styrofoam particles in between the transducers. These should ideally by held in place but if not, verify there are inverse 40 kHz 12V square waveform outputs from the gate driver and either add or subtract spacers to find a distance that works.

Step 5: Method 2: Fabricate the Attached PCB

I designed the current version of the PCB based on the components I had at hand (featuring a mix of SMD and through hole components).The recently uploaded Rev B fixes some annoyingly small foot prints, adds a terminal block to provide external 12-18V if you don't want to use the DC jack, and fixes the misalignment of the top and bottom boards. If you do post this elsewhere, please cite this Instructable and my github page (coming soon).

Step 6: Method 2: Separate the Top and Bottom Portions of the Board

The easiest way I found was to just cut along the perforated line with scissors. This will be later used to mount the top transducer directly above the bottom.

Step 7: Method 2: Solder the ATTiny and Program It Using the AVRISP Headers

I found it easy to use hot air soldering to mount the ATTiny. Match the ground marked on the board with ground orientation on the USBASP device and program the MCU. With the USBASP still connected, verify that you get a 5V 40 kHz square wave at pins IA and IB.

Step 8: Method 2: Solder the Voltage Regulator, DC Jack and Capacitors

When a 9-18 V source is connected to the DC jack, you should get 5V at the VCC pin on the AVRISP header. You should still be getting the 5V 40 kHz square waveform outputs at IA and IB, or alternatively on the AVRISP header at SCK and MOSI.

Step 9: Method 2: Solder the Transducers, Connect the Layers, Fix Separation to 4.1 Cm

The transducer orientation needs to be aligned and boards connected so both the positive leads get the same signal and the negative leads get the inverted signal. There should be spaces for using either 10 mm or 16 mm transducers. If using the latter, I found using nylon screws to separate the boards by 4.1 cm works well, giving you 4 nodes.