Skip to content

WiFi TinyShield Tutorial

In this tutorial, you will learn how to connect your project to the internet with this WiFi TinyShield!

Learn more about the TinyDuino Platform


Description

Based on the Atmel ATWINC1500 WiFi module, the WiFi TinyShield supports 802.11 b/g/n, SSL, different security modes (WEP, WPA, WPA2, and unsecured connections), and has a built-in TCP/IP Stack that offloads network processing from your TinyDuino. The easy to use Arduino/Atmel supplied software library shows numerous examples on how to scan for WiFi access points, connect to an access point, run DHCP, ping IP addresses, do DNS lookups, connect as a client to a web server and download web pages, or even act as your own web server and access point.

This TinyShield includes an integrated antenna on the module itself with FCC/CE approval as well as built-in LEDs that indicate connection state and active data transfer. This TinyShield also includes level shifters and a local power supply to ensure proper and safe operation over the entire TinyDuino operating voltage range up to 5V, and uses an SPI interface to allow for fast data transfers.

Note: This module can act as an access point!

To see what other TinyShields are compatible with this TinyShield, see the TinyShield Compatibility Matrix

Technical Details Atmel ATWINC1500 WiFi Specs
  • IEEE 802.11 b/g/n (2.4GHz)
  • Embedded IPv4 TCP/IP stack
  • Up to 72 Mbps PHY throughput
  • TX power: +19.5 dBm at 11 Mbps, CCK
  • RX sensitivity: –88 dBm, 11 Mbps
TinyDuino Power Requirements
  • Voltage: 3.3V - 5.5V
  • Current:
    • Active Mode, highest speed: 311mA TX at +18 dBm, 80.5mA RX
    • Shutdown Mode: <4uA
    • Due to the current requirements, this board cannot be run using the TinyDuino coin cell option
Pins Used

SPI Interface used

  • A3 - RESET: This signal is an input to the WiFi module and is used to reset the module.
  • 8 - SPI_CS: This signal is the SPI chip select for the WiFi module
  • 2 - SPI_IRQ: This signal is the interrupt output from the WiFi module and into the TinyDuino.
  • 11 - SCLK: This signal is the serial SPI clock out of the TinyDuino and into the WiFi module.
  • 12 - MISO: This signal is the serial SPI data out of the WiFi module and into the TinyDuino.
  • 13 - MOSI: This signal is the serial SPI data out of the TinyDuino and into the WiFi module.
Dimensions
  • 20mm x 30mm (.787 inches x 1.181 inches)
  • Max Height (from lower bottom TinyShield Connector to upper top TinyShield Connector): 5.11mm (0.201 inches)
  • Weight: 2.39 gram (0.084 ounces)

Notes

  • This board is compatible with the Arduino WiFi101 library which is available through the Arduino IDE Library manager!
  • However, the pin configuration is different, which requires the following line at the beginning of your setup() function:

    WiFi.setPins(8, 2, A3, -1); // VERY IMPORTANT FOR TINYDUINO


Materials

TinyZero and WiFi TinyShield

Hardware

Software


Hardware Assembly

To create the desired set up, place the processor board of choice as the base, and connect the WiFi TinyShield using the tan 32 pin connectors. In this tutorial, we use the TinyDuino, so we need the USB Tinyshield in addition to the processor board.

An assembled stack of a TinyZero and WiFi TinyShield.

Make sure the TinyDuino is powered on, and use the Micro USB cable to connect the stack to your computer.


Software Setup

We can then open up the Arduino IDE and make sure the necessary libraries for this project are downloaded. We will need:

  • Arduino WiFi101 library (This can be installed through GitHub, or the Arduino Library Manager: Sketch ->  Include Library -> Manage Libraries... -> Search for WiFi101 and install)

Now we can select the hardware that we want to program!

Using the Tools tab, we will make the following selections (these selections are specific to the TinyDuino, if you are using a different processor board you should consult the respective setup page in order to make the correct selections):

  • Board: "TinyZero"
  • Processor: "Default"
  • Port: "COM##"  (If you’re having trouble establishing which port this is for you, check out this help page.

The Code!

Now that our programming environment and hardware are ready to go, we just need to write a program for the WiFi connection.

You’ll need:

  • The name of your WiFi (ssid)
  • The password to your WiFi

Here’s the code and the zip file for an easy download:

Code
/*
  TinyDuino WiFi Tutorial

  Just a basic tutorial showing you how to connect to WiFi with the Wifi
  TinyShield

  NOTE: There are a couple things you'll need to change for this to work!

  Written 29 May 2018
  By Laverena Wienclaw
  Modified 07 January 2019
  By Hunter Hykes

  https://TinyCircuits.com
*/

// This library is for the wifi connection
#include <WiFi101.h>

/*********************** EDIT THIS SECTION TO MATCH YOUR INFO *************************/
char ssid[] = "TinyCircuits";  //  your network SSID (name)
char wifiPassword[] = "********";  // your network password

// Define Serial object based on which TinyCircuits processor board is used.
#if defined(ARDUINO_ARCH_SAMD)
  #define SerialMonitorInterface SerialUSB
#else
  #define SerialMonitorInterface Serial
#endif

void setup() {
  SerialMonitorInterface.begin(9600);
  WiFi.setPins(8, 2, A3, -1); // VERY IMPORTANT FOR TINYDUINO
  while(!SerialMonitorInterface);

  // Attempt to connect to Wifi network:
  SerialMonitorInterface.print("Connecting Wifi: ");
  SerialMonitorInterface.println(ssid);

  // Connect to WiFi, and loop until connection is secured
  WiFi.begin(ssid, wifiPassword);
  while (WiFi.status() != WL_CONNECTED){
    SerialMonitorInterface.print(".");
    delay(500);
  }

  // Print out the local IP address
  SerialMonitorInterface.println("");
  SerialMonitorInterface.println("WiFi connected");
  SerialMonitorInterface.println("IP address: ");
  IPAddress ip = WiFi.localIP();
  SerialMonitorInterface.println(ip);
}

void loop()
{
  SerialMonitorInterface.print("Main loop entered. Now that we're connected, let's do something cool.");
  delay(60000); // Wait a minute before going back through main loop
}

Software Notes

  • You must edit the ssid and wifiPassword variable in the code to match with your WiFi!

  • To show you are connected successfully, the WiFi shield will produce a solid green light. If you do not get this light, check your Serial Monitor (there’s a button to open it in the top right of the Arduino IDE) to aid in debugging. Double check your ssid and password!

  • This WiFi board is compatible with the Arduino WiFi101 library which is available through the Arduino IDE Library manager! However, the pin configuration is different, which requires the following line at the beginning of your setup() function:

    WiFi.setPins(8, 2, A3, -1); // VERY IMPORTANT FOR TINYDUINO

That's all, folks!


Downloads


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!