Blog

Ship IoT with Atmel SAMD21 Xplained Pro, WINC1500 WiFi, and I/O1 Sensors

September 11, 2015 / atmel, xplained, samd21, winc1500, i/o1, bipio, shipiot, IoT, wotio, tutorial, demo / Posted By: wotio team

Getting Started

If you're an Atmel fan like I am, you're probably excited about their Atmel Xplained prototyping and evaluation platform for Atmel AVR and ARM microcontrollers. These platforms and extension boards, like the WINC1500 WiFi module that we use in this demo, make it fast and simple to get a hardware prototype up and running.

Along with the hardware, you'll find a broad selection of example code and projects included with the Atmel Software Framework, which is a great help when first learning a new MCU or peripheral chip.

I'm going to walk you through a demo application for the SAM D21 Xplained and WINC1500, which will send temperature and light levels to a dynamic chart visualization using bip.io's powerful workflow tools. This is a potent combination for rapid development and deployment of any Internet of Things device.

(This demo may end up monitoring the hot pepper plants in my garden when it's done!)

Prerequisites

You will need:

In addition to the above objects, you will also need:

Completely optional, but delicious:

  • One hot pepper plant for datalogging

Making a bip.io Data Visualization Workflow

We're going to start out by configuring a workflow on bip.io. This will be a simple one to demonstrate the ease of communication and data visualization, but feel free to experiment and extend your own workflow once it's working.

Connecting Your Boards

The SAM D21 Xplained board has three connectors for extension board modules. To follow along with this demo, connect the WINC1500 Xplained module to the EXT1 header, and the I/O1 Xplained module to the EXT2 header. Leave EXT3 unconnected, and hook the Debug USB connector to your computer.

Your setup should look like the image below:

Developing the SAM D21 Application

You can check out the Atmel Studio project files from github and use them to follow along; the link is at the top of this article.

Building and Loading

With the project open in Atmel Studio, go to the Build menu and select Build Solution, or you can just hit F7.

When complete, you should see zero errors listed in the panel at the bottom. If there are any errors, correct them in your code, save all the files and try the build again.

When you build is complete with zero errors, you can load it to the SAM D21 Xplained board using the tools in Atmel Studio. From the Tools menu, select Device Programming:

The Device Programming dialog will appear. You need to select the Tool type and the Device itself. Tool will most likely be EDBG and Device will be something like ATSAMD21J18A. This could vary based on your details.

Click the Apply button to connect to the board and put it into programming mode. The amber Status LED will blink steadily at ~2Hz when the programming tool is connected. Additional options appear. Select the Memories item from the list on the left. Keeping all the default options, just hit the Program button.

When done, you should see that the flash verified OK, and your program will be loaded and begin running. Close the Device Programming dialog. The amber Status LED should now be on solid, and will blink off briefly when serial console output is printed by the loaded application.

Now we need a serial terminal!

Serial Terminal Setup

You'll need a serial terminal program to talk to your board. As Microsoft no longer includes the venerable HyperTerminal with Windows, you'll need to get a terminal app. You can still get HyperTerminal from Hilgraeve, or you can use the open-source Tera Term which we use for this demo.

You will first need to know which COM port number Windows assigned to your board. Open the Device Manager (right-click on Start menu in Windows 8) and look under Ports (COM & LPT) for your board (there may be others in there, too). Note the COM number, COM5 in this instance:

Open Tera Term, and select Serial Port. We will do the detailed configuration of baud rate, etc., in a moment:

Go to the Setup menu and choose Serial Port..., then make sure you have a baud rate of 115200, 8 data bits, no parity, and 1 stop bit. Standard stuff, here.

Hit OK to close the settings dialog, and then press the reset button on the SAM D21 board, right next to the debug USB connector. This will restart the board and you should see the debug console output in the terminal. It should look something like this:

You now have data points being sent once per second to your bip.io workflow! Simply pull up the Bip you created, double-click on the Data Visualization, then the Chart tab, and open the chart URL to see sensor telemetry in near-real-time.

A Note About Firmware & Drivers

The WINC1500 module has firmware loaded, and that firmware version needs to match what's expected by the Atmel Software Framework version you are building against. You may see a message something like this on the debug console:

...
(APP)(INFO)Chip ID 1502b1
(APP)(INFO)Firmware ver   : 18.0.0
(APP)(INFO)Min driver ver : 18.0.0
(APP)(INFO)Curr driver ver: 18.3.0
(APP)(ERR)[nm_drv_init][236]Firmware version mismatch!
main: m2m_wifi_init call error!(-13)
....

If you get a message like the one below, you'll need to update the firmware. You can find complete instructions in the Getting Started Guide for WINC1500 PDF on Atmel's website.

Briefly said, you need to load the WINC1500 Firmware Update Project example inside Atmel Studio, build it, and then run a batch file to load the compiled firmware to the WINC1500 board via the SAM D21 board. It is very simple to do, although I did run into a problem with an unquoted variable in one of the batch files, and a space in the pathname.

Once the firmware is updated, and matches the ASF version you are using to build the demo project, it should all work just fine.

Conclusions

After seeing this demo, I'm sure you agree that Atmel's Xplained boards combine with bip.io to make a potent combination for rapid prototyping and product development. With this demo as guidance, you can quickly start using the powerful data services bip.io ties together, and get your ideas flowing! With time-to-market such a critical factor these days, these tools will certainly help fuel the IoT revolution, and your future products.

Get started now! Here are those links again:

As for this demo, it may just end up monitoring my hot pepper plants...