Rainbow LED Roulette Beer Tray
The idea started with the new start-up of my water polo team. This was a friends team that started again with a water polo team at the bottom of the league. Everyone could play polo just fine, but we had no uniform or logo. I made this one up and also this beer tray.
It's a big hit in the pub when you arrive with this. I have now made 5 for different teams.
Now it's time to share it with everyone. Have fun making it and that especially while enjoying a beer.
Step 1: the Ingredients
What do we need:
-a good humor
-a beer on the side
-1x Arduino nano
-1x power bank (small)
-1x USB cable 0.3mtr
-0.5mtr Wire 0.14mm2
-1x Arcade Button
-2x M3x35 bolts
-2x M3 threaded nut
-5x M16x40 Bolt
-Plywood 500x500x10mm
-plexiglass 500x500x10mm
-1 x Switch
-0.5mtr x WS2812 LEDstrip
Tools: -lasercutter
-3D printer
-Soldering Iron
Step 2: the Building.
Op thingiverse staan alle file om de lasersnijder en 3d printer aan te zetten.
https://www.thingiverse.com/thing:3830895
It's all pretty easy to make:
1 - let the laser cutter do its job with the plexiglass and plywood
2 - Putting 3D printer to work over night. Saves time!!!
3 - Programming the arduino. (Program is in the next step.)
4 - Soldering the wiring according to scheme.
Cut the outside of the Usb Cable. Then cut the red wire. Solder the cutted ends to the switch.
5 - put everything together
6 - Testing everyting
Step 3: the Program
#include
long randNumber; int pos;
//──────────────────────┤ User Variables ├────────────────────────────
#define PIN 6 //data pin used in for neopixel int spins = 6; //how many times to 'spin before starting to slow down and settle #define dir 1 //set to 1 for clockwise rotation, 0 for counter clockwise. const int knop = 2; int knopstatus = 0;
//───────────────────────────────────────────────────────────────────────
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);
//──────────────────────┤ SETUP Function ├────────────────────────────
void setup() { randomSeed(analogRead(1+2+3+4+5)); //initialize floating pin (analog pins 1-5) as the seed for the RNG strip.begin(); clr(); //clear the display for good measure. strip.show(); // Initialize all pixels to 'off' pinMode(knop, INPUT_PULLUP); }
//──────────────────────┤ Main Loop ├────────────────────────────
void loop() {
randNumber=random(0,24); //fetch a random number between 1-16
roulette(strip.Color(255,0,0),strip.Color(0,0,255),strip.Color(0,255,0));
}
//──────────────────────┤ Roulette Wheel Function ├────────────────────────────
void roulette(uint32_t c,uint32_t d,uint32_t e) {
knopstatus = digitalRead(knop); if(knopstatus == LOW) {
//spin the number of times (variable 'spin') at full speed for (int i=0; i<24*spins; i++){ advanceOne(c,d,e,1); }
//slow down and 'settle' on final number for (int i=0; i<(24*6)+randNumber; i++){ advanceOne(c,d,e, (i*.25)+1); }
delay(9000); //reset spins automatically.
} else{ for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) { for(int i=0; i
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue))); } strip.show(); // Update strip with new contents delay(0); // Pause for a moment } } }
//──────────────────────┤ Advance One Position Function ├────────────────────────────
//every time this function is called, the led is advanced 1 position on the wheel void advanceOne(uint32_t c,uint32_t d,uint32_t e, uint16_t wait) {
clr();//Clear the display
if ((pos & 0x01) == 0) { //check to see if position is an even number strip.setPixelColor(pos, c); //turn on the pixel at position 'pos' } else //else it is odd {strip.setPixelColor(pos, d); }
if (pos == 0) { //or check to see if it is '0' strip.setPixelColor(pos, e); }
strip.show(); delay(wait);
if (dir){ //if direction var is set to clockwise pos--; //decrement the position if(pos<0) {pos=25;} //resets running count if < 0} } else{ pos++; //increment the position if(pos>25) {pos=0;} //resets running count if > 25} }
}//end advanceOne function
//──────────────────────┤ Clear all Pixels Function ├────────────────────────────
//clears the display void clr(){ for(uint16_t i=0; i
Downloads
The End
Have fun with your friends.
BEWARE: this can lead to work if your friends want one too
you have been warned