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
$9.95
130
Hobby Motor - Gear

Hobby Motor - Gear

ROB-11696
$1.95
4
Tactile Button Assortment

Tactile Button Assortment

COM-10302
$5.85
6
N-Channel MOSFET 60V 30A

N-Channel MOSFET 60V 30A

COM-10213
$0.95
3
DC Barrel Jack Adapter - Female

DC Barrel Jack Adapter - Female

PRT-10288
$2.95
1

LED RGB Strip - Addressable, Bare (1m)

COM-12025
7

Resistor 10k Ohm 1/6th Watt PTH

COM-08374
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 11 comments

  • 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.

  • Kinda cool. Kinda overkill, but cool.

  • Back when I was a "fresh-out" Engineer, working for the company that "second sourced" the Z80 microprocessor, the solution we'd arrived at for solving the problem was "he who drives chooses the lunch place", and (usually) "he who got the parking space closest to the building entrance drives".

    We also came to the conclusion that more real Engineering work got done at Denny's than did in the office. (Often when a serious question came up at the office, someone would say "let's talk about that over lunch", and a solution would be worked out, to be entered into the computers when we got back to the office. Unfortunately, we couldn't get the bean-counters to see that it would be in the company's interest to pay for the lunches!)

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

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

  • 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

  • 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.

  • 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.

    • 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!

Related Posts

Recent Posts

Tags


All Tags