PubNub on Arduino Uno and Seeed Studio Ethernet Shield v2

2 min read Michael Carroll on Dec 30, 2014

Did you purchase an Ethernet Shield v2 from RadioShack or the good folks at Seeed Studio? You’ll need updated libraries to get things working smoothly. In this blog post, we’ll show you how to get your Arduino Uno and Seed Studio Ethernet Shield v2 connected to the Internet, and also how to set up PubNub on it.

You can do some pretty cool things with Arduino and PubNub, and we’ve written a good amount of blogs and tutorials on different DIY projects using Arduino and PubNub, like an Arduino controlled smart home and remote configuration to control your Arduino from anywhere.

So let’s get started!

Your Ethernet Shield gets a total renewal now! This shield provides you instant Internet connectivity with a high spec Ethernet controller, W5200, with twice the buffer size of v1.0 and support for up to eight simultaneous TCP/UDP connections.

An included SD slot enables applications that require storing large amounts of data, like IoT data logging. Thanks to a lowered RJ45 pot, you can flexibly add most of shields on top of this Ethernet Shield.

They have a great wiki page detailing the entire board, the differences between the v2 and v1, and updated libraries.

Download the Libraries

Let’s get your Arduino connected to the Internet.

You’ll need those libraries. Here’s a link to the zip for the Ethernet Shield v2 library.

While you’re downloading stuff, pick up the PubNub Arduino libraries.

Install the Libraries

If you’re on a Mac, the libraries should be installed here:

On Windows, it would be:

Include v2 Library

Now, open up the PubNub Arduino libraries and change one line:

Should be changed to:

This will tell the PubNub library to use the EthernetV2_0 library for the v2 chip rather than the original Arduino Ethernet library.

Not done yet!

Make sure you reference the V2_0 library within your sketch as well.

Use Libraries as Normal

If you’re starting with sample code either from online or the Arduino menus, be sure to always reference the EthernetV2_0.h drivers.

Then you can continue to use the PubNub library as you normally would. The EthernetV2_0.h drivers include the same method names, but utilize all the advantages of the v2 hardware!

This tutorial was written as a result of some hurdles I came across while building the IOT model house. Read the full Arduino IoT house story here.