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.
“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.
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:
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.
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.
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!
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.
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
Haha! YES! We LOVE Snarf's :)
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!
wont the LEDs, arduino pro, and gear motor, all run off 5v?