Upgrade Your Vodka Gift Box

632

9

4

About: I'm a second year electrical engineering student. I'm mostly into electronics and programming but like also road biking and camping.

Intro: Upgrade Your Vodka Gift Box

In this instructable I will show how I upgraded a vodka gift box by adding some rgb LEDs to it. It has three operating modes: static colors, rotating colors, and a game mode. In the game mode the device randomly picks one bottle and flashes the light under it, suggesting the player to take a shot. All the modes are presented on the video.

The LEDs I used were taken from a led strip based on WS2812B LED modules. They are great since they allow you to control the color of each LED separately and you can link them after another as many as you like, so you need just one digital pin to control them. They are also compatible with Adafruits NeoPixel library, so you can get started easily.

I used an Attiny84 to control the LEDs and respond to the button presses. I first tested everything with a regular Arduino, but it simply wont fit inside the case, so using a standalone chip was the answer.

I used clear tape to attach the parts to the case, because I didn't have a hot glue gun and I wanted to finish this project soon. You can of course use any method of attachment you like.

Step 1: Prepare the Case

Start by opening the package and removing the bottles. Try to fight the urge to drink them while you are working. I used a leatherman to make holes for the LEDs on the bottom of the case, but you can use whatever tool you like.

Step 2: Install the LEDs

To mount the LEDs, I had to modify the LED strip a bit. As can be seen from the image, the spacing of the LEDs isn't exactly the one of the bottles. This can be solved by cutting the LED strip in to single pieces and soldering them together with a pieces of wire. Be careful to solder the LEDs right way so that the output of the previous LED goes to the input of the next LED After linking them back together, they can be installed to the case. I secured the with pieces of tape. I also bent the end of the strip to have an easy access to the voltage in, data and ground pads.

Step 3: Button

To control the lighting modes of the LEDs between static, changing and game, I installed a button trough the case under the middle bottle. This way when you press the middle bottle downwards, it activates the button and you can perform actions with it. I was lucky to have a button that sticked trough the bottom just right so that it got pressed down when the bottle was pressed down, but didn't get pressed down under the weight of the bottle.

Step 4: Attiny84

To control the LEDs and to respond to button actions, I used attiny84 micro controller. I could have probably used attiny85 as well since I only need two digital pins to operate the LEDs and the button, but I didn't have any laying around. I soldered the chip on a piece of dot coppered protoboard and attached all the wires and the button pull-down resistor to it according to the wiring diagram. I wanted to make it programmable on board, so I soldered the ISP flashing pins to a 2X3 header. Then I programmed the chip with Arduino according to these instructions.

Step 5: Power

To power all the components inside, I utilized a regular USB cable. Since USB delivers 5 volts and all my components work at that voltage, there was no need for any regulators. I made a small hole to the end of the device and passed the USB cable trough it. The ground and voltage lines of the cable can be soldered to the corresponding ones of the led strip to reduce excess wiring inside the case.

Step 6: Code

To control the LEDs I used Adafruits NeoPixel library. You can get it from here

I wanted to be able to change the behavior of the device between static colors and rotating colors. I also wanted to add a game mode where it randomly picks one bottle and flashes the led under it. To achieve this, I made the code to react both short and long presses of the button. Long presses change the mode, and short presses activate the lottery in game mode. I pasted the code below so you can copy it directly to your editor or you can download the attached file.

#include <Adafruit_NeoPixel.h>

#define LEDPIN         0  //digital output pin to controll your leds
#define BUTTON         1  //pin to hook up the button to

#define PIXELCOUNT      5  //the amount of leds in your strip

float p = 0; //phase for rotating mode
int maxpow = 100; //maximum power for rotating mode, between 0 and 225
int mode=0; //which mode the leds are. 0: static colors, 1: rotating colors, 2: game mode
bool pushed=false; //track keeping of pushes to 
int pushCount=0; //cuonter to count the lenght of the push to determine between short and long pushes

uint32_t red = 0xff0000; //red color for the randomization flashing
  
//colors for the static mode: cyan, yellow, red, green, purple
uint32_t colors[5]={0x00ff00, 0xffff00, 0xff0000, 0x00ff00, 0xff00ff};
  
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PIXELCOUNT, LEDPIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(BUTTON, INPUT);
  pixels.begin();
}

