Make Robot Friends with an Adafruit CRICKIT & a Particle Xenon

Originally published at:

Since Particle started shipping new Particle Mesh hardware, I’ve been spending a lot of time exploring the new devices, Mesh networking, and the new world of add-ons that our Feather-compatible form-factor unlocks. In this post, I’ll share how you can use Particle Mesh devices with the Adafruit CRICKIT robotics platform.

I’ve written in the past about how the new Feather footprint on Particle Mesh devices opens up a world of plug-and-play capabilities with the rest of the Adafruit Feather ecosystem. With over 50 FeatherWings to choose from, there are a ton of options for your next project.

One FeatherWing that I’ve been playing with lately is the Adafruit CRICKIT FeatherWing. It’s a powerful, octagonal board that you can use to, as Adafruit likes to say, #MakeRobotFriend.

What is Adafruit CRICKIT?

CRICKIT stands for Creative Robotics & Interactive Construction Kit. It’s a low-cost, powerful robotics platform inspired by the original Cricket robotics platform from MIT, but with an Adafruit twist.

The CRICKIT Platform is available in four flavors:

  • CRICKIT for Circuit Playground Express
  • CRICKIT for Feather
  • CRICKIT for micro:bit
  • CRICKIT HAT for Raspberry Pi
Each variation contains a powerful ATSAMD21 co-processor that allows you to build a pretty full-featured robot (and it doesn’t have to be one on wheels, either!) using one or more of the onboard connections, including:
  • 4 x Analog or Digital Servo control, with precision 16-bit timers
  • 2 x Bi-directional brushed DC motor control
  • 4 x High current "Darlington" 500mA drive outputs with kick-back diode protection
  • 4 x Capacitive touch sensors with alligator-pads
  • 8 x Signal pins, digital in/out or analog inputs
  • 1 x NeoPixel driver with a 5V level shifter
  • 1 x Class D, 4-8 ohm speaker, 3W-max audio amplifier
For my first set of experiments, I decided to play with a DC Motor, Servo, Neopixels, and the Capacitive Touch sensors. Read on to learn how you can use CRICKIT with Particle’s new Mesh hardware.

Using the Particle Xenon with the Adafruit CRICKIT

Since all three new Particle Mesh devices--the Argon, Boron, and Xenon--are Adafruit Feather-compatible, you can use any device with the CRICKIT platform. The device just pops right in, and since our devices are pin-compatible, it will work as any other Feather microcontroller would. On the firmware side, nearly every popular Adafruit device with a library is supported on the Particle platform, so you should have no trouble jumping in with FeatherWing displays, sensors, and more. [caption id="" align="aligncenter" width="506"]Particle Xenon in a CRICKIT FeatherWing![/caption]

For this post, I used the Xenon, which does come with one caveat. If you want to control your robot with the Particle mobile app or console, or OTA flash your Xenon, you’ll need to have your Xenon connected to an Argon, Boron or Ethernet FeatherWing-powered Particle Mesh network.

Installing the seesaw library

The CRICKIT platform is powered by seesaw, I2C bridge firmware that allows you to use just two data pins from you main microcontroller to control a lot of inputs and outputs on the CRICKIT board. The onboard ATSAMD21 co-processor handles the nitty gritty via simple, intuitive seesaw library commands.

The seesaw library is open source, so I was able to fork and port the library to add Particle Mesh support with very little effort. You can add it to your own Particle projects from the Web IDE, CLI or Particle Workbench by searching for “Adafruit_Seesaw.” Then, you can add the CRICKIT header include and object declaration to the top of your project.

#include "Adafruit_Crickit.h"

Adafruit_Crickit crickit;


Working with DC Motors

The CRICKIT platform supports two DC motors. I connected mine to the side labeled #1 and used the screw terminals to secure the wires in place.

Each major component on the seesaw requires a separate include. So to start using a motor, I first added an include for the seesaw_motor header file:

#include "seesaw_motor.h"

Then, just after my crickit object declaration earlier, I created a new instance of a seesaw_Motor object and passed it a reference to my crickit object:

seesaw_Motor motor(&crickit);

Next, I needed to do a bit of initialization to the CRICKIT board any my motor, so I added the following to the setup function in my app:


Because this is a Particle-powered CRICKIT demo, I can also include some Particle goodness, namely Device Cloud functions. I added two functions to start and stop my motor in the setup function:

Particle.function("startMotor", startMotor);
Particle.function("stopMotor", stopMotor);

And implemented those functions elsewhere in my app:

int startMotor(String args)

  return 1;

int stopMotor(String args)

  return 1;

motor.throttle is a Seesaw function that takes a number between -1 and 1 to turn the motor forwards or backwards at increasing speed. Passing in a value of 0 turns the motor off.

I wrote my code in the Particle Web IDE, so all I need to do in order to run this demo is select my device, OTA flash it, head over to the Console or open the Particle mobile app and toggle the startServo cloud function.

Look at that motor go!

Working with Servos

Now let’s add a servo. CRICKIT supports up to four digital or analog servos. For this demo, I used the TowerPro SG-5010, and connected the three-pin female connector to the Servo port marked “1,” and with the yellow wire closest to that marking.

Once connected, I added the seesaw header file for servo control.

#include "seesaw_servo.h"

Then, right after my motor initialization statement, I added another for the servo.

seesaw_Servo servo(&crickit);

And, in setup, added a statement to initialize the servo and move it to its start position:


Finally, I added a Particle Cloud Function that I can use to make the servo move at my slightest whim. In setup:

Particle.function("moveServo", moveServo);

And the moveServo function:

int moveServo(String args)

  return 1;

With the code done, I can OTA flash the latest firmware and make my CRICKIT and Xenon-powered servo move from the Particle mobile app or console.

