Epic 4G driver fix (for Windows 7 64-bit)

Use a good USB cable. Apparently, it really *is* that simple!

The original cable, shipped with the phone, works great for charging but does NOT work for data transfer — at least on every computer running Windows 7 that I’ve tried. It causes the phone to not be recognized when plugged in to the computer as a USB device. I have had good luck with the following cables — and there are probably others out there that work well, too.

Here, step by step, is how I got the driver to recognize the phone. I have tried this on my work laptop (a Dell Latitude D630), my home desktop (a homebuilt Core i7 running a Gigabyte X58 chipset motherboard), and several other PCs.

  • Find a good USB cable. Here are the results from various cables that I’ve tried:
    • Stock USB cable shipped with the phone: NO GOOD
    • (nice) Belkin USB extension cable / adapter kit: NO GOOD
    • Belkin USB-to-micro adapter, plugged directly in: UNRELIABLE
    • Radio Shack micro USB cable:EXPENSIVE BUT RELIABLE!
      (I disagree with the reviews on the Radio Shack site; this cable looks to be very solid and reliable, and works well with the Epic — but is way more expensive than it needs to be. For $25, it had better work well!)
  • Turn the phone on, and unlock it if needed, so it is at the home screen.
  • Plug the phone in to the USB cable. This should bring up a dialog box.
  • Choose “Mass Storage” when prompted
  • Click on the “Connect” button
  • Click “OK”. (Google, WHY is Froyo so much more of a pain to connect? Do we really need to click through three confirmations for this??)
  • Wait for Windows to detect the phone and load the mass-storage driver. The phone should appear as removable storage under “Computer.”
  • Remember to unmount the phone (using the taskbar icon) when done.

If these steps don’t work, here are some things to try:

  • Try another USB cable. For some reason, Windows 7 is very picky about USB cabling when connecting to an Android device like the Epic 4G. This is what finally solved the issue for me — even though I was already using the OEM cable supplied in the box with the phone.
  • Download the mass-storage drivers for the phone from Samsung’s site here. (Click on software, then on the file folder icon at the right.) Unpack it, unplug your phone from the PC, and run the installer.
  • Go into Device Manager and remove the USB driver and try the above again.

Good luck. Please feel free to post any questions, comments, or suggestions here.

 

Posted in Android, Digital, HOW-TO, System Administration, Toys | 2 Comments

Fundamentals: Ohm’s Law

Ohm’s Law is fundamental to understanding the three-way interaction between three of the most important concepts in electronics: Voltage, Current, and Resistance. Here is a quick overview of these concepts, from a DC-circuits viewpoint:

Voltage, measured in volts, is the difference in electrical potential between two points in a circuit. Voltage is always relative; giving the voltage at a certain point in the circuit is meaningless unless you specify what the reference point is. (Similarly, it would be meaningless to give your location as ten kilometers west, unless you also specified west of where.) The relativity of voltage is the reason that birds can safely land on power lines. The power line may be at hundreds or thousands of volts with respect to the ground, but if the birds don’t contact both points, the difference is meaningless.

Current, measured in amps, is the amount of electricity flowing through a certain point of the circuit (a connection, usually a wire) per second. Since current flow is specified at a certain point, it is absolute.

Resistance is a property of materials that relates current flow to the difference in voltage. The higher the resistance, the “harder” it is for current to flow through that material — and the higher the voltage will have to be in order to force a given amount of current through the material.

Intuitively, the three quantities can be thought of in terms of plumbing. This analogy works reasonably well, but don’t expect it to hold water (pardon the pun) for more complex circuits.

  • Voltage can be thought of in terms of pressure — which is always a difference between two given points.
  • Current can be thought of in terms of flow rate — how much electricity (or how much water) is going past a certain point in a given amount of time.
  • Resistance can be thought of in terms of restricting the flow (of electricity, or water): if you want to move water at a given flow rate through a narrow, high-resistance pipe, it will take more pressure than if the pipe were larger. Similarly, it takes a greater voltage to move a given current through a high-resistance circuit than a low-resistance one.

The basic equation for Ohm’s Law, E=IR, can be expressed in three basic ways:

  • E = IR :   Voltage (E, for Electromotive force) is equal to Current (I) times Resistance (R). This means that if a current of I amps is flowing through a resistance of R ohms, there will be a difference in voltage of E volts across that resistor.
  • I = E/R :   Current is equal to Voltage divided by Resistance. This means that if you apply a voltage of E volts across a resistance of R ohms, the current flow will be equal to I amps.
  • R = E/I :   Resistance is equal to Voltage divided by Current. This means that if you pass a current of I amps through a resistor, and the voltage drop is E volts across that resistor, its resistance is equal to R ohms.

