The CC3000 WiFi module from Texas Instruments is a small silver package which finally brings easy-to-use, affordable WiFi functionality to your Arduino projects.

It uses SPI for communication (not UART!) so you can push data as fast as you want or as slow as you want. It has a proper interrupt system with IRQ pin so you can have asynchronous connections. It supports 802.11b/g, open/WEP/WPA/WPA2 security, TKIP & AES. A built in TCP/IP stack with a "BSD socket" interface supports TCP and UDP in both client and server mode, with up to 4 concurrent socket connections.

The CC3000 does not support "AP" mode, it can connect to an access point but it cannot be an access point.

The CC3000 is available from Adafruit As a Breakout Board, and as an Arduino Shield.

Both the shield and the breakout board have an onboard 3.3V regulator that can handle the 350mA peak current, and a level shifter to allow 3 or 5V logic level. The antenna layout is identical to TI's suggested layout and we're using the same components, trace arrangement, and antenna so the board maintains its FCC emitter compliance (you'll still need to perform FCC validation for a finished product, but the WiFi part is taken care of). Even though it's got an onboard antenna we were pretty surprised at the range, as good as a smartphone's.

The shield also features a MicroSD socket, and a reset button.

AND, the shield supports the Arduino SPI passthrough header pins, so it's compatible with the Mega, Leonardo, and Due, right out of the box - no rewiring necessary!  Just solder closed the MISO, SCK, and MOSI jumpers on the back of the shield.

Assembly and Wiring

Check out the next couple of pages for detailed instructions for setting up your CC3000 shield or breakout board!

Connections

Pinouts


The CC3000 is (electrically) fairly simple to use. The module requires an SPI connection, including a clock (CLK), data in from a microcontroller (MOSI) and data out to the microcontroller (MISO). It also uses a chip-select line (CS) for SPI to indicate when a data transfer as started

Along with the SPI interface, there is a power-enable type pin called VBAT_EN which we use to start the module properly and also an IRQ pin, which is the interrupt from the CC3000. The IRQ pin is required to communicate and must be tied to an interrupt-in pin on the Arduino. On the Mega/UNO, we suggest #2 or #3

On the CC3000 shield, we use the following pin connections
  • SCK - #13
  • MISO #12
  • MOSI #11
  • CS for CC3000 #10
  • VBAT_EN #5
  • CS for SD Card #4
  • IRQ #3
On the breakout, be aware that the MISO (data out from module) pin does not go 'high impedance' when CS is driven high. Check the shield for how we use a 74AHC125 to manually tri-state this pin when it's shared with an SD card.

Optional Antenna

If you have a shield or breakout with a uFL connector (instead of an on-board ceramic antenna) you can use a uFL to RP-SMA or uFL to SMA (less common) adapter and then connect to any 2.4 GHz antenna. This is handy when you want to place the module in a box but have the antenna on the outside, or when you need a signal boost

Please note that when using an external antenna, the module is no longer FCC-compliant, so if you want to sell the product with FCC certification, it must be retested.

Using the CC3000

Make sure your Arduino is powered by a 1 amp or higher rated external power supply when using with the CC3000! Powering an Arduino + CC3000 from a computer/laptop USB port will lead to unstable behavior and lockups because the USB port can't supply enough power!
Use the Arduino 1.6.4 version or newer with the CC3000, EXCEPT for the firmware update sketches in the library examples folder. Use 1.0.6 for those!

Download the Library

We will start by downloading the Adafruit CC3000 Library, available from the Arduino library manager.

Open up the Arduino library manager:

Search for the Adafruit CC3000 library and install it

If you're not familiar with installing Arduino libraries, please visit our tutorial: All About Arduino Libraries!

Sample Sketches

The Adafruit CC3000 Library contains several example sketches, demonstrating different capabilities of the CC3000 along with some useful programming techniques.

To run the sample sketches, you'll have to edit them to include the SSID and password of your access point.
Download: file
#define WLAN_SSID       "myNetwork"        // cannot be longer than 32 characters!
#define WLAN_PASS       "myPassword"
Also, make sure that the right wireless security scheme is selected (unsecured, WEP, WPA, or WPA2)
Download: file
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2

WEP with HEX Passphrases

If you are using WEP security, and your passphrase is a series of HEX digits, you can't simply enter it as a literal string. Instead you have to define is as an actual binary sequence.
For example, if your passphrase is 8899aabbccdd, you would define it as follows:
Download: file
//  #define WLAN_PASS       "8899aabbccdd"  //don't do it this way!
//do it this way:
const char WLAN_PASS[] = {0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0x00};
Remember to append 0x00 to the declaration, after the passphrase, as shown in the example!
Be aware the library does not currently support WEP passphrases with 0x00 null characters! See this bug for more details: https://github.com/adafruit/Adafruit_CC3000_Library/issues/97

Downloads

Schematic for the CC3000 breakout board v1.0 (no buffer on the MISO pin)
Schematic for v1.1 with a buffer on MISO
Schematic for the CC3000 shield

Dimensional diagram for the CC3000 breakout

The dimentions are the same for v1 and v1.1

Inches:

mm:

I'm using WEP - how do I configure my HEX passphrase?

If your passphrase is a series of HEX digits, you can't simply enter it as a literal string. Instead you have to define is as an actual binary sequence.
For example, if your passphrase is 8899aabbccdd, you would define it as follows (note the 0x00 at the end!  It's important!):

Download: file
//  #define WLAN_PASS       "8899aabbccdd"  //don't do it this way!
//do it this way:
const char WLAN_PASS = {0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0x00};

I'm using WEP and I tried that but it still doesn't work

Make sure you have WLAN_SECURITY defined as WEP:

Download: file
#define WLAN_SECURITY   WLAN_SEC_WEP

What is the gain of the ceramic antenna? How does it compare to the external antennas?

We use the Johannson 2500AT44M0400 which has 0.5 dBi gain. Compare this to the external antennas with 2 dBi and 5dBi. Since antenna 'range' is not linear with the gain and antenna range has a lot to do with what else is transmitting or receiving, physical barriers, noise, etc. We can roughly say that the ceramic antenna has half the range of the 2dBi antenna, and the 5dBi antenna has double the range of the 2dBi antenna (roughly!)
There is no way to know the actual range you will get unless you experiment with your setup since there is so many variables, but the ceramic antenna gets about the same range we expect with an every day cellphone

How can I use the CC3000 with a static IP?

WiFi device IPs are dynamic 99% of the time, but it is possible to assign a static IP if your router permits it. Check out this forum post for how to go about it

I'm having difficulty seeing/connecting to my network...

If you have an '802.11n only' router please configure it to add 'b or g' support. The CC3000 is 802.11b or g only, it does not do 'n'!

I'm not in the USA and my CC3000 can't see my router

The CC3000 only operates on channels 1 through 11. Outside of the United States, you may be able to configure your router to a channel number outside of that range. Make sure your router is configured for a channel in the range 1 through 11.

My CC3000 sketch locks up when initializing the CC3000...

A lockup during initialization is a very common issue when there isn't enough power to supply both the Arduino and CC3000 board.  Make sure you're powering the Arduino from a 1 amp or higher rated external power supply.  Don't try to power the Arduino from a computer/laptop USB port because those ports typically can't provide enough power and will cause lockups!

If you're using an Arduino UNO you can plug in a 7-12 volt power supply to the barrel jack on the board.  A supply like this 9V 1amp wall wart is perfect for the Arduino UNO and CC3000.

Also if your Arduino supports changing the voltage of the digital I/O pins (like some 3rd party Arduino clones), make sure the voltage is set to 5 volts and not 3.3 volts.

My CC3000 sketch locks up after running for a while or under heavy load...

Unfortunately there is a well known internal issue with the CC3000 which can cause lock ups and instability over time or under heavy load.  This thread on the Spark Core forums dives deeply into the issue and investigation with Texas Instruments.  Ultimately the latest firmware version 1.13 was released with a potential fix for the stability problems.  If you'd like to upgrade to firmware version 1.13 see the page on firmware upgrades in this guide.

How do I set a static IP address?

By default the CC3000 is configured to get an IP address automatically from your router using DHCP.  In most cases this works well, however if you run into trouble getting an IP address or DNS server you should consider setting a static IP address and DNS server.

To set a static IP address make sure you have the latest version of the CC3000 library and load the buildtest example.  Scroll down to the commented section of code in the setup function which discusses setting a static IP address:

/*
uint32_t ipAddress = cc3000.IP2U32(192, 168, 1, 19);
uint32_t netMask = cc3000.IP2U32(255, 255, 255, 0);
uint32_t defaultGateway = cc3000.IP2U32(192, 168, 1, 1);
uint32_t dns = cc3000.IP2U32(8, 8, 4, 4);
if (!cc3000.setStaticIPAddress(ipAddress, netMask, defaultGateway, dns)) {
Serial.println(F("Failed to set static IP!"));
while(1);
}
*/

Remove the /* and */ comment delineators and fill in the IP address, net mask, default gateway, and DNS server values for your network. You might need to check your router's configuration page to find these details.

Run the buildtest sketch and the CC3000 should be configured to use the static IP address and configuration you assigned. You can actually remove or comment out the IP assignment code because the CC3000 will remember the configuration in its internal non-volatile storage.

If you'd ever like to enable DHCP again, load buildtest and uncomment the section below the static IP address configuration:

/*
if (!cc3000.setDHCP()) {
Serial.println(F("Failed to set DHCP!"));
while(1);
}
*/

How do I connect to a college/hotel/airport WiFi network that requires using a web page to authenticate?

Unfortunately these networks are difficult or sometimes impossible for the CC3000 to connect to because they require using a web browser to authenticate with the network.  However a couple options to pursue are:

  • Try contacting the network support team / administrator and see if they can allow the CC3000 onto the network based on its MAC address. When you run the buildtest sketch it will print out the CC3000 MAC address so you can copy it from there. This option is the easiest and most reliable way to get onto the network, but might not be available depending on the network's policies.
  • The second option is to clone the MAC address of a laptop or device you've gotten on the network already. For this you'll want to find the MAC address of the laptop/computer (usually in network settings, search online to get a direct answer depending on the OS you're using). Then uncomment and adjust the commented code in the setup function of the buildtest example which sets the MAC address of the CC3000. Fill in your laptop/computer's MAC address and run the sketch to have the CC3000 start using the provided MAC addres.  Unfortunately at this point you have to turn off the cloned laptop/computer or at least disconnect it from the network because two devices with the same MAC can't be on the network at the same time (they'll get confused and start seeing each other's traffic).

I'm using the IPAddress class or an example from the Ethernet library and it doesn't work, what's wrong?

The IPAddress class is not compatible with the IP addresses the CC3000 classes expect.  However you can switch to using the CC3000.IP2U32 function to generate an IP address.  See this line in the buildtest example for how to use this function, and what type to use to store the IP address (an unsigned 32-bit integer).  Unfortunately the Arduino compiler will try to convert an IPAddress into this type so ethernet library code might compile, but when the code actually runs it will fail because the data is not in the right order.  Stick to using the IP2U32 function!

This guide was first published on Sep 16, 2013. It was last updated on Sep 16, 2013.