The Rainbow Bat

Introduction: The Rainbow Bat

Do you ever want to just wack someone in the head and have a display of B-E-A-utiful color? Well look no more as cheesy as this sounds you can now make your own rainbow bat with flashy lights!

The things you will need are

  • A plastic bat any color, wiffle ball bat preferrably, or a cheapy where you can easily peel back the skin
  • Adafruit's neopixel RGB digital Strip
  • ONE arduino uno board
  • Accelerometer (ADXL337) to make things easier
  • Bubble wrap to make a safe little cubby for your entire circuit
  • The FREE arduino program
  • Glue/tape
  • a box cutter

Step 1: Begin!

Start by cutting holes into the bat and make it just biug enough to slide the wires in and through the top or where the opening for your battery and Arduino are going to be shoved inside. Once that is done begin the process of rubbing the glue along the bottom of your neopixel strip so that way when you stick the double sided tape on it--IT WILL STICK. I had issues with this first hand and the bottom needs to be rough or sticky,

Once that is done we and finely wrapped we can move onto the programming. NOTE: You can wrap the bat anyway you like.

Step 2: Step 2: Arduino and the Neopixels

Sounds like a band right? Well no. To begin Adafruit has a wonderful library that you can use to get started. We begin with attaching jumper wires to the beginning of your Neopixels. All arrows will point to the end. The beginning is the section that all jumpers connect to and then connect to the Arduino Uno. Using basic wires, red is power, black is ground, and white is data. The red will go into the 5V, Black will go to one of the GND pins, then the white is where the data comes from like 6.

Once you have it connected go ahead and hook the Arduino circuit board to a computer and boot up your Arduino programming software. The code is here:


#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

void setup() { strip.begin();; // Initialize all pixels to 'off' //Serial.begin(115200); }

void loop() {

// Get raw accelerometer data for each axis int rawX = analogRead(A0); int rawY = analogRead(A1); int rawZ = analogRead(A2);

// Print out raw X,Y,Z accelerometer readings // Serial.print("X: "); Serial.println(rawX);

if (rawX >=650|| rawY >= 650 || rawZ >= 650) { theaterChaseRainbow(25); } else { rainbow(1); } }

// Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i

void rainbow(uint8_t wait) { uint16_t i, j;

for(j=0; j<256; j++) { for(i=0; i

// Slightly different, this makes the rainbow equally distributed throughout void rainbowCycle(uint8_t wait) { uint16_t i, j;

for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel for(i=0; i< strip.numPixels(); i++) { strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255)); }; delay(wait); } }

//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 < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, c); //turn every third pixel on };


for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, 0); //turn every third pixel off } } } }

//Theatre-style crawling lights with rainbow effect void theaterChaseRainbow(uint8_t wait) { for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel for (int q=0; q < 3; q++) { for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, Wheel( (i+j) % 255)); //turn every third pixel on };


for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, 0); //turn every third pixel off } } } }

// Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r. uint32_t Wheel(byte WheelPos) { WheelPos = 255 - WheelPos; if(WheelPos < 85) { return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } if(WheelPos < 170) { WheelPos -= 85; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } WheelPos -= 170; return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

Step 3: Accelerometer Time!

Okay so we'll leave the LED light strip alone for a bit and start with the accelerometer, Make sure it is the ADXL337 before hooking up. Most accelerometers will work the same but have a different hookup. Here is a diagram to help hook one up to your Arduino.

Step 4: HOOK It All Up

Next we hook both the lights and the Accelerometer into the arduino. Make sure you double check and make sure that the wires are in the right pins to reduce risk of burnout.

Step 5: Time for Bubblewrap

I use bubble wrap as an alternative to something more cotton like and to save time on building a box to hold my arduino and batter in place. I begin filling the bottom until I hit a 1/3 level. I make a pouch for the arduino and place the entire thing in and then place a small layer on top. The last part in this will connect the battery it needs to be 9V or higher to power the strip. Once in and ready I place the battery in on top of the layer of bubble wrap and tape the top part shut.

VOILA and done! you now have a motion sensor bat to wack people with,

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge



    4 years ago

    Ha! Fun and silly, but nicely done.