By solving the right form of this equation for the variable you want to find, you can determine what resistor to use, what the voltage will be for a given current and resistance, or what the current will be for a given voltage and resistance.

Perhaps the easiest way to remember Ohm’s Law is graphically:

A memory aid for Ohm's Law. Cover up the variable to solve for.

Take the image above and cover the variable to solve for with your hand:

  • Cover E, and you get I*R: Voltage is Current times Resistance.
  • Cover I, and you get E/R: Current is Voltage over Resistance.
  • Cover R, and you get E/I: Resistance is Voltage over Current.

Resistors actually turn out to be extremely useful when making electronic circuits. Some of their many uses will be covered in another article.

Posted in Analog, EET201, Electronics, Fundamentals, Science | 1 Comment

Puzzle Box

For some reason, I’ve always really liked the idea of puzzle boxes. Being a Digital Design geek, I enjoy figuring out how systems work — and I think it’s just human nature to enjoy a good mystery.

Ever since reading about the (original) Reverse Geocache a few months ago, I had wanted to build one. Except for the box itself, I already had all of the pieces I needed (microcontroller, GPS, LCD, servo motor, battery) — and the microcontroller code to tie them together.

Traditional geocaching is a high-tech game of hide-and-seek, where you are given the latitude and longitude of a hidden container, and you use a GPS receiver to navigate there and find it. It’s a fun hobby, good exercise, and definitely recommended.

Reverse Geocaches were recently invented by Mikal Hart. (He created the original one as a wedding present for a friend — the story is a great read.) The idea is nothing short of genius — instead of finding a hidden box, give the box to the recipient, with no instructions. “Reverse Geocache” is his trademark, so I guess mine is a “GPS Puzzle Box.” (Heck, this lets me expand the idea with accelerometers, gyros, light sensors, etc later, anyway.)

The box (which is locked, with no readily apparent unlocking mechanism) has an LCD display and a single button on its top. Pressing the button, once the box is where it can get a GPS fix, results in a distance (say, in km) being displayed on the LCD. The box “knows” where it wants to go, and will only open when it is at that particular location.

My wife’s birthday was coming up, so I decided to build one for her while they were still a unique gift. (Despite the best intentions of its inventor, I’d be surprised if we didn’t see these in Wal-Mart in a few years’ time. They’re just that cool.) My wife is inquisitive and very bright — but she can also be very impatient and is not by any means a “gamer” — so I wasn’t sure how things would turn out.

Here is a relatively detailed look at what is involved in making a project like this. (If you’re thinking of getting into microcontroller electronics yourself, you definitely should — it’s a lot of fun, not too hard to learn, and doesn’t cost anywhere near as much as you might think.)

First, I prototyped the design on solderless breadboard. This is a great way to start out a new design, since it allows changes in the circuit to be quickly made. It also makes diagnosis easy, since portions of the circuit can be easily disconnected and tested independently from the rest.

Here is the schematic for the device. A reed relay was used to control power to the peripherals; in standby mode, only the PIC draws power, waiting for the button to be pressed. In this mode, the I/O ports are tristated, and the onboard oscillator is run at 31kHz instead of the usual 8MHz.

The schematic. Most components are powered off in standby mode; accessory power is controlled via the reed relay. Click for larger.

Although due to the nature of the device, large pieces of the design certainly resemble Hart’s original, I designed the box from scratch, going just from Hart’s idea of a locked box with a GPS, an LCD and a pushbutton. The original used an Arduino, but since I’m pretty much a PIC partisan, I went with a PIC18F2525-I/P microcontroller. (Dev boards like the Arduino are cool, especially if they get more people interested in prototyping — but it just seems wasteful to use a whole dev board in a project when a bare MCU will do. Each part in the design does something, this way. Besides, it’s cheaper.)

Given that the box had to not only handle operating a LCD and servo, but do GPS position (distance) calculations, I decided to program the firmware in C. (My reasoning was that rewriting my LCD and servo code in C would be easier than doing a floating-point implementation of square root in assembly. Even I’m not that fanatic — yet.)

Writing the LCD code was fairly straightforward; there are some timing constraints, but all of these are of the easily-resolved “not less than” variety. You could send commands to the LCD at a rate of one bit per century, and it should work just fine.

