Teensy 3.1 and CC3000 Wifi breakout

CC3000 image

Texas Instruments, Beagle's heart factory, has launched a cheap module that provides wifi connectivity to your garage project. This post is about how communicate a tiny mini Teensy with a CC3000 breakout from Adafruit.


wiring photo

Pins mapping

Teensy pin CC3000 pin Color
Vin Vin Red
13 CLK Blue
12 MISO Orange
11 MOSI Yellow
10 CS Green
4 VBEN Ochre
3 IRQ Purple

Teensy stuff

I will conveniently assume that you already have Teensyduino (Arduino 1.0.5 + Teensy add-on), if not, please take a look to this page.


Click here and download the lastest Adafruit's CC3000 Library for Arduino IDE. Unzip the file and rename the just created directory to "Adafruit_CC3000". Go to Arduino IDE and import the library.

Import library
(My Arduino IDE is almost in spanish :P)


You can supply power via USB (my choice for debugging) or Vin.


For testing purposes I wrote a program that sends a heartbeat every 2 seconds. Check this code out.

#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include <stdlib.h>
#include "utility/debug.h"

#define ADAFRUIT_CC3000_IRQ   3
#define ADAFRUIT_CC3000_VBAT  4
#define ADAFRUIT_CC3000_CS    10

Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
#define WLAN_SSID       "YOUR_AP_NAME"
#define WLAN_PASS       "YOU_AP_PASS"


// Server configuration example, YOU MUST EDIT THIS
const uint8_t   SERVER_IP[4]   = { 192, 168, 0, xx };
const uint16_t  SERVER_PORT    = 3000;


static Adafruit_CC3000_Client client;
static uint32_t last_heartbeat_time;
static uint8_t connect_retry_count = 0;

void connect_to_server(void) 
  if(connect_retry_count > 0) {
    Serial.println(F("CC3000> Waiting 2 seconds before retrying to connect..."));
  Serial.println(F("CC3000> Connecting to server..."));
  client = cc3000.connectTCP(cc3000.IP2U32(SERVER_IP[0], SERVER_IP[1], SERVER_IP[2], SERVER_IP[3]), 
  if (!client.connected()) {
    Serial.println(F("CC3000> Can't connect to server"));
  connect_retry_count = 0;
  Serial.println(F("CC3000> Connected!"));
  last_heartbeat_time = millis();

// Set up the HW and the CC3000 module (called automatically on startup)
void setup(void)
  delay(1000); // Without this delay Serial Monitor does not work
  /* Initialise the module */
  Serial.println(F("\nCC3000> Initializing..."));
  if (!cc3000.begin())
    Serial.println(F("CC3000> Couldn't begin()! Check your wiring?"));
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    Serial.println(F("CC3000> Failed!"));
  Serial.println(F("CC3000> Connected to AP"));
  /* Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP())
    delay(100); // ToDo: Insert a DHCP timeout!

  /* Display the IP address DNS, Gateway, etc. */  
  while (! displayConnectionDetails()) {

void loop(void)
  if(!client.connected()) {
  } else {
    if(millis() - last_heartbeat_time >= HEARTBEAT_INTERVAL) {
      client.fastrprintln("Hi, I'm a Teensy");
      last_heartbeat_time = millis();

// Tries to read the IP address and other connection details
bool displayConnectionDetails(void)
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    return true;

INO download


I'm using these devices to build a swarm robot for a robotic contest in Chile. You can see a proof-of-concept in this video: