Carry a science lab in your pocket and add a USB microscope to your Android device. Darren Yates explains how
Getting greater numbers of the next-generation interested in STEM subjects (science, technology, engineering and mathematics) is one of the conundrums facing educators around Australia at the moment. Enrolments in these subjects have fallen steadily over the 20 years between 1992 and 2012, according to a recent report from the Queensland University of Technology, with its authors suggesting reasons most likely include students self-perception of ability and perceptions of subject difficulty and usefulness’ (tinyurl.com/qutstem). That’s such a pity, because I can’t think of four more interesting and fun subjects than science, technology, engineering and mathematics!
Anyway, just about everyone carries a smartphone in their pocket now and that realisation has led to a couple of totally ingenious low-cost attachments that turn a smartphone into a high-powered microscope. However, as brilliant as they are, they both essentially need access to a 3D printer, while one also requires a silicon polymer called polydimethy lsiloxane or PDMS.
But for many Android device owners, there’s a third option we’ve been playing around with this month. A couple of years ago, we purchased a small $35 USB microscope off eBay claiming between 20x and 800x-magnification from its manual zoom lens. We’ve used it on a number of occasions in capturing the sub-pixel patterns of smartphone and tablet LCD and OLED display panels. It came with a disc of Windows software and worked surprisingly well.
My feature in last month’s issue of APC on recycling your old Android hardware got me recycling some old favourite USB sound cards, allowing me to upgrade the basic on-board audio recording capabilities of my Android devices into something approaching a digital audio workstation.
Now, we’ve found a way to add that USB microscope to Android devices. The process isn’t bulletproof (we’ve not had 100% success with every Android device tested yet), but it doesn’t need a 3D printer or require attaching anything more to your phone or tablet than a USB plug.
UVC DRIVERS
You’re probably familiar with USB Mass Storage and USB Audio Class device drivers — they’re the drivers built into most modern OSs that enable you to plug a USB flash drive or cheap audio DAC straight into your computer without having to worry about a driver download. What you may not know is that there’s a similar thing for cameras, known as UVC or USB Video Class, commonly used with webcams.
UVC drivers have appeared in Windows since XP and in Linux since kernel release 2.6.26. However, while Android is based on Linux, support for USB devices hasn’t been and still isn’t universal. The Google-powered OS picked up USB Mass Storage support in Ice Cream Sandwich/4.0, but the search giant has only just now begun adding USB Audio Class device support with the release of Lollipop/5.0.
A quick look online at various forums revealed we certainly aren’t the first to think of connecting a USB microscope into an Android device. What was surprising, however, were the number of responses that suggested it couldn’t be done. Not without reason, I guess — apart from Android’s general lack of USB device support, the lack of specific Android device drivers for many of these USB scopes would have you think there wasn’t much hope.
But as we found out last month looking into USB sound card support, it’s not all doom and gloom.
WHAT YOU NEED
As we said, we haven’t succeeded in getting our USB scope running with every Android device we’ve tested, but we’ve had at least two devices working perfectly with a number of free apps available on Google Play. Here’s what we’ve used:
- 800X (VGA-resolution) USB microscope ($35, eBay, 2012)
- USB-OTG cable
- CameraFi (Google Play, free)
- DashCam (by Droidperception, Google Play, free)
- UsbWebCamera (Google Play, free)
- Android device with at least ICS/4.0 OS
WHAT WORKS, WHAT DOESN’T
Now, the reason for that asterisk — we’ve had terrific success using the scope on a Galaxy S3 smartphone with custom Lollipop/5.0.2 ROM via the CameraFi app. We’ve also had it running nicely on an un-rooted Acer Iconia Tab A200 tablet with a stock ICS/4.0.4 ROM using DashCam. A few months ago, I picked up a budget quad-core 7-inch tablet with KitKat/4.4.2 and Wi-Fi from the local Coles Supermarket for $30. But unfortunately, while the tablet found the USB camera, no amount of cajoling or my best Basil Fawlty impersonations would have it pick up the video stream.
We also failed to get it working with a Galaxy S2 phone running a stock Jelly Bean/4.1.2 ROM as the ROM doesn’t include the necessary UVC driver support.
As for the USB microscope itself, we purchased ours back in late-2012 off eBay for around $35. Today, similar models now sell on eBay for as little as US$15, including shipping. We can’t guarantee which models will work with your Android devices, although we suspect most sellers are selling the same unit. Still, they also come with PC software, so you should be able to use it, one way or another.
All of the apps we’ve tried are free from Google Play. The Iconia Tab A200 is one of the few Android tablets to feature a full-size USB2.0 host port, so for other devices, you’ll need a USB-OTG adapter cable, which you can pick up from most electrical retailers for under $10.
USING CAMERAFI
CameraFi is the most polished of the USB camera apps we’ve seen and reasonably straightforward to use. It’ll capture stills and video, up to the resolution of your USB microscope’s camera.
Setting up the hardware, the first step is to plug the USB-OTG cable into your Android device, then plug the scope’s USB plug into the USB-OTG cable (or just use the full-size USB2.0 host port on an Iconia Tab A200). Launch CameraFi and once passed the splash screen, you’ll either get the setup screen if the app can’t find the camera, or you’ll go straight to the video frame. Make sure the ring LEDs are set to full brightness and you train the scope onto something, just to test.
If there’s no image, or you get the ‘no uvc camera found’ message, try either of the other two apps, DashCam or UsbWebCamera. We had no success with CameraFi on our Iconia Tab A200 with the same USB scope, but DashCam picked it up straight-away.
The most annoying thing with CameraFi is its penchant for including a logo-watermark on every still image you capture via the app. Interestingly, there are no watermarks when capturing video. The alternative is to simply use Android’s built-in screen capture feature for stills.
Our test scope offered a basic 640 x 480-pixel (VGA) resolution at 30fps and the Galaxy S3 smartphone had no trouble keeping up with the incoming video stream.
POWERING THE SCOPE
The Iconia Tab A200 tablet is the ideal device to run a USB microscope with — not just for its USB2.0 Type-A host port, but because it has a separate power input. Using a USB-OTG cable means power for the scope and its LEDs has to come from your Android device’s battery. To gauge the power drain, we measured the current draw of the scope through the USB-OTG port at 80-milliamps (80mA), ring LEDs off, and 130mA with them at full brightness. When you start capturing video from the scope camera, that drain will go up further. It all contributes to a reduction of battery life, so it’s just something to keep in mind during use.
We pointed our scope at a small Arduino Leonardo microcontroller board with tiny surface-mount components — not only could we see the make-up of the tiny surface-mount LEDs, we were able to zoom right in onto the red die and reflector plate. And it’s pretty good at seeing the subpixel pattern of a device’s LCD panel as well.
As we said, we can’t guarantee every USB microscope will work perfectly with every Android device — it will depend on whether UVC drivers have been included in the device’s OS. However, it’s certainly not as impossible as many people seem to think.
3D PRINTER & BOROSILICATE GLASS
If you’d prefer an alternative that’s lower in cost (kind of) and uses your Android’s built-in camera, a team from Pacific Northwest National Laboratory (PNNL) in the US came up with a really clever solution, combining 3D printing with small glass beads (tinyurl.com/mm2eohl). The technique relies on the fact that light passing through a glass sphere is refracted and magnified in such a way that when placed hard up against the camera lens, the power of magnification is inversely proportional to the diameter of the glass bead. Or in other words, the smaller the bead, the greater the magnification. PNNL might get the kudos for creating the 3D printed phone camera attachment, but the glass bead microscopy thing dates back to the 17th Century and Aton van Leeuwenhoek, often considered the Father of Microbiology for his work in spherical lenses and peering into life in miniature.
PNNL’s clever idea was to hold the glass bead up against the phone’s camera lens using a 3D-printed modified drawing board clip. With a 3mm glass bead, PNNL measured a 100x magnification, 300x with a 1mm bead and an impressive 1000x using a tiny 0.3mm bead. You can download the STL print files for each of the 3D printed clip designs from the PNNL web site above.
Getting hold of the glass beads, however, may prove a little more difficult. PNNL used a local US bead supplier, so we searched for a local Australian source. But, apart from the sea of retailers offering jewellery beads, we came up blank (you can’t use jewellery beads as the thread hole through the centre kind of ruins the effect).
What you’re looking for, initially, are 3mm round/spherical glass beads, but they can go by various names, including borosilicate glass, fl int glass and soda-lime glass beads. Do an eBay search for ‘3mm soda lime’ and you’ll find a few sellers in China who’ll do you a small 60-gram packet of soda-lime glass beads for as little as US$5, including shipping (again, make sure they’re not jewellery beads). Most of these glass beads are industrial rather than optic-grade, meaning you might find some with imperfections that cloud up the image. But even in a 60-gram pack, you should have a couple of dozen beads from which to find the perfect one.
The PNNL web site offers STL print files for 3mm, 1mm and 0.3mm bead clips, but they recommend you start with 3mm beads to get your bearings.
DROPLET LENSES
However, glass beads aren’t the only solution. Dr. Steve Lee, researcher at the Australian National University’s School of Engineering, came up with a novel approach that kind-of recreates Leeuwenhoek’s idea, but with a more modern twist. Instead of using soda-lime glass, Lee created a lens shaped like a droplet using polydimethylsiloxane (PDMS), the stuff contact lenses are made from (tinyurl.com/pmp6hey). According to the World Health Organisation, it’s also allowed in tiny amounts in a range of foods, including beer, vegetable oils, even frozen vegies, as an anti-caking agent (tinyurl.com/m6mptas).
Back to droplet lenses, Dr. Lee picked up the 2014 ANSTO Eureka Prize for his discovery, which is brilliant in its simplicity. He started by placing several ‘base’ drops of PDMS on a glass microscope slide and cured them in an oven at 70°C for about 15 minutes. He then added additional droplets and turned the slide upside down. As Dr. Lee says, ‘gravity does all the work’ creating the large droplets that form perfect lenses. By adding more droplets, allowing gravity to extend the droplet shape further and curing it in the oven along the way, you can create your own custom focal length and magnification power.
According to ANU, Dr. Lee and his team managed up to 160x magnification from their droplet lens (www.ncbi.nlm.nih.gov/pmc/articles/PMC4026886/).
While the ‘Biomedical Opticals Express’ research paper mentions the PDMS polymer Dr. Lee used (Sylgard 184 Silicone Elastomer from US chemical giant Dow Corning), it’d be interesting to see if it can be replicated with similar-viscosity retail PDMS silicone oils available in Australia.
As for how hard it is to make your own droplet lenses? Dr. Lee believes “it’s very easy to do — in fact, I think anyone at home could do it”.
TAKE YOUR PICK
Smartphones offer functionality and possibilities well beyond phone calls and Facebook. As we saw last month, even retired Android devices already have the right tech on-board to create audio signal generators for sound engineers and students. Now, you’ve got at least three different ways to turn your Android smartphone or tablet into a pretty decent microscope. Who says science isn’t fun?