Once the LCD code was sorted out (this way, I can use printf() messages for debugging), I moved on to the servo code. This was trickier, but still fairly straightforward; with the use of a ‘scope, I could tell if the pulses were more or less the right length, and could then tweak them to make the particular servo used turn to the right angles. (Servos do vary in timing among individual units, but each unit seems reasonably consistent over time, fortunately.)

The most difficult part of the project was getting the GPS and serial code working. Without the LCD to help debug, this would have been impossible. To make a long story short, since I was running the PIC on its internal 8MHz clock, the timing was only guaranteed to within 2% or so, which turned out to be too imprecise to run the 4800 baud serial timing at spec. Instead, I had to tweak the per-bit and per-half-bit timings to make everything come out as it should — and the settings for this vary with the individual PIC used. I really ought to have included a TTL oscillator, but the PIC’s onboard oscillator turned out to be stable enough that I could tweak it into working. (Digital storage ‘scopes which can grab a frame of NMEA output and let you zoom in, checking timings and output sequences, are a wonderful invention, by the way.)

Now I had to find a suitable box. A quick eBay search turned up a broken music box that looked perfect.

The box, prior to being repurposed

Once the box arrived, I looked it over; the mainspring in the music clockwork had broken, so I didn’t feel as bad about repurposing it. (I kept the music clockwork in my parts bin anyway — I could always drive it with a motor or something.)

Next, I had to decide on a layout for the components, which meant deciding what batteries to use. I measured the current for the whole setup, and came up with about 80mA running, and very little current when dormant. At 850mAh capacity, four rechargeable NiMH AAA batteries would provide about ten hours’ runtime, which would be plenty. With the GPS, LCD, and button in the recessed lid, I decided to put the batteries and circuit there, too (to avoid running a dozen or so wires to the base.) This left only a few wires to run to the base, for the servo and debug lines.

The batteries, LCD, and opening for the GPS. (The circuit board clips on to the bottom of the LCD.)

Once the LCD and GPS openings were in place, I went about designing a locking mechanism. The local Target had a picture-hanging kit, from which I was able to bend a few metal hooks into latches. Mikal Hart’s design uses a cut chopstick as a latching mechanism, but I figured I could get away with using a servo horn directly, if it was supported solidly enough.

The next step was to move the circuit from the breadboard to a circuit board. I cut a Radio Shack circuit board to fit, then figured out where the LCD header needed to go. From there, I laid out the sockets for the PIC microcontroller, as well as the relay and other various parts.

The circuit board. Not very pretty, but functional.

Once the circuit board was built, I tested it, keeping the lid open. Everything seemed to work correctly, but to help Murphy’s-law-proof the device, I created two backdoors. First, I brought out all five debugging pins (Vcc, Ground, Vpp, PGD, and PGC) to a wire-wrap header tucked discreetly underneath the box. Next, I put a check in the startup code to unlock the box if the button were held down at power-up.

With these precautions in place, I finally shut the box for full-scale field testing. Apart from some “urban canyon” GPS problems, it worked well on a quick walk to a nearby restaurant; the distances decreased as I walked towards the designated coordinates, and the box opened once I got there.

Next, I decided to test the practicality of using a map to determine the goal location. I picked a goal location near where I lived, then drove home from work, checking the location on occasion when stopped at traffic lights.

 

The GPS Puzzle Box in action!

The box dutifully opened once I got home — but how accurately would the various distances recorded allow me to determine the goal, if I didn’t know it in advance? I entered the corresponding circles into MapPoint, and got the result I was looking for — intersecting arcs well within half a block of the goal. The box really worked — and just in time: my wife’s birthday was that weekend. I prototyped a hollow block of ABS plastic with an inscription (it helps keep the wires under control), and covered up the electronics with a piece of green construction paper.

