Solder a piece of 3-ply stranded ribbon cable to the three pads on your NeoPixel strip. (Wires from our premium jumpers work well for this, as do three pieces of silicone coated stranded wire.)

Hook up your sensor and LED strip with alligator clips, according to the circuit diagram. Program your FLORA with the sample code below, which will help you calibrate your handmade sensor.

Open up Arduino's serial monitor and use a blunt object like a roll of tape or a plastic cup to press on the velostat sensor. You should see the sensor values streaming onto the screen.

Since there are 60 LEDs connected to this circuit, it can be too much current for some USB ports! We found that our computer's onboard port could power the circuit, but the keyboard USB port could not.

The sketch below is programmed to only light up the first 10 pixels in the strand so it should work with any USB port:

#include <Adafruit_NeoPixel.h>

const int analogInPin = A9;  // Analog input pin that the potentiometer is attached to
Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, 6, NEO_GRB + NEO_KHZ800);
int sensorValue = 0;        // value read from the pot

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
 pinMode(9, INPUT_PULLUP); 
   strip.begin();
  strip.show(); // Initialize all pixels to 'off'
 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);              
  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.println(sensorValue);      

if (sensorValue < 100){
  Serial.println("leds triggered"); 
colorWipe(strip.Color(255, 0, 0), 25);
colorWipe(strip.Color(0, 0, 0), 25);
}  
                    
}

void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

This guide was first published on Aug 28, 2013. It was last updated on Aug 25, 2015.

This page (Test Circuit) was last updated on Aug 20, 2013.

Text editor powered by tinymce.