More than 278 million mobile devices lie idle or deactivated in the United States, and nearly half are smartphones, consultants at Compass Intelligence say.

Sure, most of those are destined for the recycling heap. (You do recycle, right?) As for the others — the phones, tablets, game consoles, high-end digital cameras and other electronic goodies bought this decade — that’s cash sitting neglected in those drawers. Beats by Dr. Dre Studio headphones that sell for $270 new could be worth $200. A Wi-Fi-only 16-gigabyte iPad 2 that costs $400 new could fetch $300 or more. Here is how to sell them for the highest price.

Buy a brand with good resale value: Common sense dictates that if it was a highly sought-after consumer-electronics item in the first place, like an iPhone or iPad, a Microsoft Xbox 360 or Sony PlayStation, a Nikon D90 or Canon 7D digital camera, there is likely to be strong demand for it used.

If you are not sure how popular a device is, you could check Craigslist, eBay or Amazon.com to gauge broad interest.

A new site, Priceonomics.com, features more than two dozen price guides, for items from appliances to video equipment. A founder, Rohin Dhar, said in an interview, “We try to catalog basically all products ever made.” Then the company crawls through the Web, analyzing “hundreds of millions of listings” to find real-world prices.

“With enough data,” Dhar said, “over time, it starts to get pretty accurate for what people are selling things for.”

By far, Dhar said, Apple products are the most popular on the site. In a recent study, Priceonomics found mobile phones lost much of their value right away, and then continued to lose value more gradually over time. The exception was the iPhone. After 18 months, the iPhone retained 53 percent of its value, compared with 42 percent for Android phones and 41 percent for BlackBerry.

“You can buy an iPhone 4S today and sell it a few months later on the secondary market for almost what you paid for it,” Dhar said on his blog. However, he added, “if you buy the latest big, fancy Android phone, a few months later it has lost hundreds of dollars in value.”

Take care of your device: Protect it from physical damage with cases and covers, advises Josh Smith of Gottabemobile.com, a news and review website. Buy an extended warranty from the maker or from a third party like SquareTrade, squaretrade.com. When it comes time to sell, having a warranty that you can transfer has value, Smith said.

If the screen is cracked, replace it yourself with a kit, or send it to a professional service like Phonedoctors.com or icracked.com. A flawless iPhone can be worth $60 or more over the value of one in good condition at trade-in time, Smith said by email.

Keep the original receipt, charger and accessories, as well as the box, to ship the device when you sell it later, Smith said. “This doesn’t have a huge impact on the price offered by Gazelle and others,” he said.

Still, he added, “if you plan to sell to an individual, I’ve found that the box is a big plus, just because it feels more like a new product to the buyer.”

Pick the right time to sell: Apple enthusiasts have this down to a science.

MacRumors.com, a news and review site, provides a buyer’s guide with a product summary for each Apple product. A green dot means rumors suggest it is smart to buy, given that product’s life cycle; red means wait; yellow means buy, but only if you need it. Currently, only the new iPad is awarded the Buy Now green dot.

Decide.com, a website and mobile app that tells when to buy electronics, sifts through millions of pieces of data to guess when a new product is coming out. Decide advises shoppers to buy or wait, using proprietary price and model predictions.

Gazelle reports a spike in BlackBerry trade-ins. The company said consumers, perhaps fearing rapid depreciation of the value of their BlackBerrys, were upgrading to other platforms quicker than ever before.

But the trade-in values vary. A BlackBerry Bold 9650 from Verizon in good condition was valued at $26. A BlackBerry Bold 9900 from AT&T in good condition would fetch $177.

Now that you have completed your research, it is time to pull the trigger. Do you opt for Craigslist and instant cash, taking the necessary safety precautions to complete the transaction? Or do you choose eBay’s Instant Sale, instantsale.ebay.com, as more secure?

For instant gratification in selling a used iPhone or iPad, Gazelle’s Gadget Trader, an iOS app, is tough to beat. In seconds it detects the device and reveals how much it is worth in good condition. Tap the Sell This Phone to Gazelle button and the deed is done.

Smith of GottaBeMobile recommends services like Gazelle, Amazon, NextWorth and Glyde because they simplify the process, offering a safe and secure way to sell with free shipping and the ability to lock in prices.

One last word about prices: If you hope to sell your phone to buy the latest iPhone in the fall, keep in mind that Apple typically discounts previous models.

“Apple will likely sell the iPhone 4S for $99 and may give away the iPhone 4″ with a two-year contract, Smith said. (The 3GS is expected to remain supported by Apple, so those models are still of value.)

Once these price cuts happen, the resale prices for the iPhone 4S and iPhone 4 will drop.

“Sell before the drop for the best deal,” Smith said, “or buy after the drop if you don’t need the newest iPhone.”