MBcreates
Published © GPL3+

Making an Arduino Touch Sensitive LED Sign

An Arduino logo engraved in acrylic with a touch sensitive aluminum LED stand.

IntermediateShowcase (no instructions)15,074
Making an Arduino Touch Sensitive LED Sign

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Resistor 1M ohm
Resistor 1M ohm
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

RGB Led capacative touch interface

Arduino
This program is written for an Acrylic engraved LED sign stand. The LED’s can be switch ON/OFF and the colour can be changed by touching the metal stand.
// this programm is written by MBcreates (www.YouTube.com/MBcreates)
// this program is in the public domain and free to use in any way you see fit 

//Credits: Paul Barger(https://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense)
// https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use

// LED used: ws1012-rgb-8mm-led
// Resistor: 1 1m ohm
 


#include <Adafruit_NeoPixel.h>
#include <CapacitiveSensor.h>
#define PIN 10
#define LEDS 1

int DELAY_TIME = 500;
int COUNTER = 0;
boolean LIGHT_STATE = false;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDS, PIN ,NEO_GRB + NEO_KHZ800);
CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 1 megohm resistor between pins 4 & 2, pin 2 is sensor pin, attach to metal body 

void setup() {

  Serial.begin(9600);
  
   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
   Serial.begin(9600);
  
  strip.begin();
  strip.show();  //
  strip.setPixelColor(0, 69, 255, 0); // ORANGE RED
  strip.show();
 
}
 
void loop() {

 long total1 =  cs_4_2.capacitiveSensor(30);

 if(total1>400)
 {
  COUNTER++ ;
 }

 else
 {
  COUNTER = 0; 
 }

if((total1>400) && (!LIGHT_STATE))     
{
  strip.setPixelColor(0, 69, 255, 0); // ORANGE RED
  strip.show();
  delay(400);
  LIGHT_STATE = true;
}

total1 =  cs_4_2.capacitiveSensor(30);

if((total1>400) && (LIGHT_STATE))
{

    strip.setPixelColor(0, 0, 0, 0); // ORANGE RED
  strip.show(); //.
  delay(400);
  LIGHT_STATE = false;
}

while(COUNTER>3)  // while loop to sellect the led colour
{
  
  strip.setPixelColor(0, 255, 0, 0); //GREEN
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

  strip.setPixelColor(0,0,  255, 0); //RED
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

  strip.setPixelColor(0, 0, 0,  255); //BLUE
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

    strip.setPixelColor(0, 69, 255, 0); // ORANGE RED
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

  strip.setPixelColor(0, 255, 255, 10); // YELLOW
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

  
strip.setPixelColor(0, 69, 139, 19); // BROWN
  strip.show(); //.
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}

  strip.setPixelColor(0, 0, 139, 139); // Purple
  strip.show(); //. grb 
  delay(DELAY_TIME);

 
total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}



  strip.setPixelColor(0, 165, 218, 32); // GOLD
  strip.show(); //. grb 
  delay(DELAY_TIME);

total1 =  cs_4_2.capacitiveSensor(30);

if(total1<400)
{
  break;
}


}

}

  

 


      

Credits

MBcreates
2 projects • 15 followers
Contact

Comments

Please log in or sign up to comment.