Ultrasonic Levitator (Old project)

This is a project I did about 6 months ago, when I was a lot less confident in electronics. However, I did get it working eventually. Thanks to mikeselectricstuff for inspiring the project with his video: Ultrasonic acoustic levitation

My initial design was somewhat complicated, involving an “auto-tuning” mechanism that allowed an Arduino to adjust the frequency of oscillation, generated by a 555 timer, using a digital potentiometer, to maximize the current consumed, as measured by a shunt resistor. Ultimately, I found that the ideal frequency was always exactly 25khz, despite the results seen by Mike (mentioned above), and so I just directly generated that frequency from the Arduino, and things worked fine. The driver just uses a transformer I wound on a ferrite toroid, with two primary windings wound in reverse directions, driven by two N-channel MOSFETs, each driven by a different pin on the Arduino. So ultimately I had a much simpler solution to build than Mike’s:

UltrasonicLevitator (2)

There should be resistors between the arduino pins and MOSFET gates. 

And here is the transformer up close:

IMG_8870

The transformer generated about +- 100v from about 7v input, from what I remember, and that was sufficient to levitate the bits of wax paper I was using. More power actually destabilized the levitation.

Here are some videos of the results:


This was true high-fps slow motion from my iPhone, before YouTube messed with it. Oh well. 



Advertisements

Optical Mouse Robot

As a part of my work developing Plobot (http://plobot.com/), we were trying to think of ways to improve the robot’s performance on carpet. The trouble is that a degree of wheel slippage is inevitable on carpet, and so encoders cannot be very accurate. Another team member, Maciej, suggested an interesting solution: the sensor from an optical mouse.

So, after doing some reading on the topic, I went around the corner and bought a cheap optical mouse, and took it apart. The inside looked a lot like this:

IMG_8802

I knew from my reading that the maker of most of these low-cost optical mouse sensors is Pixart, and I saw “KA8” written on the module, so I typed “Pixart KA8” into Google and this datasheet came up: PAW3204DB-TJ3R

Seeing the staggered pin arrangement was the same in that document, I became confident that I had the right datasheet, and I extracted the module from the mouse PCB. I then cobbled together my own circuit based on the schematic in the datasheet, running the module at 3.3v and communicating with it with an Arduino Uno. I added voltage dividers on the two serial lines to level shift.

My optical sensor proto-board

Unfortunately I saw a lot of garbage coming from the chip, and the serial protocol was not defined in the datasheet. I searched Google some more and came across this more complete datasheet for a related part, which turned out to have the same serial protocol: PAW3204DB

I then realized that the serial synchronization was essential to getting meaningful results from the module. I added code to synchronize every 100 read commands, and was able to read the product ID. As it turned out, I was in fact working with the PAW3204DB, and had been overvolting it the whole time at 3.3v. I was lucky that it held up. I added a voltage divider and a large capacitor on the power supply to get a stable 2.7v, with the optical sensor consuming < 10mA. I also made other minor tweaks such as adding the 34k resistor on OSC_RES.

Using the PAW3204DB datasheet, I was able to get tracking data from the optical sensor board, and with the help of another teammate, Rudi, I assembled a rough but adequate robot body to test with. I used the current revision Plobot board I had on hand as a driver.

NOTE the capacitors soldered to the motor leads and case. These EMI suppression capacitors were actually essential to making the robot work! Without them, the optical sensor module would malfunction severely when the motors ran. This issue frustrated me for a few hours.

Finally, after writing a quick and dirty control program using the Atmel microcontroller on the Plobot PCB, I had a working robot built around the optical sensor. No encoders or motor feedback sensors of any kind!


And it worked for my purpose, allowing the robot to tolerate a great deal of wheel slip, almost “skating” on the carpet:


The results with this sensor were not accurate enough to be a full solution for moving on the rug on its own. However, it could work well to complement encoders to detect slip, and I will be experimenting with higher quality sensors as well.

 

The control program works on the principle that when robot rotates, the optical sensor senses horizontal (X) movement, since its horizontal axis is always tangent to the circle. When the robot moves forward/backward, it senses vertical (Y) movement. So, when going straight, motor power is balanced to minimize X movement. While turning, it is balanced to minimize Y movement. Likewise, when going straight, a certain total Y offset is counted to determine the length moved, and when turning, a certain total X movement is counted.

 

 

Super Simple Class D Guitar Amp

Tonight I created a working guitar amplifier on a breadboard. It runs on 12v, and produces a decent amount of power (~1 watt) for practicing purposes when connected to a suitable speaker. I used a medium sized 4 Ohm one, visible in the video. The circuit is shown below:

 

The simplicity of the circuit stems from the use of this cool oscillator:

A sawtooth waveform at approximately 50Khz, with a nearly-linear ramp, is produced by the S9014 BJT. This waveform is approximately from 5v to 9v:

IMG_8558

The guitar signal is 200-300mV peak to peak, and the sawtooth is scaled to match this amplitude. Both the guitar signal and the sawtooth are coupled to 1/2 the supply voltage, with  a potentiometer used to fine tune the overlap between the signals.

Finally, both signals are fed into a comparator (LM311), and the output from this drives the gate of a MOSFET. A 10nF filter capacitor is added to the sawtooth signal to reduce oscillations caused by feedback from the speaker via the power supply rails. Some hysteresis on the LM311 would probably help even more. The large power supply decoupling capacitance also helps to address this: without it, spikes appear in the oscillator waveform, and wild high frequency oscillations can appear in the output.

Despite amplifying essentially only half the waveform, and various other limitations, the sound quality is surprisingly good. See video of the amplifier in action here: