Vodafone K3770 3G Modem
How to use the Vodafone K3770 3G USB Dongle with mbed
Example demonstrating the use of the Vodafone USB Modem library with the HTTP Client
Because of the high current that the USB dongle requires, it is not possible to power it from the Vu pin on the mbed. In the example show, an external linear regulator board has been used to provide a high current regulated 5V supply from a 9V wall adaptor. The parts shown are :
This example application uses the VodafoneUSBModem and the HTTPClient interface, enabling the mbed to fetch a URL over HTTP, and print the contents.
There are various other "hello world" programs that demonstrate SMS, NTP, Socket and Websocket interfaces, as well as management commands (check balance, link status, etc). See "Resources" section below.
You'll notice that this "Hello World" program is a little more complex that others, as we're using the mbed RTOS to manage the memory and processing resources/requirement of the USB Modem driver and the TCP/IP stack.
Resources and references
To establish this connection, one single function is used:
int ret = modem.connect("pp.vodafone.co.uk");
pp.vodafone.co.uk is the APN value for a Vodafone Pay as you Go SIM. Change it to the relevant value if your SIM is different:
|SIM Type||Contract Type||Plan||APN||User||Password|
|Mobile Broadband||Pay as you go||£5 for 250MB, lasting up to 30 days||smart||web||web|
|Mobile Broadband||Pay as you go||£15 for 2GB, lasting up to 30 days||ppbundle.internet||web||web|
|Mobile Broadband||Pay as you go||£15 for 1GB, lasting up to 90 days||pp.internet||web||web|
|Mobile Broadband||Pay monthly||Any||internet||web||web|
|Phone||Pay as you go||Any||pp.vodafone.co.uk||web||web|
For details please check Vodafone's dedicated page.
The variable, "ret", allows you to check whether the connection was successful or not (0 on success, a negative value on error).
Please note that the "connect" command can take a few minutes to complete in worst case scenarios, as it initializes the modem and then waits for network registration.