×

SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.

Hardware Hump Day: Wheel-of-Lunch

Eliminate pesky decision-making with this randomized lunch picker!

Favorited Favorite 5

“Where should we go for lunch?” It’s a simple question that’s often followed by lengthy debate---because making decisions is hard when you're hungry, and pretty much everything sounds delicious.

We hear this conversation all the time here at SparkFun. A few guys on my team grab lunch together every day, and they always pick the same few restaurants. Now, I know how harrowing the process of choosing a lunch restaurant can be, so I decided to make it all a little easier for my buddies. Meet Wheel-of-Lunch, an Arduino-controlled randomized lunch picker.

Wheel-of-Lunch turns on when you hit the momentary push button, which triggers a DC motor and an LED strip.

After a randomized delay, the motor and LEDs turn off, and the pin attached to the motor stops and points to the chosen restaurant.

alt text

Now the decision has been made for the group. No debating required!

If you too struggle with knowing where to get lunch, you can build your very own Wheel-of-Lunch to simplify your life. To get started, you will need the following products:

Arduino Pro Mini 328 - 5V/16MHz

Arduino Pro Mini 328 - 5V/16MHz

DEV-11113
$10.95
140
DC Barrel Jack Adapter - Female

DC Barrel Jack Adapter - Female

PRT-10288
$3.50
1
Hobby Motor - Gear

Hobby Motor - Gear

ROB-11696
$2.10
4
Tactile Button Assortment

Tactile Button Assortment

COM-10302
$6.50
8
Resistor 10k Ohm 1/6th Watt PTH

Resistor 10k Ohm 1/6th Watt PTH

COM-08374
$0.10

N-Channel MOSFET 60V 30A

COM-10213
4 Retired

LED RGB Strip - Addressable, Bare (1m)

COM-12025
7 Retired

This project has four main electrical components: a push button, a DC motor, an LED strip and, of course, a microcontroller. I used the Arduino Mini because of its small size. The following Fritzing diagram illustrates the circuit.

alt text

Having a hard time seeing the circuit? Click on the wiring diagram for a closer look.

Below is the code I used to execute this project. Please note that you will need to download the Adafruit NeoPixel Library. If you are unfamiliar with Arduino libraries, feel free to check out our tutorial.

//Wheel-of-Lunch by Melissa Felderman for SparkFun

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN 10

int pixNum = 18;

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

int motor = 7;
int button = 4;
int buttonVal;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(motor, OUTPUT);
  pinMode(button, INPUT);

  strip.begin();
  strip.show();
}

void loop() {
  // put your main code here, to run repeatedly:
  buttonVal = digitalRead(button);
  Serial.println(buttonVal);

  if(buttonVal == 1){

    digitalWrite(motor, HIGH);
    rainbowCycle(random(0, 50000000));

    digitalWrite(motor, LOW);

  } 
  }





// 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));
    }
    strip.show();
    delayMicroseconds(wait);

  }  for(i=0; i< strip.numPixels(); i++){
      strip.setPixelColor(i, strip.Color(0,0,0));
     strip.show();
   }
}


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);
}

I used a 4" PVC pipe cap that I bought at the hardware store as the base of my enclosure. Inside, I have most of my circuit---with my LED strip glued around the inner edge. I drilled a small hole in the PVC pipe cap so that I could lead wires through there.

For the top of the enclosure, I used translucent acrylic on our laser cutter to cut the wheel and etch the restaurant logos. I darkened the logos with a black marker, which easily wipes off the non-etched surface. I also use some black acrylic to cut a tiny pointer that attaches to the motor head.

alt text

Picking a lunch spot has never been more fun!

What would your Wheel-Of-Lunch look like? Share your thoughts with us in the comments below!


Comments 10 comments

  • Shirley / about 8 years ago / 2

    I want one where the choices are Red Lobster, Long John Silver, Captain D's, and Legal Sea Foods. (Actually I'd localize my choices for Boston but I want you folks elsewhere to get it.) Weird Al fans will understand.

  • Rickster / about 8 years ago * / 1

    Kinda cool. Kinda overkill, but cool.

  • ThemePark / about 8 years ago / 1

    I can't help but think that this could either be combined with Simon Says or made from a Simon Says game.

  • Member #563236 / about 8 years ago * / 1

    Meh... did this years ago without an Arduino. ;) http://www.grantbob.com/2008/03/wheel-of-lunch.html (Is a very nice build though.)

  • Member #763773 / about 8 years ago / 1

    If your actual Wheel-Of-Lunch doesn't have a Snarf's logo on it I think it needs to go back to the drawing board ;-)

    ^ Misses CO and is really just jealous

  • l0gikG8 / about 8 years ago / 1

    The Wheel-of-Lunch that I currently use looks like this

    For this project adding OLED displays in each quadrant and Internet connectivity/Yelp API to pull the list of restaurants would be pretty cool.

  • Member #280411 / about 8 years ago / 1

    Just ordered the parts to make one. solve a similar problem we have at work. I have one question though, what's the battery for? I don't see it in the wiring schematic. Is it just so it doesn't need to be plugged in? Thanks.

    • Feldi / about 8 years ago / 1

      I used a Lipo battery to power the board and a 5v DC wall supply to power the LED strip and motor. It's not the most efficient option but it worked for my purposes!

      • Member #280411 / about 8 years ago / 1

        wont the LEDs, arduino pro, and gear motor, all run off 5v?

Related Posts

Recent Posts

Halloween Hacking

SparkFun Spooktacular

Tags


All Tags