Introduction: Sweet Math Quiz

Math can be fun, even more when you earn candies! With an Arduino Uno, an LCD shield, a servo motor and some Lego, we can build a math quiz machine hands out candies for good answers. Great to stimulate your kid to practice math, but also for a party or a family game evening.

The quiz consists of 5 true/false questions that must be answered within 10 seconds. Each question is an addition, subtraction, multiplication or division, and you need to choose if the answer is right or wrong. At higher levels, the numbers involved get larger. Press left if it’s wrong, right if it’s right. If you get all 5 right, you get candies and the level goes up. You can now play again, or pass on to the next player. If you had a mistake, no candies and the level goes down.

The set of questions are different each time because they are made on-the-fly with a random number generator that uses as a seed the time in milliseconds of the first button push. Moreover, it’s straightforward in the sketch to set the level to the skills of the participants: the starting level, the number of questions, the required number of correct answers and the maximum time per question.

Step 1: Components and Tools

Components:

  • An Arduino Uno
  • An LCD keypad shield
  • An SG90 mini servo motor
  • LEGO - standard bricks plus a few technic gears and axles
  • Female pin header - sold in strips of 40 - needs to be cut to one of 5 pins and one of 6 pins
  • 3 male-male jumper cables
  • A bag of candies: M&M, Smarties or Skittles

Tools:

  • A soldering iron to add female pin headers to the keypad shield

Step 2: Upload the Code and Position the Servo Motor.

Before building anything, we need the servo motor to be in a well-defined position, corresponding to 0 degrees, or ‘in’. The easiest way to do this is to upload the attached sketch to the Arduino, since the first thing it does is to set the servo at 0 degrees. Thus, upload the attached sketch, connect the servo, with red on +5V, brown on ground and the orange control line to pin A1. Use male-male jumper cables to connect the servo connector to the Arduino pins. If the servo was not already in the 0 degree position, it will quickly move there now. Disconnect and move on!

Step 3: Female Headers for the LCD Keypad Shield

The LCD keypad shield has no female pin headers like other shields, but it has holes on the top and on the bottom where we can solder them onto. We will need to connect the servo motor to the Arduino on non-adjacent pins, and the easiest way is to put female pin headers on the bottom. Cut the female headers to one of 5 pins and one of 6 pins and solder them to the corresponding holes, as in the picture

Step 4: Build the Candy Distributor

The candy distributor consists of 7 parts:

  • The base
  • The plate
  • The slider
  • The tray
  • The neck
  • The box
  • The servo holder

The pictures show, in order, how to make each part and how to put them together. Make sure that the tray is in the 'in' position, since the servo position has been set to 'in' 2 steps ago.

Step 5: Connect and Play

If you did not already, upload the sketch from 3 steps back to the Arduino. Connect the LCD shield and connect the servo motor with 3 male-male jumper cables to +5V, ground and the orange control line to pin A2. Push reset and start playing!

Candy Speed Challenge

Participated in the
Candy Speed Challenge