MAKE: Research


We are building a curriculum to teach teens with T1D about the research process through Maker technology. Through a series of teaching workshops, students will build interactive LED accessories that respond to their T1D data and use this device to experiment on their own research question related to their T1D. Through these workshops, we will teach participants about the research process, including how to form a research question and the ethics involved in human studies. This learning will be supplemented by Maker activities and learning how to incorporate Maker principles into research study design.



Arduino Tutorial


This tutorial will guide users through programming the Adafruit Neopixel Ring to visualize glucose data. We will begin by introducing basic C programming concepts, do a trial run using a sample code, and then begin the CGM data code.

Note: This tutorial uses the Desktop Arduino Editor, a Mini USB syncing cable, and a Neopixel Ring that has already been configured to an Adafruit Trinket M0.

Installation Steps


  1. Download the Arduino IDE from

  2. Install drivers

    1. To connect Arduino to Computer:

    2. Adafruit:

    3. Note: When drivers are properly installed, the correct port will appear under Tools → Port → [port name will vary by computer]

  3. Open up the Arduino IDE → File → Preferences → additional boards manager URLs: paste in and hit okay

  1. Go back to the Arduino IDE → Tools → Board → Boards Manager → Install Adafruit SAMD boards by Adafruit and Restart the IDE


Tools → Board → Select “Adafruit Trinket M0”

  1. It also requires the AdaFruit NeoPixel library, which can be acquired in: Tools→ Manage Libraries → search for “Adafruit Pixel” → Install.

For Mac Users:

Same as Windows except you do not need to install the Adafruit Driver

C Basics

C is the programming language used by Arduino. Here are some basic commands:



#include <libraryname.h>

Tells the program what libraries you will be referring to throughout your code. Libraries are a set of pre-defined functions.

setup( )

A function that runs when the Arduino is powering up. This may include telling the pixels when to turn on, or the brightness level of the pixels

int or uint16_t

Describes an object type as a number (int), or a number with exactly 16 bits (uint16_t)

void loop ( ) { }

The section where you run your functions. The information that you want to be displayed on the Neopixel ring occurs between the curly braces of the loop.

/* comment here */

used for long comments

// comment here

used for in-line comments

void function( ) { }

Where functions are defined, which usually happens at the end of the code. The code occurs between the curly braces of the function.

Steps to write C program:

  1. Create

  2. Verify

  3. Upload

  4. Get Output

Basic structure of an Arduino program:

  1. Structure - usually contains a setup() and a loop()

  2. Values - declaring string types, variables, and constants

  3. Functions - defining functions that tell the program what to do

Things to remember:

  • Code is case sensitive

  • Each statement ends with ;

Before we get started: 

  • Make sure the correct Port is selected in the Arduino Editor

    • Port → /dev/cu.usbmodem14301

      • Note: this may vary between computers, but there is usually only one option. The device needs to be connected for the Port to appear.

      • If the port is not appearing and the correct drivers are installed, you may need to reset your board

  • Make sure the correct Board is selected in the Arduino Editor

    • Board → Arduino Trinket M0


Sample Code

Note: This section was adapted from the “strandtest” example available in the Arduino Editor. This can be found at:

  • File → Examples → From Libraries → Adafruit NeoPixel → strandtest

  • Since we are using a NeoPixel Ring and not the strand, we have to modify this example.

For this process, we will open a new sketch, erase the template, and paste in the code bits below.

NOTE: Most of the functions used in this example are pre-defined in the Adafruit Neopixel library. (Optional: more information on Adafruit Neopixel functions).

Every code written for the NeoPixel Ring starts with the first section below. This section is where you set up the NeoPixel Ring. This prepares the data pin for NeoPixel output. The comments, denoted by /* */ or //, aren’t necessary, but are used to help the reader understand the purpose of the code.

/* Author: Jane Doe

Function: ring test */

#include <Adafruit_NeoPixel.h>

#define PIN 0

#define NUM_LEDS 24

// Parameter 1 = the pin number that the arduino is attached to (shown in image above)

// Parameter 2 = number of leds in pixels

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_LEDS, PIN);

There are a many different ways to customize the color. For example, the colorWipe() function paints a color, one pixel at a time, over the length of the ring.


All of the code that occurs in the void loop() {} portion is where you are providing instructions to the NeoPixel Ring. You are informing the ring of what function to use (colorWipe), what colors you would like (pixels.Color(255, 0, 0)), and the speed of rotation (50). Repeating the function with different colors will show the colors in a series. The second part of the code, the void colorWipe() {} portion is where the function is being defined. Without this section, the program would not be able understand how to run the function. You will not have to modify anything here.

Note: For a list of RGB color codes, check out

void loop() {

theaterChase(pixels.Color(127, 127, 127), 50); // White

theaterChase(pixels.Color(127, 0, 0), 50); // Red

theaterChase(pixels.Color(0, 0, 127), 50); // Blue


//Theatre-style crawling lights.

void theaterChase(uint32_t c, uint8_t wait) {

for (int j=0; j<10; j++) { //do 10 cycles of chasing

for (int q=0; q < 3; q++) {

for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {

pixels.setPixelColor(i+q, c); //turn every third pixel on



for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {

pixels.setPixelColor(i+q, 0); //turn every third pixel off





This code allows users to choose individual pixels to light up and assign each pixel a color. The first number designates which light to change. The following three numbers are the color, written in RGB format.

void setup() {


pixels.setBrightness(10); // this setting changes the brightness of the LEDs


void loop() {

/* to light up individual pixels (static)*/

pixels.setPixelColor(0, 255, 87, 51); // (pixel position, red, green, blue)

pixels.setPixelColor(4, 255, 189,51);

pixels.setPixelColor(8, 219, 255, 51);

pixels.setPixelColor(12, 117, 255, 51);

pixels.setPixelColor(16, 51, 255, 87);

pixels.setPixelColor(20, 51, 255, 189);;


Once the code is written out, the next step is to Verify the script. This is a form of error checking and putting all of the components of the code together. If this step is completed without returning an error, you may Upload and see your NeoPixel ring come to life!

Additional Resources

Ladyada’s Learn Arduino Tutorials

Arduino Library Use


Back to projects