Introduction: 7-Segment LED Die W/Arduino and More

This project is based on arduino environment so that you can manipulate a die with a simple 7-segment LED and mini switch of control.
Watch the video at: http://www.youtube.com/watch?v=-kSp8QqmcOc

Important note: I did an error because I wrote 2N3904 instead of 2N3906 for the transistor used in this project.

Step 1: Bill of Materials

1 PROTOBOARD, 2.5"x4.25", 640 HOLES, PLATED THRU-HOLE
or  1 Photoshield kit for arduino
1 Connector Unshrouded Header 40 Position 2.54mm Solder Straight Thru-Hole
8 RESISTOR,CARBON FILM,200 OHM,1/4 WATT,5%
1 RESISTOR,CARBON FILM,1K OHM,1/4 WATT,5%
1 RESISTOR,CARBON FILM,10K OHM,1/4 WATT,5%
1 Switch Tactile ON OFF Single Pole
1 Transistor 2N3906
1 Common anode Seven-segment LED 

Step 2: Project's Diagram

Observe your diagram so that you can correctly began and finish your project. 

Important note: it's not 2N3904 but 2N3906 the transistor used in this project.

Step 3: Install the Pins

In this step, need to install the pins of connection to your arduino by inserting them in your arduino, first, and then you should mount the PCB by matching with the pins so that you can exactly solder where it should be.  Once you do that, you can dismount the PCB of your arduino so that you can see it with the pins up.

Step 4: Install LED Display

In this step, install the LED display and its resistors of 200 ohm.

Step 5: Install the Transistor, Switch and Resistors

Install the transistor, switch and the resistor of 1K and of 10K so that you can complete your project.

Step 6: Upload Program and Probe Your Project

