This instructable will show you how to create a dice using Arduino and few components. It's an easy and fun project, suitable for beginners and those who want to start with Arduino; it also requires a minimal amount of components.
This explaines how to create it in the breadboard, how to solder it and how to make some changes.
 
Remove these adsRemove these ads by Signing Up

Step 1: What is Arduino?

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free.

The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment.

Why Arduino?

There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems:

  • Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50
  • Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows.
  • Simple, clear programming environment - The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino
  • Open source and extensible software- The Arduino software and is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. SImilarly, you can add AVR-C code directly into your Arduino programs if you want to.
  • Open source and extensible hardware - The Arduino is based on Atmel's ATMEGA8 and ATMEGA168 microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money.

How do I use Arduino?

Step-by-step instructions for setting up the Arduino software and connecting it to an Arduino Duemilanove:

(All this part was taken from the official website of Arduino)
teknohawk says: Apr 18, 2013. 5:15 PM
Wow thanks! This is something I definetly want to build! :0 ;) :) Yay!
mr.future11 says: Oct 8, 2012. 12:54 AM
finally did this project it was nice starting with dice. but i want to blink led blindly before the no comes on after pressing the button. i tried it but it was not as good as i thought of.
P081012_1330[02].jpgP081012_1330[02].jpg
Davuzz11 (author) in reply to mr.future11Oct 24, 2012. 12:22 PM
Well done! For making leds blink like a dice before you press the button, you can try the modified code posted by "kloptops" some time ago. This is the link: http://dl.dropbox.com/u/7992054/arduino/Dice.pde
It' not a really "random" sequence, but i think it will work the same.
If you use that code, remember to change the code in the first lines from:
int pinLeds3 = 8;
int pinLeds4 = 7;
to:
int pinLeds3 = 7;
int pinLeds4 = 8;
mr.future11 says: Oct 8, 2012. 1:24 AM
made it finally. first project in arduino.. guys want help i want to blilnk leds randomly before the led show the no after pressing. i tried it but wasnt satisfied with it. so if anyone could help then please
Lendss says: Jul 24, 2012. 1:04 PM
I built one but it didn't worked well, so i looked
int pinLeds3 = 7;
int pinLed4 = 8;
and in this way my dice don't works well, but with
int pinLed4 = 7;
int pinLeds3 = 8;
it works perfectly.
Probably it's my fault but can you check it?
Thanks a lot
P.S. Awesome project
_-MacGyver-_ says: Jun 21, 2012. 5:47 PM
If you follow the schematic "correctly", this is the proper definition for the program. As my friend so cleverly noticed. Still an epic circut. Time to play RISK

//Led pins
int pinLeds1 = 10;
int pinLeds2 = 9;
int pinLeds3 = 7;
int pinLed4 = 8;
//Button pin
int buttonPin = 6;
int buttonState;
//Ran will be randomized from 1 to 6
long ran;
//Time is the time of delay
int time = 2000;
Davuzz11 (author) in reply to _-MacGyver-_Jun 25, 2012. 9:38 AM
Whoops! Thank you for the correction, i just fixed it!
WakeUpWolfgang says: Dec 19, 2011. 7:37 PM
Very nice instructable it was easy to fallow along and do. I love it! Now I will try to make a shield for it, I will post photos of the shield when I get parts to make the shield.
Davuzz11 (author) in reply to WakeUpWolfgangDec 25, 2011. 10:16 AM
Great idea, and thank you for the interest! Ask if you need some help
WakeUpWolfgang in reply to Davuzz11Dec 25, 2011. 11:34 AM
I got the rest of the parts for it yesterday but we had to use my soldering room for some people to stay over but I should have it done some time this week I will post photos of it when its done.
Davuzz11 (author) in reply to WakeUpWolfgangDec 25, 2011. 1:17 PM
Ok, if you want i can add your photos in the instructable...and Merry Christmas!
FinalTrigger says: Nov 23, 2011. 2:15 PM
Sorry for the noobish question, can someone explain to me whats the significance of :
randomSeed(analogRead(0));
and
ran = random(1, 7);

Much appreciated. By the way this is a fantastic project to learn with.
Davuzz11 (author) in reply to FinalTriggerDec 25, 2011. 10:25 AM
Sorry for the waiting!
" randomSeed(analogRead(0)); " is needed for have a correct randomness (without it, the arduino will use the same sequence every time).
" ran = random(1, 7); " set the variable "ran" equal to a number from 1 to 6, that is the result.
{Havoc}.Goliath in reply to FinalTriggerDec 19, 2011. 8:36 PM
With my limited programming experience im guessing "randomSeed(analogRead(0));" is preparing the program to create a random number and "ran = random(1,7);" is setting ran (a variable?) equal to a random number valued 1 through 7
crob09 says: Dec 25, 2011. 8:55 AM
Very nice!! Just wondering if I can quote you and have some of this information on my website http://www.whatisacnc.com I found this very informative, thank you regardless of your decision.
Davuzz11 (author) in reply to crob09Dec 25, 2011. 10:14 AM
Sure you can quote my instructable! Thank you for the interest, and happy Christmas :D !
kloptops says: Jan 28, 2011. 1:48 AM
Nice design, however i decided to make the display routine a bit more interesting with it showing a "random" sequence before displaying the final result.

