Welcome to the new Arduino 101 / Genuino 101.  Same board just different name outside of the USA.  Think “Uno” with built-in sensors and bluetooth, pretty cool.

Programming ballet costumes with arduino

Programming ballet costumes with arduino


The dancers are coding the board and neopixel ring to the colours they want for the performance at the BETT Show 2016.

The Genuino 101 is great addition the arduino family. Having the Intel Curie Module makes coding with sensors that little be easier.

This tutorial will show you how to build and code the Neopixel ring using the Genuino.




Genuino 101
Neopixel 24 LED ring (adafruit)
9v battery
Barrel Battery Clip
Soldering Iron
Lead Free Solder

If you are new to Arduino then download the software here
This tutorial will cover the following theories and concepts

Genuino 101 powered ballet costume from readysaltedcode
Genuino 101 powered ballet costume from readysaltedcode (BETT SHOW 2016, London)

STEP 1 Plugin & add libraries

Plugin your Genuino board into your computer. If you need to install or update any libraries then the software will prompt you.

To update libraries via the menu: Tools > Board: “name of last board used” > Board Manager

Locating the board using Tools > Board

Locating the board using Tools > Board Menu


Now you should see the additional boards. In the software is it called ARDUINO 101 (not Genuino)

STEP 2 Circuits and LEDs

Neopixel Ring

Neopixel Ring

Most Neopixel rings come without the cables/ wires attached to them.  You will three sections of cable to connect the GROUND, POWER and DATA.

Black for GND

Red for 5v (power)

Green for data.  (we used green because of the colour of the costumes)

Colour of cables: The cabling set of standards “ANSI TIA 606a” does not specify the colour of the cables. The convention is black for ground and red for power and the other colours as you see fit.



Wiring circuit for Genuino LED ring

Wiring circuit for Genuino LED ring


This circuit allows you power the device on the go.  It will also work if connected to the computer without the battery.

See here for soldering the connectors to the Neopixel ring.



How to set up your circuit 

[insert video of set up process – showing the 2 variants of neopixel ring]

Example colour coding.  

Cable colours for prototyping

STEP 3 Lets Get Coding

The code is available here, just copy and then paste. It is also on github .
The code uses two libraries. One to talk to the curie module on the Genuino board and the other to talk to the Neopixels. Our code is a little different from the built in examples.

Our code uses the step notification interrupt to animate and LED ring. Does not use the step counter as, by design, the step counter does not immediately update on every step detected. Please refer to Section 2.7 of the BMI160 IMU SensorData Sheet for more information on this feature.  The Step counter example takes a sample number of steps and does not activate on every step.  This is useful in many other applications but for our code we need it to activate every time the dancers move.

#include "CurieImu.h"

The next part of the code defines what pins we are using and how many neopixels are in our ring (Strip)

#define PIN 5 // pin to led ring from main board.
#define NUMLEDS 24 // Number of LEDs in the ring

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMLEDS, PIN, NEO_GRB + NEO_KHZ800);

The next part of the code THE SETUP is where you initialise the board and any variables.

strip.setBrightness(40); //adjust brightness of the LEDs. This also reduces the power consumption.
strip.show(); // Initialize all pixels to 'off'


// intialize the sensor:

// turn on step detection mode:
CurieImu.setStepDetectionMode(BMI160_STEP_MODE_NORMAL); //normal refers to the sensitivity setting.

CurieImu.setIntStepEnabled(true); // turn on step detection
CurieImu.setIntEnabled(true); // enable interrupts

The main part of the code is after this. We are using an event handler. This listens for an event, in our case the step counter to increment, if an event is detected then the code is executed. Our code runs a certain light pattern in a certain colour for 3 cycles.  We have set the Step Detection to normal but there two other settings. BMI160_DLPF_MODE_OSR2 and BMI160_DLPF_MODE_OSR4 OSR2 halves the bandwidth of the normal settings and OSR4 reduced the bandwidth by a factor of 4. Would have been nice to human readable words but hey ho.

int numSteps = 0; // Step counter
uint32_t myFavoriteColor = strip.Color(255, 0, 0); //this sets the LEDs to Blue with a bit of red.

static void eventCallback(void) {
numSteps++; // Count the steps
Serial.println(" step(s) detected");

theatreChase is a function we are reusing from another ballet project [arra]stre.  The code is based on Adafruit’s neopixel strip code.

theaterChase(myFavoriteColor, 30, 3); // Colour them in one by one

//Theatre-style crawling lights.
void theaterChase(uint32_t color, uint8_t wait, uint8_t cycles) {
for (int j=0; j<cycles; j++) { //do cycles of chasing
for (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, color); //turn every third pixel on

        for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off