1/27/2014— Eric Kolker
Hey Tesselators, Eric here.
The GPRS module has been both a ton of fun to work on and prompted its fair share of headaches, so strap in: this post will feel a lot like the one I wrote a while back about debugging the RFID module.
What’s that acronym?
No shame, I had to Google it too. GPRS stands for “General Packet Radio Service,” but most people know it as a GSM (“2G”, if you will) cell connection. Devices with a GPRS radio can interact with the outside world via SMS, voice calls, and even TCP/IP. Besides enabling you to essentially build your own phone with a Tessel, the GPRS module keeps the Tessel connected outside the range of WiFi. It’s one of the Class B modules we added as a stretch goal during our crowdfunding campaign on Dragon Innovation.
As with many of our modules, we borrowed much of the design of the GPRS module from an open source product sold by Seeed Studio. The first task, as usual, was to adapt the Arduino shield so it would play nicely with a Tessel. The biggest difference we had to overcome here had to do with the power requirements of the different components.
Power work is never over
Most devices you run into these days are either 5V or 3.3V. For instance, Tessel is a 3.3V device, most Arduinos are 5V devices, the RaspberryPi is a 3.3V device, etc. Taking a step back, when I say that something is an x V device, that usually means that it takes x V between its power in and ground to turn the thing on and that all of its I/O pins can tolerate a maximum of x V. In other words, if you don’t give it a high enough voltage on its power pins it likely won’t turn on (I/O may still work when driven at a lower voltage,, but check the datasheet and look for the term “logic high”), but if the voltages are too high then you run the risk of destroying the chip, or, in EE jargon, “letting out its magic smoke.”
The chip at the center of the GPRS module, the SIM900, however is neither a 3.3V device, nor a 5V device, nor even a 1.8V device. Instead, it’s some weird hybrid of…most of those. In a nutshell:
- The I/O for the chip is all 2.8V. This means that the pins don’t like anything higher than 2.8V coming in.
- The chip will run off 3.2V to 4.1V. Anything higher or lower and it will try to protect itself by shutting down. As it turns out, these values play very nicely with LiPo batteries, which typically hover at around 3.6 V.
- Last but not least, the module generally has a rather high current draw (on the order of 50mA when idle), but behaves more like a sinkhole when transmitting and can draw peak currents of up to 2A.
The reason the last two bullet points are so important has to do with conservation of power (summarized poorly here). In so many words, the basic idea is that some devices, when pushed beyond their limit, will conserve power (in this case, P=IV) before they give up completely and shut down. In the context of the GPRS module, this means that when we transmit and the module’s current draw spikes, the voltage drops. SIMCOM, the part’s manufacturer, knows that this will happen; the graph below is from the datasheet:
This is chart tells us a few things:
- If the power supply rail for the GPRS drops below 3.2 V, even for some very short amount of time, then the module turns itself off.
- If the total drop in voltage is more than 300 mV, then the module turns itself off.
- We should expect peak current draw up to 2 A.
If we’re running the GPRS module off the Tessel’s 3.3 V rail, then we only have 100 mV of wiggle room before the module shuts down.
Before we go any further, here’s quick refresher on the E&M for capacitors, mostly in layman’s terms/in the context of household plumbing:
- When electrons hang out on a node (the place where two or more electrical components meet), we say that charge has accumulated on that node. Charge has units of Coulombs ©, but is denoted with a “Q”. If you like, you can think of charge as a number of liters/gallons of water at a particular point.
- Current, which is measured in Amperes (A) (or, equivalently Coulombs per second) but denoted with an “I”, is the flow of electric charge from one node to another through a component. You can think of it as the flow rate of water through a pipe.
- Voltage, measured in Volts (V), is the difference in electric potential between two nodes, or the capacity of charge at a node to do useful work. Think of it as water pressure.
- Capacitance, which has units of Farads (F), is the ability of a body to store electrical charge. Capacitors are the components we use when we want capacitance between two nodes. Within the hydraulic analogy, they behave like tanks with a stretchy, impermeable membrane down the middle.
When a capacitor charges or discharges, it follows the formula:
In English: current flow into a capacitor as a function of time is equal to the size of the capacitor multiplied by rate of change of the voltage across the capacitor with time.
Where were we?
Recall that we’re trying to be able to survive the theoretical worst-case scenario: a 577 microsecond, 2 A pulse, with a voltage drop less than 0.1 V. At first pass, a likely easy solution might be to simply add more capacitance to the power rail. We know I(t) and can calculate dV(t)/dt, so we can solve for the lower bound of acceptable capacitances:
As it happens, a capacitor that size would have a lot in common with a T-Rex: it would be enormous, completely impractical, and ugly…not to mention hard to find and expensive to purchase. There must be a better way.
The best answer turns out to be 4-12 V of external power and a buck converter that turns the supplied voltage into a ~3.5 V rail for the SIM 900, instead of enormous capacitors. Buck converters are a subset of switching converters, which harness the properties of inductors, diodes, transistors, and capacitors to generate a higher or lower voltage.
The buck regulator we threw on is good for 3 A and ~4 - 12 V in. The datasheet is here, if you’re curious.
Alright. It’s time to stop talking about woes of EE land and show you the fruits of our labor! The modules for our Beta backers look like this (without headers or the antenna):
And, of course, proof that this thing works:
That’s me on the Tessel phone: a Tessel + GPRS module hooked up to my laptop sending me texts, receiving my texts, and making/receiving phone calls. It was a good day at the office.
If you want to see (or hear) for yourself, send me an email with your number (US only, please) and a project you’d like to build with Tessel. I have a batch of 16 boards to test this morning; might as well make use of them.