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

by Beamformer in Circuits > Microcontrollers

1198 Views, 7 Favorites, 0 Comments

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

20210909_213824.jpg
20210831_234319.jpg
Acoustic Levitation with an ATTiny4/5/9/10
Screenshot_20210901-192825_Video Player.jpg

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

Method 1: Breadboard/Protoboard: Mount and Program ATTiny

20210901_193451.jpg
20210901_193104.jpg

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.

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

20210901_203833.jpg
ATTinyLevSchematic.JPG

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.

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

20210901_204846.jpg
20210901_204828.jpg

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.

Insert Styrofoam Particles in Between the Transducers

20210831_234319.jpg

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.

Method 2: Fabricate the Attached PCB

ATTinyLevRevB.JPG
ATTinyLevSchematic.JPG

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).

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

20210909_224337.jpg

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.

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

Screenshot_20210910-023610_Gallery.jpg
Screenshot_20210910-023555_Video Player.jpg

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.

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

Screenshot_20210910-023732_Video Player.jpg
Screenshot_20210910-023708_Video Player.jpg
Screenshot_20210910-023749_Video Player.jpg

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.

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

20210909_213818.jpg

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.