Sweet Math Quiz

by rgco in Living > Education

2026 Views, 7 Favorites, 0 Comments

Sweet Math Quiz

20201101_181718.jpg
Sweet Math Quiz - startup

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.

Components and Tools

20201101_162141.jpg

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

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!

Female Headers for the LCD Keypad Shield

20201101_163813.jpg

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

Build the Candy Distributor

20201101_185655.jpg
20201101_185514.jpg
20201101_185938.jpg
20201101_185843.jpg
20201101_185311.jpg
20201101_185131.jpg
20201101_184703.jpg
20201101_184133.jpg
20201101_182803.jpg
20201101_182707.jpg
20201101_182509.jpg
20201101_182539.jpg
20201101_183730.jpg
20201101_184110.jpg
20201101_183340.jpg
20201101_190046.jpg
20201101_190705.jpg
20201101_190800.jpg
20201101_190825.jpg
20201101_191026.jpg
20201101_182047.jpg

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.

Connect and Play

Sweet Math Quiz - level 3

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!