7-Segment LED Die with Arduino PART NO. 2190194 This project is based on the Arduino environment so that you can manipulate a die with a simple common anode 7-segment LED, a transistor PNP-2N3906, 10 resistors and a mini switch for control. http://www.instructables.com/id/7-Segment-LED-Die-wArduino/ Watch the video at: http://www.youtube.com/watch?v=-kSp8QqmcOc Time Required: 5 hours depending on experience Experience Level: Intermediate Required tools and parts: Arduino Uno Soldering Iron Solder Helping Hands Wire Cutters/Strippers Needle Nose Pliers 1 meter of wire #22 Bill of Materials: Qty Jameco SKU Component Name 1 2152438 SHIELD,ARDUINO PROTO PCB,REV3,1.0 PINOUT It's the base for this project. 1 160882 Connector Unshrouded Header 40 Position 2.54mm Solder Straight Thru-Hole Vital for mounting your project on Arduino hardware. 1 335090 Single Digit 7-Segment LED Display Fundamental part for the project so that you can see the result obtained of manipulating a die. 8 690697 RESISTOR,CARBON FILM,200K OHM,1/4 WATT,5%,(10 BAG) Needful part to protect the 7-segment LED display 1 690865 RESISTOR,CARBON FILM,1K OHM,1/4 WATT,5%,(100 BAG Needful to protect the base of your transistor 2N3906 1 661757 RESISTOR,CARBON FILM,10K OHM,1/2 WATT,5%,(100 BAG) Vital to ground the mini switch and the digital pin of your Arduino that is common to your mini switch and this component. 1 38375 Transistor 2N3906 PNP General Purpose Fundamental to control the 7-segment LED display from your Arduino hardware 1 119011 Switch Tactile ON OFF Single Pole, Single Throw Round Button PC Pins 0.05A 12 Volt Thru-Hole Vital to manipulate your project Step 1 - List of materials (1) Shield, Arduino Proto PCB, Rev.3 (1) 40 position header, 0.1" spacing (1) Single Digit 7-Segment LED Display (8) 200 ohm resistor, 1/4 watt (1) 1K ohm resistor, 1/4 watt (1) 10K ohm resistor, 1/2 watt (1) Transistor, 2N3906, PNP (1) Switch, tactile ON OFF SPST Round Button Step 2 - Identify Transistor ends You should identify the transistor leads for proper connection. Step 3 - Identify Mini-Switch Pins It's useful to know how to connect the mini-switch of your project. Identify how to connect your mini-switch, that is, you only need to connect the pins of conection: the closest pins that you can see on the photo. Step 4 - Diagram of Project Observe the connections to your switch and transistor, but you should also observe the Arduino connections because the Analog pins is a continuation of Digital pins. For example, A0=D14, A1=D15........................A5=A19. Step 5 - Insert the Pins in your Arduino Hardware Insert the following pins in your Arduino hardware: cut 4 pins for A0, A1, A2, A3, cut 2 pins for D6, D7, cut 4 pins for D8, D9, D10, D11 and cut 2 pins for GND, 5V Step 6 - Mount the PCB on your Arduino Mount your PCB on the Arduino hardware by matching exactly with the pins inserted in your Arduino with the PCB. Identify the same letters and numbers for inserting correctly. For example, A0 with A0, A1 with A1, etc. Step 7 - Solder the Visible Ends Solder the visible ends to complete this step. Step 8 - Dismount the PCB Dismount the PCB so that you can observe the result of the prior step. Step 9 - Mount the 7-Segment LED Display Mount the 7-Segment LED Display on your PCB. Step 10 - Solder the Ends of your LED Display Solder the ends of the 7-segment LED display mounted previously. Step 11 - Connect the Resistors of 200 ohm Connect and solder the resistors of 200 ohm to the pins of your display. Step 12 - Mount the Mini Switch Mount and solder the Mini Switch on your PCB to D11 and 5V. Step 13 - Install the Resistor of 10K ohm Connect the resistor of 10K ohm to GND and the mini switch according to the schematic. Step 13 - Install the Resistor of 10K ohm Step 14 - Install the Transistor 2N3906 Install and solder the transistor 2N3906 on your PCB. Step 15 - Install the Resistor of 1K ohm Connect the resistor of 1K ohm to the base of your transistor 2N3906 and D10. Step 16 - Complete your Project For completing this project, write the Arduino program in your computer. The following program is what you need so that your project works: (copy the text below into your Arduino IDE) //Program for 7-Segment LED Die (Red) int segmentPins[] = { 15, 14, 8, 7, 6, 16, 17, 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]); } }