My Make Projects

The goal of numberX is to build a LEGO ® module to generate and display a random number within a given range.
Usage example for playing games requiring random number (instead of dices).
By pressing the big square push-button on the front once, a random number is generated - takes 4 seconds.
Powered by an Arduino UNO, controlled by B4R.

  • Generate Integer Random Number by a push-button
  • Show the random number, while generating and the final number, in the middle of the 2 displays
  • Set the min / max number range via push-buttons up / down
  • Show the number range on the left and right 4 digit display
Creation Rules
  • Use as microcontroller the Arduino UNO
  • Use standard LEGO bricks
  • Minimize LEGO brick modifications (holes made for push-buttons only)
  • LEGO Case with modular components (easy to enhance)
  • Build code with B4R
  • Build to test the module functionality developed with B4R.
  • An RGB LED is used which changes color while the number is generated.
    Final Module: taken out based on user feedback as light is annoying.
  • The number is generated by holding down the push-button.
    Final Module: taken out as users want to push once and then wait 3-4 secs for the generated number.
  • The display information shows the generated number on the left and the min-/max-range on the right.
    Final Module: generated number displayed in the middle. Min-/max range left and right, only showed when a min-/max-push-button is pressed.
Download: B4R Source Code here.
Published External: B4R Forum
Hardware Parts (approx cost €)
  • 1x Arduino UNO (8 €)
  • 1x 8 digit 7-segment display (2 * 4 digits) with a MAX7219 display driver (2 €)
  • 1x Square Push-Button (2 €)
  • 4x Micro Push-Button (3 €)
  • In addition for the prototype: 1x RGB LED (0.5 €), 3x Resistors 220 Ohm (0.5 €), Breadboard (2 €)
  • LEGO bricks [LEGO is a trademark of the LEGO Group] (10 €)
Arduino = Buttons (WireColors)
A0 = NumberX (yellow)
A1 = MinUp (green)
A2 = MinDown (brown)
A3 = MaxUp (yellow)
A4 = MaxDown (orange)

Arduino = 2 * 4 Digit 7-Segment Display (WireColors)
VCC = 5v (red)
GND = GND (black)
DIN = PWM 10 (blue)
CS = PWM 9 (green)
CLK = PWM 8 (white)

(Prototype only) Arduino = RGB LED (WireColors)
PWM 3 = R leg (pink)
PWM 5 = G leg (gray)
PWM 6 = B leg (white)
Note: 220Ohm resistors between the LED and Arduino
To-Do List
Ideas for any next version.
  • NEW:Potentiometer to set the number generation time. When changing, display the time on the right display.
  • UPD:Make the case bit more fancy, e.g. look like a red dice with white dots.
  • UPD:Larger display.
  • 20170111: v1.1 - Update Random Generator using RndSeed (on a pin) before Rnd; Iterations 10 a 150ms.
  • 20170107: v1.0
  • 20170104: First prototype
numberX, 2017 by Robert W.B. Linn
Final Circuit

Prototype Circuit