Hackster is hosting Impact Spotlights highlighting smart energy storage. Start streaming on Thursday!Stream Impact Spotlights on Thursday!
Neeraj Rane
Published © CC BY-NC-SA

RGB Mouse Pad

RGB mouse pads available in the market are expensive. So, I decided to make a cheap RGB mouse pad using Arduino and WS2812 RGB LED Strip.

BeginnerFull instructions provided5,020
RGB Mouse Pad

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
NeoPixel strip
NeoPixel strip
×1

Story

Read more

Schematics

schematic_SMc7vyeX95.jpg

Code

Rainbow Effect

Arduino
Before you upload, make sure that the number of LEDs and Data pin number is correct.
#include "FastLED.h"

#define PIN 4
#define NUM_LEDS 22  //Number of LEDs in the strip

CRGBArray<NUM_LEDS> leds;
uint8_t hue[NUM_LEDS];

void setup(){
  FastLED.addLeds<NEOPIXEL, PIN>(leds, NUM_LEDS);
  for(int i = 0; i< NUM_LEDS; i++){
    hue[i] = 255/NUM_LEDS * i;
  }

  //Random RGB Sparkle Animation
  for(int j = 0; j < 100 ; j++){
    int dot = random(0,23); 
    int hue = random(0,256);
    leds[dot] = CHSV(hue,255,175);
    FastLED.show();
    delay(50);
    leds[dot] = CRGB::Black;
  }
}

void loop(){
  //Rainbow Effect
  for(int i = 0; i< NUM_LEDS; i++){
    leds[i] = CHSV(hue[i]++, 255, 175);
  }
  FastLED.show();
  delay(8);
}

Credits

Neeraj Rane

Neeraj Rane

18 projects • 47 followers
Electrical Engineer and a Maker from India. Engineering is fun once you start applying it!

Comments