Introducing Particle.io’s Generation3 Internet of Things devices

The Internet is a wonderful thing. Check the weather, cat videos, message a friend, cat videos. There is this whole Internet of Things (IoT) which is the notion of connecting cat videos to the physical world. The information on the internet can affect (oh gawd, affect or effect) and also be updated by the physical world.

There are a range of projects that can be solved by this.

  • The weather is changing and you left your laundry out.
  • Where did you leave your bike
  • Worried about your cat while you are at work (and it’s not bring your cat to work day)

Endless!

Being an electronics engineer this is something I’ve done for a while though thanks to Particle.io this has become accessible to programmers and makers with minimal emphasis on knowing electronics and hitting your head against brick walls.

What I want to share here is how to get your ideas into internet connected reality.

The Good, The Bad, and The Ugly.

That probably isn’t a good analogy.

Particle.io recently released their Generation 3 hardware which are a bag of goodies to connect your projects to the internet in various ways.

Meet Xenon, Argon, Boron

Yes, my friends are elements of the Periodic Table. Geeky+

Common to each is that Particle.io gives you easy ways to hook the physical world into internet data sources (weather, maps, tweets, cat videos) and to update the devices remotely (code online, press button, presto) which is referred to as Over The Air (OTA) updates.

They are different because each give you different connectivity options. You select them based on your projects needs.

Xenon – Mesh

Argon – Mesh + WiFi

Boron – Mesh + Cellular

WiFi and Cellular are familiar as your phone does this. Mesh however is the new kid on the block.

Mesh allows for local communication between devices but also for it to ‘hop’ between devices extending their range.

Here is Zach, Particle.io CEO in a flattering pose.

Each person is representing a node, having a conversation with the person next to them. From there information is passed on, you get the picture, mesh for the local win.

Now that we have an idea of each device super power, we will not start making things with them! To Be Continued.

LED Matrix – Getting Started with the Feather Wing

LEDs are AWESOME. What’s even better is a MATRIX of them. A matrix allows you to display pictures, text, and animate them. It can display what the weather will be for that day, your agenda for the day or entertaining emojis.

This post will explore getting started with the Matrix panel. You can run them from an Arduino Uno (slower re-fresh), Adafruit M0 (good for animations), Raspberry Pi (multiple matrix panels + internet connection).

We will explore the M0 feather route in this tutorial:

Things you will need:

  1. Matrix of LEDs
  2. Adafruit M0 feather
  3. Adafruit Matrix Backpack
  4. 5V power supply capable of 2 or more amps
  5. Computer with Arduino installed

Preparing Arduino:

Ensure Adafruit libraries are available

Arduino > Tools > Manage Libraries

Search for and install the Adafruit libraries by looking up: “gfx” and “RGB Matrix Panel”

Load an Example

Arduino > File > Examples > RGB matrix Panel > colorwheel_32x32 or which ever dimension your display is.

Adjust for your connections

Because each panel is wired differently we need to adjust for that. We are using the M0 Feather with the Matrix Wing we we need to adjust the following:

Add below code

// FeatherWing pinouts for M0 and M4
#define CLK  13
#define OE   1  // TX
#define LAT  0  // RX
#define A   A5
#define B   A4
#define C   A3
#define D   A2
// the RGB data pins on featherwing, must be on same PORT as CLK
uint8_t rgbpins[] = { 6,5,9,11,10,12 };
 
// Create a 32-pixel tall matrix with the defined pins
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 32, rgbpins);

Ensure you have the M0 board installed

Install both Arduino SAMD and Adafruit SAMD

Ensure your board is selected

Connect your board physically and then ensure your port is selected

Tools > Port > Select your USB connected device

Now, upload to your board!

Sketch > Upload

Lets explore what the code is doing:

#include <RGBmatrixPanel.h>

This is including the library that gives us access to all the good stuff. It allows us to create a panel easily later on and enumerates it as an object.

// FeatherWing pinouts for M0 and M4
#define CLK  13
#define OE   1  // TX
#define LAT  0  // RX
#define A   A5
#define B   A4
#define C   A3
#define D   A2
// the RGB data pins on featherwing, must be on same PORT as CLK
uint8_t rgbpins[] = { 6,5,9,11,10,12 };

This is the pinout for our specific model.

// Create a 32-pixel tall matrix with the defined pins
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false, 32, rgbpins);

This enumerates an instance of “RGBmatrixPanel” and calls it “matrix”, we pass in the parameters (pin configuration) of the panel. After this is done we can easily address the panel!

matrix.begin();

This kicks off the matrix, it needs to be run before we access any aspect as seen below

matrix.width();
matrix.height();

We can access parameters of the matrix so that we dont need to hard code anything ie we can dynamically do things. This basically passes back the parameters we setup the matrix with. In this case, 32 for both Width and Height

c = matrix.ColorHSV(hue, sat, val, true);

This creates a value that represents a pixels Hue, Satuation and Value. This still needs to be written to the screen.

matrix.drawPixel(x, y, c);

After we know the value we want, we need to write it to the pixel. The above code does this. For a specific X and Y location, write the pixel value C. In this instance, we are writing one pixel at a time, in a loop. This is why it progressively scans onto the matrix. Explore the other example scripts for more features of the library.