You are viewing an older revision! See the latest version

Vodafone K3770

This library is in BETA!

Please note that this is a beta version of this library, which is still undergoing final testing before its official release. If you would like to get updates about this library, and get notified of the final release sign up here

This forum thread has been created to capture bugs, suggestions and features relating to this beta trial.

Please use this as the first point of call for support/discussion around this project, and the place to post questions in the first instance.


The Vodafone K3770 Dongle allows you to connect your mbed to the internet from (almost) any location in the world.

The K3770 dongle can be purchased directly from Vodafone, or is available in most Tesco Stores that have an "In-store Phone Shop".

K3770

Hardware

You can use a female USB A connector to interface the dongle. Wire up the dongle's power and ground lines to a good +5V source and to the mbed's ground, respectively. Connect the mbed's D+/D- pins to the USB plug.

Here is how to connect the dongle to the mbed's USB host interface.

/media/uploads/donatien/_scaled_dongle_schem.jpg

Power

The dongle should have a reliable +5V power source. While establishing connection, and low coverage areas, the dongle can draw as much as a few hundred mAs. To avoid any problems with supply, it's recommended to use an external power supply as opposed to a single USB port shared with the mbed. Additionally putting a couple capacitors between the dongle's power line and the ground (0.1µF, 100µF, 10µF) can help smooth the spikes and compensate for current surges.

Data

To use the mbed in USB host mode you need to add two 15K pull-down resistors on the D+ and D- lines, as shown in the schematic.

mbed Vodafone K3770

Additional Hardware Used

The below components were also used to build this prototype.

Software

Library

You need to import the VodafoneK3770Lib library, include the relevant header file and instantiate the VodafoneK3770 object.

Import libraryVodafoneK3770LibBeta

No documentation found.

On your first call to any of the library's function, the dongle is initialized.

  • The USB interface is configured and the dongle is detected
  • The dongle is switched to modem mode if needed
  • The dongle registers to the network (can take up to a minute)
  • If needed, the dongle is configured for the network it has reached

Beware!

Currently the implementation of the library does not allow you to use the side-band functions (SMS, USSD & AT parser) while you are connected to the internet. If you want to use these functions and you are currently connected, make sure to disconnect first.

Examples

Mobile Internet

You can connect to the internet by establishing a PPP connection. You can then use BSD Sockets or any high-level component (HTTP Client, NTP Client).

To connect, one single function is used:

int ret = threeg.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 TypeContract TypePlanAPN
Mobile BroadbandPay as you go£5 for 250MB, lasting up to 30 dayssmart
Mobile BroadbandPay as you go£15 for 2GB, lasting up to 30 daysppbundle.internet
Mobile BroadbandPay as you go£15 for 1GB, lasting up to 90 dayspp.internet
Mobile BroadbandPay monthlyAnyinternet
PhonePay as you goAnypp.vodafone.co.uk
PhonePay monthlyAnyinternet

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 this command can take up to a few minutes to complete in worst case scenarios - it actually initializes the dongle and waits for network registration, which can take quite a long time.

Once connected, you can use any high-level component:

You can also use the BSD Sockets API directly.

Here is a full example program for fetching a web page using HTTP.

Sending and receiving SMS

The library offers simple functions to send and receive text messages. Please note that you cannot use these functions while connected to the internet.

Network Time Protocol

Use the dongle to set-up your mbed's Real Time Clock:

Websockets

WebSockets are also supported:

Balance Check

This example uses USSD (Unstructured Supplementary Service Data), and will return your remaining balance (if you are using Pay as you Go).

NOTE

When using serial debug to console, this library defaults the baud rate to 115200 - so use this rate to configure your PC terminal application.


All wikipages