# Arduino Led Dice - دائرة النرد الاليكترونى

41

## Introduction: Arduino Led Dice - دائرة النرد الاليكترونى

This experiment provides basic guidelines on how to build basic electronic circuits and algorithms by using Arduino and fundamental electronic hardware. Basically our goal is to:
- Create and build electronic curcuits on breadboard using a well-known components.
- Understand the programming process using Arduino and create new functions to make simple and fun experiment.

Introduction:
This circuit can be implemented by using a few components, students can learning how to control LEDs to simulate the behaviour of dice (e.g.1, 2, 3, 4, 5, 6 ). Its an easy and fun project suitable for beginners who start with arduino.

### Supplies:

Basic Components:
1- Arduino Nano (Atmega 328p).
2- 7 LEDs (Same color).
4- PCB Board.
5- Wires (male-male, male-female)
6- Iron 60W.
7- Digital Multi-meter.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Basic Concept

The basic idea to simulate a dice by creating all the six faces of a dice using 7 LEDs, placed in the shape of an "H".

## Step 2: Connect the LEDs With Arduino

The important idea for using Arduino (of any kind) with LEDs is to connect the LEDs with digital output in Arduino.
Since Arduino Nano has 12 digital outputs from (D2 to D13), for example if we want to use 12 LEDs or less the number of digital outputs is enough. But in case of using more than 12 LEDs in other circuits, we should divide the total number of LEDs into groups. Where in each group (function) is connected to a digital output pin.

## Step 3: LEDs Connected in Pairs

As shown in the figure, the LEDs are not connected directly to Arduino pins, they are connected in pairs to facilitate their use.
To create all the faces of the dice, you must follow these rules:
● Number 1 of the dice: light up the group 4.
● Number 2 of the dice: light up the group 3.
● Number 3 of the dice: light up the group 3 & 4.
● Number 4 of the dice: light up the groups 1 & 2.
● Number 5 of the dice: light up the groups 1, 2 & 4.
● Number 6 of the dice: light up the groups 1, 2 & 3.

## Step 5: Dice Circuit Diagram

Dividing the LEDs into pairs:
Now to going to next step "Programming" we should record the input of each pairs of LEDs to connect them to digital outputs in Arduino as follows:
○ Group LEDs No 2 : LED (A), link with D10 in Arduino.
○ Group LEDs No 1 : LED (B), link with D9 in Arduino.
○ Group LEDs No 4 : LED (D), link with D8 in Arduino.
○ Group LEDs No 3 : LED (C), link with D7 in Arduino.
○ Yellow wire color indicate to GND.

## Step 6: Exercise1 : LEDs Dice Program (Motion Primitives)

Goal: Write a code to run the dice in order mode sequence (from number 1 to number 6)

## Step 7: Exercise 2: LEDs Dice Program (Random Mode Sequence)

Goal: Write a code to run the Dice in random mode using the same circuit diagram.

11 573
102 22K
34 10K