Let’s say you’re a guy encountering some fertility problems, and you want a hands-on approach. A new device could let you turn your phone camera into a microscope — which would then allow you to test your semen in the privacy of your own home. Within seconds, the app can assess the quality of a man's swimmers with 98 percent accuracy.

All over the world, 45 million couples grapple with infertility; in almost half of those cases, it’s because the man is infertile. But testing semen isn’t easy — it requires men to masturbate at a clinic and then wait a few days for the results. The analysis is either done manually by a trained technician, or through expensive equipment, and can cost patients anywhere between $150 and $350.

“It’s obviously a great improvement.”

The device, which was described in a study published today in Science Translational Medicine, makes the whole process much less awkward and less expensive. It’s made of a smartphone attachment, a disposable microchip, and an app; it was 3D printed and cost less than $5 to make. “I like this device,” says John Amory, an endocrinologist at the University of Washington Medical Center, who did not take part in the study. “It’s obviously a great improvement.”

When it comes to fertility tests, women have a pretty good variety of over-the-counter products. For men, however, the options are limited. Products like SpermCheck, FertilMARQ, and Trak are all FDA-approved, but they only analyze how many sperm cells are in the semen. The higher the number of sperm, the better a man’s chance of fertilizing an egg. But it’s key to also see what percentage of those sperm are moving. If sperm are still, they won’t perform the job. And these products don’t measure so-called sperm motility. That’s how this new device is different.

The new fertility test analyzes both how many sperm cells there are and what percentage of them move — two critical parameters in determining whether a man is infertile. Here’s how it works: you slide on the smartphone attachment so that your phone’s camera is basically turned into a microscope. You then collect semen into a cup, dip a disposable microchip into the semen, and then dip it inside the smartphone attachment. An app takes a video of your semen, and within five seconds it gives you results.

The researchers tested the device on 350 semen samples, and were able to assess sperm with 98 percent accuracy. More than half of those samples were correctly analyzed by 10 volunteers with no formal training, to prove that the device is easy to use. “Our technology has a lot of advantages,” says study co-author Hadi Shafiee, an assistant professor in medicine at Brigham and Women’s Hospital, Harvard Medical School. “It’s pretty convenient.”

The new gadget is similar to another FDA-approved device that came out earlier this year, called YO Home Sperm Test. YO has a similar smartphone attachment and app, but it uses different parameters to test male fertility. It counts the number of moving sperm, and assesses semen quality based on its own standards, Shafiee says. Shafiee’s device, instead, makes its assessment based on World Health Organization guidelines, and is therefore more reliable, Shafiee says. YO also requires the semen to be diluted in water and takes three to five minutes to give results. These results are 97 percent accurate, YO spokesperson Jack Haanraadts tells The Verge in an email; however they were not published in a peer-reviewed journal.

Shafiee believes that his device will cost around $50 — about the same as YO — and will be available in two to three years, after being approved by the Food and Drug Administration. The technology has the potential of making testing male fertility much more accessible: some men are reluctant to be tested because of the stigma of infertility, Amory says. “If you give men the ability to check their sperm count at home, that’s great, right?” he says.

It will also be useful for men who get vasectomies, Shafiee says. When men are sterilized, it takes a couple of months for the sperm to completely wash out. Patients are supposed to get check-ups before having unprotected sex, but few do. With this gadget, men could make sure they’re indeed sterile with little effort. The device will also make testing easier in developing countries, where clinics often can’t afford the expensive microscopes and computers needed to analyze semen.

But the full potential of the technology might not even be here yet. Shafiee says he’s working on a similar device that can quickly analyze blood and saliva for infectious diseases. For example, a similar smartphone attachment and disposable microchip can be used to count certain white blood cells killed by the HIV virus. That way, someone infected by HIV can be easily diagnosed. “It’s going to be very exciting,” Shafiee says, “even more than this fertility market.”