//Program for this project
int segmentPins[] = { 2, 3, 4, 5, 6, 7, 8, 9 };
int displayPins[] = {10};
int buttonPin = 11;
byte digits[10][8] = {
// a b c d e f g .
{ 1, 1, 1, 1, 1, 1, 0, 0}, // 0
{ 0, 1, 1, 0, 0, 0, 0, 0}, // 1
{ 1, 1, 0, 1, 1, 0, 1, 0}, // 2
{ 1, 1, 1, 1, 0, 0, 1, 0}, // 3
{ 0, 1, 1, 0, 0, 1, 1, 0}, // 4
{ 1, 0, 1, 1, 0, 1, 1, 0}, // 5
{ 1, 0, 1, 1, 1, 1, 1, 0}, // 6
{ 1, 1, 1, 0, 0, 0, 0, 0}, // 7
{ 1, 1, 1, 1, 1, 1, 1, 0}, // 8
{ 1, 1, 1, 1, 0, 1, 1, 0} // 9
};
void setup()
{
for (int i=0; i < 8; i++)
{
pinMode(segmentPins[i], OUTPUT);
}
pinMode(displayPins[0], OUTPUT);
pinMode(displayPins[0], OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
static int dice;
if (digitalRead(buttonPin))
{
dice = random(1,7);

}
updateDisplay(dice);
}
void updateDisplay(int value1)
{
digitalWrite(displayPins[0], HIGH);
digitalWrite(displayPins[1], LOW);
setSegments(value1);
delay(5);
digitalWrite(displayPins[0], LOW);
digitalWrite(displayPins[1], HIGH);
delay(5);
}
void setSegments(int n)
{
for (int i=0; i < 8; i++)
{
digitalWrite(segmentPins[i], ! digits[n][i]);
}
}
//You only do copy and paste if you exactly follow this project even this note

Step 7: Now, a Program for Generating Random Numbers From 0-9

//Program for Generating Random Numbers from 0—9 (Blue) 
// Note: If you project stops of working, you can push the button of your arduino's switch for initializing newly
int segmentPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
int displayPins[] = {10};
int buttonPin = 11;
byte digits[10][8] = {
// a b c d e f g .
{ 1, 1, 1, 1, 1, 1, 0, 0}, // 0
{ 0, 1, 1, 0, 0, 0, 0, 0}, // 1
{ 1, 1, 0, 1, 1, 0, 1, 0}, // 2
{ 1, 1, 1, 1, 0, 0, 1, 0}, // 3
{ 0, 1, 1, 0, 0, 1, 1, 0}, // 4
{ 1, 0, 1, 1, 0, 1, 1, 0}, // 5
{ 1, 0, 1, 1, 1, 1, 1, 0}, // 6
{ 1, 1, 1, 0, 0, 0, 0, 0}, // 7
{ 1, 1, 1, 1, 1, 1, 1, 0}, // 8
{ 1, 1, 1, 1, 0, 1, 1, 0} // 9
};
void setup()
{
for (int i=0; i < 11; i++)
{
pinMode(segmentPins[i], OUTPUT);
}
pinMode(displayPins[0], OUTPUT);
pinMode(displayPins[0], OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
static int count;
if (digitalRead(buttonPin))
{
count = random(0,10);
}
updateDisplay(count);
}
void updateDisplay(int value1)
{
digitalWrite(displayPins[0], HIGH);
digitalWrite(displayPins[1], LOW);
setSegments(value1);
delay(5);
digitalWrite(displayPins[0], LOW);
digitalWrite(displayPins[1], HIGH);
delay(5);
}
void setSegments(int n)
{
for (int i=0; i < 11; i++)
{
digitalWrite(segmentPins[i], ! digits[n][i]);
}
}

Step 8: And a Program for Generating Thirteen Random Letters From A-U

//Program for Generating Thirteen Random Letters from A—U (Blue) 
int segmentPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
int displayPins[] = {10};
int buttonPin = 11;
byte digits[13][8] = {
// a b c d e f g .
{ 1, 1, 1, 0, 1, 1, 1, 0}, // A
{ 0, 0, 1, 1, 1, 1, 1, 0}, // b
{ 0, 0, 0, 1, 1, 0, 1, 0}, // c
{ 0, 1, 1, 1, 1, 0, 1, 0}, // d
{ 1, 0, 0, 1, 1, 1, 1, 0}, // E
{ 1, 0, 0, 0, 1, 1, 1, 0}, // F
{ 0, 1, 1, 0, 1, 1, 1, 0}, // H
{ 0, 0, 0, 0, 1, 1, 0, 0}, // I
{ 0, 1, 1, 1, 1, 0, 0, 0}, // J
{ 0, 0, 0, 1, 1, 1, 0, 0}, // L
{ 1, 1, 1, 1, 1, 1, 0, 0}, // O
{ 1, 1, 0, 0, 1, 1, 1, 0}, // P
{ 0, 1, 1, 1, 1, 1, 0, 0} // U
};
void setup()
{
for (int i=0; i < 14; i++)
{
pinMode(segmentPins[i], OUTPUT);
}
pinMode(displayPins[0], OUTPUT);
pinMode(displayPins[0], OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
static int count;
if (digitalRead(buttonPin))
{
count = random(0,13);
}
updateDisplay(count);
}
void updateDisplay(int value1)
{
digitalWrite(displayPins[0], HIGH);
digitalWrite(displayPins[1], LOW);
setSegments(value1);
delay(5);
digitalWrite(displayPins[0], LOW);
digitalWrite(displayPins[1], HIGH);
delay(5);
}
void setSegments(int n)
{
for (int i=0; i < 14; i++)
{
digitalWrite(segmentPins[i], ! digits[n][i]);
}
}

Comments

author
braulio777 made it! (author)2016-12-09

This project can be seen in Amazon webpage at:

https://www.amazon.com/s/ref=sr_pg_1?rh=i%3Aaps%2Ck%3Aled+die+with+arduino&keywords=led+die+with+arduino&ie=UTF8&qid=1481316354

author
braulio777 made it! (author)2016-12-09

This project can also be seen in Jameco Electronics at:

http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&productId=2190194&catalogId=10001&CID=CLO

author
braulio777 made it! (author)2016-12-08

LEATHERWORKING classes are now free in this site.

author
braulio777 made it! (author)2016-12-08

PHOTOGRAPHY classes are now free in this site.

author
braulio777 made it! (author)2016-12-08

BREAD classes are now free in this site.

author
braulio777 made it! (author)2016-12-08

CANNING PRESERVING classes are now free in this site.

author
braulio777 made it! (author)2016-12-07

WOODWORKING classes are now free in this site.

author
braulio777 made it! (author)2016-12-07

MEAT classes are now free in this site.

author
braulio777 made it! (author)2016-12-07

CONCRETE classes are now free in this site.

author
braulio777 made it! (author)2016-12-07

GLUE classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

WEARABLE ELECTRONICS classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

RASPBERRY PI classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

LASER CUTTING classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

LAMPS classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

CNC classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

3D PRINTING classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

Robots classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

Electronic classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

LEDS & LIGHTING classes are now free in this site.

author
braulio777 made it! (author)2016-12-06

Arduino classes are now free in this site.

author
braulio777 made it! (author)2016-12-04

A standard die with display is following rules.

author
braulio777 made it! (author)2016-11-30

This project was interesting because I insisted in doing it and finally, I could carry out without problem.

author
braulio777 made it! (author)2016-11-30

This project was one of my first challenges for doing with Arduino.

author
braulio777 made it! (author)2016-11-28

LED die with Arduino is a good challenge so that you can generate numbers from 1 to 6.

author
braulio777 made it! (author)2016-11-28

7_Segment display is an excellent way to show random numbers.

author
braulio777 made it! (author)2016-11-28

Developing a LED dice with Arduino is a good challenge.

author
braulio777 made it! (author)2016-11-28

Generating random numbers with Arduino is an interesting challenge.

author
braulio777 made it! (author)2016-11-28

Random number is interesting issue in electronic circuits.

author
braulio777 made it! (author)2016-11-28

This project is for you.

author
braulio777 made it! (author)2016-11-28

Thank you for viewing this project.

author
braulio777 made it! (author)2016-11-28

I enjoyed developing this project.

About This Instructable

5,410views

12favorites

License:

More by braulio777:Arduino Nano Multiplication/Division SignsA Simple Arduino Clock3 Digit Arduino Binary Counter
Add instructable to: