ruleta aleatoria arduino

Arduino random number roulette

Welcome to a new Arduino project. In this tutorial, you will learn how to build a roulette with Arduino that spins and points to random numbers. We will also cover the materials used, the wiring diagram, and the code needed to control the roulette so that it chooses random numbers.

Materials used for this project

Below you can see the different materials used to build the roulette and make it spin with Arduino, together with a brief description of each one. If you want to build it yourself, you can click the images to go to a website where you can buy the materials.

Arduino Uno board: it is the brain of the project and controls every part of it through the code you will find below.

Stepper motor: by sending electrical pulses, it is possible to control the motor rotation, which happens in discrete steps.

A board with interconnected holes (pins) that we use to make all the project connections.

Palos de helado: We will use these sticks for the roulette pointer.

Jumper wires: these wires have male or female pin connectors that let us connect the different elements mentioned above.

Components needed for this project

Arduino starter kit
Arduino starter kit
Arduino Uno board
Arduino Uno board
Stepper motor
Stepper motor
Male-to-female jumper wires
Male-to-female jumper wires
Breadboard
Breadboard
Ice cream sticks
Ice cream sticks

WE DEVELOP YOUR IDEA

Need help with a project?

RobotUNO project consulting
  • Prototyping and MVPs
  • Arduino and ESP32
  • PCB design
  • 3D part design
  • Bluetooth connectivity
  • Feasibility study
  • Cost optimization
  • Technical consulting
  • Internet of Things
  • Patent supbyt
Learn more

Project explanation video

If you want a much more detailed walkthrough of how to build this project from start to finish, including a code explanation, the video below covers everything in a more visual and easier-to-follow way. And remember, if you enjoy this kind of content, do not forget to subscribe.

Arduino wiring diagram for the roulette

One of the most important parts of assembling the random number roulette is connecting the different elements correctly. To avoid assembly mistakes or incorrect connections, here is the wiring diagram used in this project. With this wiring, you can use the code at the end of the post without making any modifications.

esquema de conexiones ruleta aleatoria

Arduino code for the random number roulette

Below you can find the code developed specifically for this project. The pins used in the code are the same ones shown in the wiring diagram above.

If you want a more detailed explanation of the different parts of the code used to program this roulette and how it works, I recommend watching the video linked above.

If you have questions about how to use or install the Arduino development environment, here is a link to how to download the Arduino IDE

//Canal de YouTube -> Robot UNO
//Ruleta de números aleatorios

#include <Stepper.h>

Stepper motor1(2048, 8, 10, 9, 11);

void setup() {
  motor1.setSpeed(15);
}

void loop() {
  int x;
  x=random(2048,2048*2);
  motor1.step(x);
  delay(5000);
}
Published in Arduino projects, electronics projects, motor projects.