Light Display With Stroke Sensor and Arduino
5457 Views, 67 Favorites, 0 Comments
Light Display With Stroke Sensor and Arduino
This is a light display controlled by an Arduino and a stroke sensor. When the stroke sensor is activated, the brightness of the displays can change accordingly.
Prepare the Materials
For this project, you will need:
Two Neopixel LED Strips
One Arduino UNO
Two 18x24 Acrylic Sheets
One 18x24 1/8" Craft Ply Wood
Conductive Threads
Non-Conductive Threads
Felt
Jumper wires
Solder iron and soldering wire
Wood glue
Laser Cut the Wood & Acrylic Sheets
Use the template to laser cut (template 1) the wood and acrylic sheets (template 2 and 3). You can change the patterns on the sheet to match your style.
Install the LED Strips
Cut the LED Strips into 11 strips of 5 LEDs.
Line them up on the board. The position of these LEDs should match the position of the slits on the top panel. You can use a marker to draw out where you should put the LED.
Solder the ends of the strips together. Color code the wires to make it easier to debug later.
Construct Stroke Sensor
Cut the felt (either by hand or a laser cutter) to fit the top wooden panel.
Sew the conductive thread and non-conductive threads together to make a stroke sensor. Follow an in-depth tutorial on how to make a stroke sensor here.
Connect All the Pieces Together
Link the stroke sensors and the LEDs strips to the Arduino.
Open Arduino and install the FastLED library:
1. Click here to download the FastLED library.
2. You should have a .zip folder in your Downloads folderUnzip the .zip folder and you should get FastLED-master folder
3. Rename your folder from FastLED-master to FastLED
4. Move the FastLED folder to your Arduino IDE installation libraries folderFinally, re-open your Arduino IDE
Install the below code to the Arduino:
#include "FastLED.h"
// How many leds in your strip? #define NUM_LEDS 55
// For led chips like Neopixels, which have a data line, ground, and power, you just // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN #define DATA_PIN 5 #define CLOCK_PIN 13 int x=100; int y=200; boolean control=true;
int sensorPin=A0; int sensorValue=0;
// Define the array of leds CRGB leds[NUM_LEDS];
void setup() { // Uncomment/edit one of the following lines for your LEDs arrangement. FastLED.addLeds(leds, NUM_LEDS); pinMode(sensorPin,INPUT); pinMode(DATA_PIN, OUTPUT); }
void loop() { sensorValue = analogRead(sensorPin); for (int i=0; i<56;i++) { leds[i]=CRGB::Blue; FastLED.setBrightness(sensorValue); FastLED.show(); } }