Ir para conteúdo
3DFinder
Entrar

Você está no 3DFinder

Buscamos em Thingiverse, MakerWorld e Printables ao mesmo tempo para te dar o melhor de cada uma.

Buscar mais como este
Modelo 3D Hardware random number generator por Printerman no Printables

Descrição

This is a machine that throws 3 dice in a tray, with a stepper motor, and then reads the results using OpenCV. All programming is made in Python, code is mostly copied from older projects and ChatGPT.

Code works by using Blobdetection to find dots on the dice, and dbscan to cluster them into separate dice. The "separators" in the tray is needed for this to work.

Hardware used is a ordinary stepper motor, and a DRV8825 driver circuit. A Raspberry Pi 4 and a Pi Camera 3. Besides from a couple of M4/M2.5 screws most other parts are 3d printed using PLA and PETG.

Stepper motor

Im using a Bipolar stepper motor, NEMA 17. It is rated for 1,5 A but im limiting it to 500 mA with the DRV8825. The drive circuit is powered with 12 V.

Construction

I chose this version as the final machine, since it is quicker and gives better resutls than other machines i have built. It doesn't require any specialty parts like glass or bearings.

The machine is put together with CA glue and hot melt adhesive on a piece of bookshelf board.

Improvements to be made

  • The camera needs a bit wider angle, like the Pi Camera 3 Wide

  • To reduce noise levels, rubber bottom should be used in tray.

  • List dice after what lane it is placed in.

Random number generation

To get good random numbers from dice throws that give a value of 1-6 you can use modulo, but there are things to avoid. If you need a random value from 0 to 27 you should throw one three dice(d1-d3) in an order, and do the following:

(d1 - 1) * 36 + (d2 - 1) * 6 + (d3 -1) * 1

If the value is above 196 throw the dice again and remove the numbers, other wise there will be a modulo bias in the results. After that you modulo the number with 28. Example:

  • First dice thrown: 4

  • Second dice thrown: 3

  • Third dice thrown: 2

(4-1)*36 + (3-1)*6 + (2-1)*1 = 121

121 modulo 28 = 9

Printables

Hardware random number generator

Publicado em 4 de jan de 2026

0
Curtidas
5
Downloads
Categoria Math
Tags
dice number random
Licença Creative Commons — Public Domain
Arquivos (8)
Part Studio 1 - Tray(3).stl 4.6 KB
Part Studio 1 - Voltage terminals(1).stl 57.7 KB
Part Studio 1 - Spur gear (8 teeth)(3).stl 248.1 KB
Part Studio 1 - Motor mount(1).stl 173.3 KB
Part Studio 1 - Camera Tower(2).stl 301.3 KB
Part Studio 1 - Coggwheel tray(3).stl 578.9 KB
Part Studio 1 - Bracket(2).stl 86.6 KB
Part Studio 1 - Carriage(1).stl 292.9 KB
Ver no Printables (abre em nova aba)

Gostou deste modelo? Crie uma conta grátis para salvar seus favoritos e voltar a eles depois.

Criar conta