Skip to content

To build a LEGO ® module to generate and display a random number within a given range.

License

Notifications You must be signed in to change notification settings

rwbl/make-numberx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

make_numberx

Objectives

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

numberx-case

Functionality

  • 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

Prototype

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

img:numberx-p.png

Hardware Parts (approx cost EUR)

  • 1x Arduino UNO (8 EUR)
  • 1x 8 digit 7-segment display (2 * 4 digits) with a MAX7219 display driver (2 EUR)
  • 1x Square Push-Button (2 EUR)
  • 4x Micro Push-Button (3 EUR)

In addition for the prototype: 1x RGB LED (0.5 €), 3x Resistors 220 Ohm (0.5 €), Breadboard (2 EUR)

  • LEGO bricks [LEGO is a trademark of the LEGO Group] (10 EUR)

Software

  • Arduino IDE 1.8.0 or higher
  • B4R 1.8.0 or higher

Wiring

numberx_bb

#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

Soure Code

The B4R source code and required libraries can be found in archive numberx.zip. The code is well documented.

About

To build a LEGO ® module to generate and display a random number within a given range.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published