//function to randomly pick one bottle/cup and flash the led under it
void rotate(){
  
  randomSeed(millis());
  
  int cup = random(5); //picking the random cup

  //cool animation where the leds are scrolled trough to make a randomizing effect
  for(int i = 1; i<100+cup; i++){
    for(int j=0;j<PIXELCOUNT;j++)
	pixels.setPixelColor(j, pixels.Color(0,0,0));
     pixels.setPixelColor(i%5, pixels.Color(0,100,100));
     pixels.show(); 
     delay(i);
  }
  //make all leds go dark
  for(int i=0;i<PIXELCOUNT;i++)
    pixels.setPixelColor(i, pixels.Color(0,0,0)); 
  

  pixels.setPixelColor(cup, red);
  pixels.show();
  //flash the led aunder the chosen cup/bottle
  for(int i=0; i<5; i++){
    
    pixels.setPixelColor(cup, 0x000000);
    pixels.show();
    delay(300);
    
    pixels.setPixelColor(cup, red);
    pixels.show();
    delay(300);
  
  }
}
//switch the between the display modes
void switchMode(){
    mode++;
    if(mode>2) mode=0;
}
void loop() {
  
  //counting the length of a push
  while(digitalRead(BUTTON)==HIGH && pushCount<1000 && !pushed){
    pushCount++;
    delay(1);
  }
      
  //detecting a long push from a short push
  if(pushCount>=1000){
    switchMode();
    pushed=true;
  }else if(pushCount>0){
     pushed=true;
     if(mode<=1) switchMode(); 
  }
  pushCount=0;
  //performing actions based on the current mode
  switch(mode){
    
    case 0 : //static mode, static colors for each led
      for(int i=0;i<PIXELCOUNT;i++){
	pixels.setPixelColor(i, colors[i]);
      }
      pixels.show();
      break;


    case 1 : //rotating mode, changing the color around color wheel
      p+=0.004; //increasing the current phase of color wheel
      if(p == 2*PI) p = 0;
     
      for(int i=0;i<PIXELCOUNT;i++){ //choosing each led color based on the current phase of the color wheel and position
        pixels.setPixelColor(i,pixels.Color(
                                        int(maxpow * max( sin(p + i*2*PI/PIXELCOUNT), 0 )),
                                        int(maxpow * max( sin(p + i*2*PI/PIXELCOUNT + 0.66*PI), 0 )),
                                        int(maxpow * max( sin(p + i*2*PI/PIXELCOUNT + 1.33*PI ), 0 ))
                                        ));
        pixels.show();
      }
    break;


    case 2 : //game mode
      if(pushed){ //start the randomizatin with a short push
            
          //make all leds go dark
        for(int i=0;i<PIXELCOUNT;i++) pixels.setPixelColor(i, pixels.Color(0,0,0));
          pixels.show();
          
          rotate();
        }
    break;
  }

  //if button is released, reset the pushing track keeping and prepare for the next push
  if(digitalRead(BUTTON)==LOW)
    pushed=false;
    
  delay(1);
}

Step 7: Conclusion

Adding the LEDs really makes it an unique gift and makes it really fancy decoration element, and the game mode works great for parties. And when the bottles are empty, they could be replaces with shot glasses of same size.

In my own opinion the results looked quite good and the game mode was quite fun and exiting. I thought of making it drop a jackpot every once a while where it would flash all the spots at once, but my friends said that would bee too brutal and they are probably right.

This upgrade or hack can of course be applied to any other type of bottle container etc. I think it would be cool to install the LEDs on a shelf under the bigger bottles to make even cooler house decoration element.

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest

    4 Discussions

    0
    None
    Handsome-Ryan

    8 months ago

    Nice. Any tips for soldering the wires to the tiny pads on the LED strips. I always struggle with that and yours looked pretty good.

    1 reply
    0
    None
    eprittinenHandsome-Ryan

    Reply 8 months ago

    Firts I put solder on both the pad and the wire, then I held the wire in my other hand and the soldering iron in the other. This is probably not the easiest way and might take some practicing. Using helping hands with alligator clips is propably the best method.

    0
    None
    Glumgad

    8 months ago

    Great gift!

    0
    None
    RiiaL

    8 months ago

    Wow, cool!