Welcome back to the Digilent Blog!
Last time, I showed my initial attempt into living out my dream of performing magic tricks (with a little help from the electronic realm), and found that my “oh yeah, sure, no problem” attitude was not going to work. So I came up with a new plan of using the PmodMAXSONAR as an input for my desired height and using a PmodOD1 or PmodOC1 as my method for controlling the fan speed to levitate the ball in a nice four foot polycarbonate tube. Let’s see how that turned out.
I definitely fought with this one for awhile as I was too stubborn to give in, at least not quite as easily as I had with my first attempt. I did see some success and learned a lot about the balance between usability, reliability, and effort exerted to make the first two items viable. In principle, I would receive distance information from the PmodMAXSONAR (since it’s a nice ultrasonic sensor to detect objects, such as my hand, that are located in front of it), which I would then process within the microcontroller to see the measured distance is within my desired sensing range.
If the reported distance was between 6 and 36 inches, I had the microcontroller calculate a corresponding duty cycle to run the fan with the PmodOC1 (I decided against the PmodOD1 since my small fan would not need as much current as the PmodOD1 is capable of providing) as my method of switching the 5V supply to the fan on and off. That’s when I started running into some problems.
The first was that I didn’t stop and consider what the ‘OC’ meant in reference to the PmodOC1—it means open collector. This means that the collector portion of the NPN BJT is not connected to the positive voltage supply that it would normally be connected to, implying that simply connecting the output on the PmodOC1 to whatever you trying to run does not do anything (as I found out). Rather, the ground of whatever you are attempting to run needs to be attached to the output on the PmodOC1 (the collector) and the positive wire (or anode in the case of an LED) needs to be attached to your positive power source. This configuration will allow current to flow through the system when you apply enough current to the base, as shown in the diagram below.
After figuring this out, I promptly found that once the fan reached a certain speed, the ping pong ball would simply travel all the way to the top of the tube with no proportionality aspect in terms of height whatsoever. Turns out (as I should have realized), that if you want proportional height control, you need to implement a way for a linear change in energy (either an increase or decrease) to occur. Because we want the fan to blow more strongly as the measured hand height increases, we need to slowly increase the amount of air that is released from the tube as the ball floats higher in the air by drilling small holes about an inch apart all the way up the tube.
In this endeavor, I was wildly successful—everything worked as exactly as it was supposed to. And then the moment ended.
Apparently, when you use things in way that they are not designed to be used, like rapidly turning a DC fan on and off, they tend to deteriorate as evidenced when I found that having the fan on full blast only floated the ball a third of the way up the tube rather than threatening to blow it out of the tube entirely. Additionally, the PmodMAXSONAR, while great in principle, proved to not be as user friendly as I originally envisioned. As an ultrasonic range finder, it does best at detecting flat objects such as a wall or ceiling whereas the human hand tends to have multiple curves, so a clean ultrasonic signal is not returned to the Pmod. Also, people are never quite sure if their hand is directly above the PmodMAXSONAR, leading to some skewed results.
With all this in mind, I will make another, (and hopefully final), attempt to successfully float a ping pong ball with a PmodACL2 that I can tilt and measure the acceleration from to execute height control, a DC fan designed to be controlled by a PWM signal eliminating the need for the PmodOC1), and a taller stand to enable more air flow.
4 Comments on “Levitating a Ping Pong Ball – First Serious Attempt”
Great project. I want to ask what dc fan do you use on this project? are you using a 1-3/4 diameter tube? it would be really great if you can share some specs on this project. I’m currently creating the same project but the dc fan i bought was just not strong enough to levitate the ping pong ball. i might be using a wrong diameter for my tube as well, 2 inch which i think its too big. I appreciate if you can email me your specs on this project despite the lateness of this comment.
I apologize for the lateness of my reply. The fan I ended up using in the final iteration, https://blog.digilentinc.com/levitating-a-ping-pong-ball-obliterating-all-obstacles/, was this one: http://www.mouser.com/ProductDetail/Sanyo-Denki/9GA0405P6F001/?qs=sGAEpiMZZMt9MS9kROxCw0CYySnW7Gy%2fgdvKpA5eahc%3d.
The tube that I used, https://www.amazon.com/dp/B000OMHJJO/ref=biss_dp_t_asn, had an inner diameter of 1.625 inches, so that was just a bit larger than one side of the fan (40 mm) but it would still be able to rest on the corners of the fan. The biggest thing I made sure of was that the circular portion of the fan more or less “filled up” the diameter of the tube so there wasn’t any dead space inside of the tube.
Your problem is that those fans have a separate PWM control line—you should have been using that rather than the Pmod OC1.
What is the difference between the red and black side on ping pong paddles?