Inside the finished puzzle box. The latches are bent picture hangers, covered with shrink wrap. The servo horn can be seen at the bottom (it's in the closed position here "locking" the box open.)

Finally, it was showtime. I reset the box, loaded it with some nice opal-and-silver jewelry (I’m not totally clueless!), and set the destination for the parking lot of Longwood Gardens.

How did my wife react? Well, the “practical” / “impatient” side almost won out. Once she determined that the box wasn’t going to open right then and there, she discussed encouraging it to open using a screwdriver and/or a hammer. (Like I said, she’s very practical that way.) I convinced her to give solving the puzzle a try, though, and we set off (laptop and PICKIT2 debugger along just in case).

“Which way should we go,” she asked. I shrugged and said the box just seemed to give a distance, not a direction. She decided that it might be somewhere west (statistically, a good guess; we go that way a lot), so we set off down I-76. The distances started decreasing, so we were on the right track.

Her next question was “How do we know which way to turn?” I tried turning things around on her. With several degrees including an MD, she’s easily smart enough to know how to solve this puzzle, but needed to get past her impatience. “Where are all the places 48.2km from here,” I asked. “Well, they’re in a circle.” She had the right idea, but was still fiddling with the hinges and talking about cracking the box open.

We stopped for breakfast and I got out my laptop to show her the first two distance circle intersections on the map. One was to the northwest; the other to the southwest. She picked the first one (also statistically a good guess, which happened to be wrong this time), and asked how we would know if that was it. I showed her how a third circle would answer the question — or if the distance started increasing once we turned north, that would also mean we had gone the wrong way.

We turned north, and soon the distances did start going up. At the next exit, we stopped for fuel and turned around, following 476 south. Eventually, the distances started decreasing slowly; the intersection had indicated the goal was west of 476, so we turned west. A short while later, she guessed the destination (there were signs along the way.)

Once we got to the parking lot, the box opened. Seeing the jewelry definitely improved her opinion of the whole adventure — and we had a pleasant day walking around Longwood, as well.

 

Posted in C, Coding, Digital, Electronics, Games, GPS, HOW-TO, Level 4, Math, PIC Microcontrollers, Projects, Toys | Tagged , , , , | 3 Comments

A (friendly) open letter to Radio Shack

Dear Radio Shack,

Many of us who remember the “good old days” of going to Radio Shack for electronics parts, 100-in-one electronics kits, Forrest Mims’ books and the like were deeply disappointed when Radio Shack transformed itself from an electronics hobbyist’s one-stop-shop into a generic, consumer-centric cell phone and camera store. Its re-branding as “The Shack” seemed to be the final nail in the coffin of good old Radio Shack, and I was half-expecting to see the already meager selection of electronics components phased out completely.

Recently, though, Radio Shack seems to be making a sincere effort to win back do-it-yourselfers. This is great news! Although these days I do most of my electronics business with SparkFun, DigiKey, Jameco, MPJA, and Mouser, having an actual local electronics store available would be very welcome indeed. (Radio Shack hasn’t really been that since the late 80s or early 90s, unfortunately.) Radio Shack’s stock among many electronics hobbyists certainly isn’t what it once was. As one of my friends commented, “Radio Shack: You’ve Got Questions, We’ve Got Blank Stares™.”

As the great Jim Croce once said, “It doesn’t have to be that way.

The trend towards selling cell phones and cameras is understandable. After all, Radio Shack is a business, and needs to make money to survive. It’s nice to see you trying to return to your roots among the DIY community, though. By doing so, you have an opportunity to not only generate a lot of goodwill among electronics hobbyists (who tend to spend significant amounts of money on equipment and components), but to help spread the DIY spirit and give a needed boost to our economy and the community’s education.

The most recent issue of Radio Shack’s DIY e-newsletter (that such a newsletter exists is itself encouraging) asked for suggestions for three products that we wished Radio Shack stocked locally. That’s a start, but there’s so much more potential out there! Here is a list of some suggestions that I think would really help Radio Shack not only rebuild some major “street cred” among DIYers, but help out the DIY community in a big way and even make some money in the bargain.

  • Get members of the DIY / hobbyist / geek / nerd community on board to provide advice. I’m sure Forrest Mims, Jeri Ellsworth, Chris Savage, Chris Gammell, Lady Ada, and many others would have plenty of good suggestions. If Radio Shack really wants to help out the DIY community, we’d love to help.
  • Consult with local hackerspaces, and consider sponsoring projects and contests with in-kind donations in return for publicity.
  • Expand the parts selection. Every DIYer will have different answers on what to focus on, but some things are universal. Here are some of the big ones that I would like to see…
    • 1k resistors (maybe a 100-pack for under $10)
    • 0.1uF or 1uF capacitors for decoupling
    • Larger packs of the reed relays (206-2478). These are great little parts!
    • DIP form factor PIC microcontrollers, especially the 12F683 / 16F88 / 16F887 / 18F4550 etc.
    • Arduinos. (If I saw one in Radio Shack for under $50, I’d buy it just to see what all the fuss was about. I bet others would, too.)
    • 830-pin solderless breadboards and wire kits
    • Better soldering irons (although this has improved, recently.)
    • Servo motors — at least something like the Futaba S3003
    • TTL oscillators (and lots of other DIP integrated circuits)
    • Lithium-Ion batteries (if the lawyers will let you carry them)
    • Better quality tools, especially small screwdrivers. Stock the cheap ones if you must, but have at least one or two decent sets (Xcelite, etc) on hand, too.
    • PC modding parts — power supplies, fans, etc.
    • Assorted small bolts, nuts, standoffs, etc.
    • A better selection of crimp connectors — maybe in bulk
    • A selection of higher-wattage (maybe 10W or 25W) resistors
  • Partner with SparkFun to offer some of their parts and kits locally in Radio Shack stores. SparkFun is a great example of an electronics company that truly “gets it.” Unfortunately, they’re in Boulder, CO — and even FedEx overnight is only so fast. Sometimes you need an accelerometer or LCD display — right now. Radio Shack could help with this! SparkFun-branded parts would certainly get me to stop by Radio Shack more often.
  • Bring back the “grab boxes” of mystery parts! Twenty years ago, one of the best parts of stopping by Radio Shack was the possibility that they would have one or two of these little boxes full of who-knows-what. One of these boxes, with capacitors, transformers, stepper motors, LEDs, resistors, and ICs could keep a hobbyist entertained for a week!
  • Provide datasheets for the parts you stock, at least online — and make sure a pinout and minimal data are available on the package. (Get someone knowledgeable about electronics to help with this.)
  • Designate at least one employee per store — and preferably one per shift, per store — as an electronics guru. He or she doesn’t have to know every detail about every part in stock, but should have a basic understanding of circuit theory and be able to recognize basic parts and read a datasheet etc. At a minimum, a hobbyist shouldn’t have to explain what an LED is.
  • Provide open-source plans for electronics projects, and put together the parts for these projects as kits, with suggested skill level ratings. (SparkFun could help out with this.) Hobbyists could start out by building a LED mood light, then progress to building a clock, or learning about microcontrollers and FPGAs and designing their own devices. DIYers get help learning more about electronics, Radio Shack gets more revenue, and the economy gets a boost when these folks decide to pursue engineering as a career and/or design the next big thing. Everybody wins!
  • Start a “Radio Shack University” to help people get started learning about electronics. Make video tutorials available free online, along with project plans, schematics, open source firmware, and parts lists (with Radio Shack part numbers helpfully provided as a subtle hint.) Start a forum for discussing these projects; DIYers are famous for helping each other out. Again, SparkFun is known for doing this sort of thing — it provides a service while creating a demand for components and equipment.
  • Phase out “The Shack” marketing. If nothing else, this is a slap in the face to the Amateur Radio community — and for me, represents all that is disappointing about Radio Shack these days (dumbed-down, consumer-centric, lowest-common-denominator marketing).
  • I see Radio Shack will be at Maker Faire. Great! Listen to what the Makers have to say. If Radio Shack is supportive of the Maker community, they will notice.
  • Get social networking involved. Create “achievements” based on knowledge, project creation, interaction with the DIY / hobbyist community, etc. (Make it so that these have more to do with learning, creating, and/or helping others than purchasing, and they will be a lot more meaningful to us.)
  • (This is kind of out-there but would be very cool if feasible) Consider offering in-store PC board prototyping services. If a laser-etch process could be developed, PC boards could be done locally, in-store, with a small equipment footprint. This would be a huge draw to the prototyping community!
  • Offer pick-up service for components. Customers order parts through the Web, pay online, and pick up a custom package at their local store. (Allow customers to make custom kits and share these lists with others, if they choose.)
  • Consider offering local delivery services for a fee, or partnering with local courier companies. This would be more for the professional community — but Radio Shack is in a great position to supply university research labs, small businesses, and the like with parts on a same-day basis.

I would love to see Radio Shack truly become a local electronics store once again. From the viewpoint of the hobbyist community, there is a huge need for such a store! Even in many large metropolitan areas (I live and work in Philadelphia), it’s difficult or impossible to find an actual electronics (parts) store locally — so hobbyists are forced to order parts online. This not only can cause big delays, but can deter purchases: why pay $6 shipping for a 50-cent part?

I bet that I would spend well upwards of $100 in a typical month in a good, local, open-source-friendly electronics store like Radio Shack could be — especially if enticed by interesting project ideas and ready-made parts lists. I know I’m not the only one, either.I used to love going to Radio Shack “back in the day,” and would love to have the good old Radio Shack back.

Let’s make it happen. (Please contact me if I can help with anything.)

Sincerely,

M. Eric Carr
Technologist, Computer Engineering grad student, and electronics tinkerer
eric@paleotechnologist.net

 

Posted in Current Events, Digital Citizenship, Electronics, Nostalgia, Toys | Tagged , , , , , , , | 4 Comments