And that’s all there is to it!

Working with Neopixels

What’s a robot without blinking lights? Not a robot at all, I say! And Adafruit must agree since the CRICKIT platform includes support for a Neopixel strips of all types!

For this demo, I used a 30 pixel Neopixel strip and connected the ground, data and power wires according to the markings on the CRICKIT screw terminals.

As with the motor and servo examples, I started by adding an include to the Neopixel header.

#include "seesaw_neopixel.h"

Then, in setup, I initialized the strip and added a boolean variable needed to track the state of a rainbow animation. The first parameter to the seesaw_NeoPixel constructor is the number of discrete pixels on the strip you’re using, so be sure to adjust accordingly if you’re following along with this demo.

seesaw_NeoPixel strip = seesaw_NeoPixel(30, 20, NEO_GRB + NEO_KHZ800);

bool showRainbow = false;

Next, I initialized all of the pixels to off by calling the show() method in setup.;

And, as with my other examples, added a Particle Cloud function that allows me to trigger a rainbow animation from the Console or mobile app.

Particle.function("rainbow", rainbowLights);

The rainbowLights function is a simple one that just negates the current value of the showRainbow boolean each time it is called. If the boolean is false, we’ll also turn off all pixels on the strip.

int rainbowLights(String args)
  showRainbow = !showRainbow;

  if (!showRainbow) {
      // Turn all pixels off
      setAllPixels(0, 0, 0); 

  return 1;

In order to trigger the animation, I added a few lines to the loop function to check the state of the showRainbow boolean. If true, the rainbow function is called to kick things off.

void loop() {
  if (showRainbow)

The rainbow function (and Wheel helper) do the heavy lifting here, cycling through all 255 colors on each pixel and creating a nice, smooth rainbow animation effect. The code here is the same that Adafruit ships with their Neopixel libraries, so it should work with any strip or even the Neopixel FeatherWing.

void rainbow(uint8_t wait)
  uint16_t i, j;

  for (j = 0; j < 256; j++)
    for (i = 0; i < strip.numPixels(); i++)
      strip.setPixelColor(i, Wheel((i + j) & 255));

uint32_t Wheel(byte WheelPos)
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85)
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  if (WheelPos < 170)
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); 
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

Now, I can OTA flash the latest firmware and trigger a fancy rainbow animation from the Particle Device Cloud.

Blinky lights are so mesmerizing, aren’t they?

Working with Capacitive Touch

Finally, one of the coolest parts of the CRICKIT platform is the four capacitive touch pins, which you can extend via alligator clips, or use directly on the board.

I wanted to set mine up to set my entire neopixel strip to a single color when I touched one of the pads. First, at the top of my file, I added a few #define statements to represent the number of touch pads and a touch threshold.


Then, I modified my loop to read from the touch pads when my rainbow animation isn’t playing. The for loop will check each touch input using the touchRead method, and if the touch duration exceeds the threshold I set above, it will proceed to the switch statement.

void loop()
  if (showRainbow)
    for (int i = 0; i < CRICKIT_NUM_TOUCH; i++) 
    { // check each touch input 
      uint16_t val = crickit.touchRead(i); // read the touch input 
      if (val > CAPTOUCH_THRESH)
      { // if the value read is > the threshold
        switch (i)
        case 0:
          setAllPixels(255, 0, 0); //RED
        case 1:
          setAllPixels(0, 255, 0); //GREEN
        case 2:
          setAllPixels(0, 0, 255); //BLUE
        case 3:
          setAllPixels(122, 123, 123); //WHITE

Based upon which pad is touched, the function calls a setAllPixels helper to set all of the lights on the strip to a single color, either read, green, blue or white.

void setAllPixels(uint8_t r, uint8_t g, uint8_t b)
  for (int i = 0; i < strip.numPixels(); i++)
    strip.setPixelColor(i, r, g, b);  

And that’s it. I OTA flashed the latest firmware from the Web IDE, and after my device restarted, I can touch any of the four pads to change the color on the Neopixel strip.

What can you do with CRICKIT and Particle Mesh?

In this post, I’ve only scratched the surface of what’s possible with the Adafruit CRICKIT and Particle Xenon! It’s a powerful platform that’s worth exploring, and I recommend checking it out. If you want to start with my demos, the full source code is here, or you can try any of the growing number of CRICKIT projects that the Adafruit folks have posted online.

Have you built something with Particle Mesh and the Adafruit CRICKIT, or any of the other awesome Adafruit FeatherWing devices? If so, I’d love to hear about it in the comments below!

Happy Meshing with Adafruit!


This is great :slight_smile: thanks also, for the seesaw lib conversion. I have just used it to create a mesh enabled mini gamepad. You can see a picture of it here. I am now awaiting impatiently for a crickit to arrive :slight_smile:

1 Like

Great work @dyadica! Have fun with the Crickit and be sure to share what you build with it!

1 Like

Hey @bsatrom great work as always.

Just curious if this library is compatible with the photon as well? I recently bought the following sensor and was planning to interface it with the photon using this library. There already seems to be an example for this sensor in the library. But just wanted to make sure it will work with the photon as well and not just the mesh devices.

1 Like

Hey @muneebr1, good question! It absolutely should work with the Photon, no problem. That said, I’ve not specifically tested it for the Photon, so if you run into any issues, please file an issue in the GitHub repo and I’ll get it fixed!


@bsatrom worked without any issues. Thanks :slight_smile:

1 Like

Great to hear!


Just saw your invitation for the webinar on the 26th. Was hoping if you could include information about AWS as well?



Hi @muneebr1! We won’t be covering anything on AWS for this one, but I can certainly take this into account for future webinar planning!