Thanks for the great starter project.

http://dl.dropbox.com/u/7992054/arduino/Dice.pde
fwanderwrwr in reply to kloptopsSep 20, 2011. 1:48 AM
Great improvement! :)
Paul Smith says: Jan 16, 2010. 6:07 PM
How do you overcome the fact the the random function in the arduino always uses the same sequence of random numbers, thus making it predictable?
anand-patel in reply to Paul SmithJun 15, 2011. 5:03 PM
ftp
Davuzz11 (author) in reply to Paul SmithJan 17, 2010. 6:35 AM
You can overcome this fact simply putting in the Setup function this line code:
randomSeed(analogRead(0));

However, this line code is already present in the complete code of the instructables.
mazmoiz says: Dec 7, 2010. 1:15 AM
Hi, can you plz tell me the name of the software in which you have created this schematic ? thanks alot, Maz
Davuzz11 (author) in reply to mazmoizDec 7, 2010. 9:32 AM
The software that i use is Fritzing, you can download it here: http://fritzing.org/download/ .
It also has the stardard layout of the arduino!
cdousley says: Jun 23, 2010. 2:41 PM
if i programmed an atmega with arduino then removed the atmega from the arduino board and hooked it up would it work or do i need to hook up a crystal to it.
Davuzz11 (author) in reply to cdousleyJun 24, 2010. 12:27 AM
Yes, if you detach the atMega (be careful) you can use it in a breadboard, but every time you need to program it, you have to reinsert the atMega on the Arduino board. However, here is explained how to do it: http://www.instructables.com/id/Standalone-Arduino-ATMega-chip-on-breadboard/
cdousley in reply to Davuzz11Jun 26, 2010. 10:28 AM
ok thanks for your help.
BenStep42 says: Feb 22, 2010. 12:13 PM
I'm new to the microcontroller game, but arduino seems to be the best fit for what I want to do as far as controlling led patterns and such.. Can the arduino set up a continuous lighting sequence for led's and then be disconnected and run the same?  I mean can I program a sequence for a project and have the led's remember the code without the arduino still connected?
cdousley in reply to BenStep42Apr 7, 2010. 10:55 AM
you cant do that but for your idea you could use an  atmel atmega(the mictrocontroler on the arduino) the arduino is best for prototyping once you get it made you can use the armega
NXTreme in reply to BenStep42Mar 16, 2010. 11:17 AM
Another really great easy to program microcontroller is the PICAXE. If you just want to blink a couple LEDs a 08M would be perfect. While the Arduino is probably more powerful ect. the PICAXE is really easy to program and they are super cheap. Just an idea.
Davuzz11 (author) in reply to BenStep42Mar 5, 2010. 9:31 AM
Sorry for the waiting!
However, you cannot run the sequence of led's disconnecting Arduino, simply because the sequence is done by the Arduino.
If your problem is keep attacking Arduino to your computer, you can connect a 9 volt battery and make Arduino "portable".
If you want to program the sequence without Arduino because it occupies too much space, you can use another microcontroller, like Picaxe or Atmel, which are very small and they can be used in the breadboard.
darkesthour in reply to BenStep42Mar 4, 2010. 8:02 PM
 The Microcontroller itself has to still be on the board. But you can disconnect it from your computer and power say with a 9 volt battery or wall wart of sorts.
cdousley says: Apr 5, 2010. 6:41 PM
This is great! this is my first arduino project and it worked perfectly the numbers were random and it rolled great.
100_0868.JPG
electronics4you says: Mar 27, 2010. 3:30 AM
Hi Everyone,
I built this project today and came across an error in the code. According to the circuit diagram, the pin configuration should be this:
int pinLeds3 = 7;
int pinLed4 = 8;

It's written the other way around in the downloadable pde of this instructable.
Hope this was helpful..!

crzy engineer says: Feb 7, 2010. 6:10 PM


Perfect!

CIMG1472.JPG
Axaj says: Dec 2, 2009. 3:01 PM
Dice is plural, die is singular.
Davuzz11 (author) says: Nov 16, 2009. 5:45 AM
Thanks to all!
oscarthompson says: Nov 14, 2009. 1:26 PM

brilliant!... Im just beging the kind of stuff (thanks to Maplins™, the electronics specialist!)

LuminousObject says: Nov 14, 2009. 1:17 PM
Awesome. I like the shaking dice one.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!