Queue machine 1 counter with seven segment with 3 digit display and sound queue output. The counter clerk presses the NEXT key to dial the queue number, simultaneously 7 segment will displays queue number and extra queue number sound.
There are 2 buttons, the first is the NEXT button that is the key to call the next queue number, while the 2nd key to repeat the call without adding the queue number. Seven segment displays queue sequence. Sound is generated from IC ISD17xx, voice queue number recorded on the IC then Arduino access address of voice number using SPI communication.
Hardware Requirement
- Arduino Uno Board
- 3 Digit of 7-Segment with Common Anode
- Modul ISD 17xx (ISD 17180 is recomended)
- Speaker 0.5W 80 Ohm
- 2 Push Button
- Power supply +5 Volt
- Jumper
ISD 17180 | Source
Block Diagram
Schematic
7-Segment CA Wiring | Source
Arduino - 7 Segment Wiring
Arduino - Buttons Wiring
Arduino - ISD Wiring
Source Code/Sketch
#include <ISD1700.h>
#define tbLoketNext A4
#define tbLoketR A5
ISD1700 chip(10); // Initialize chipcorder with
// SS at Arduino's digital pin 10
int apc=0;
int vol=0; //volume 0=MAX, 7=min
int startAddr=0x10;
int endAddr =0x2DF;
char angka;
byte rat,pul,sat,Next;
byte f_noUrut,f_rat,f_pul;
word tunda;
word noAntri=0;
long lastButton = 0;
long delayAntiBouncing = 50;
byte seven_seg_digits[10][7] = { { 0,0,0,0,0,0,1 }, // = 0
{ 1,0,0,1,1,1,1 }, // = 1
{ 0,0,1,0,0,1,0 }, // = 2
{ 0,0,0,0,1,1,0 }, // = 3
{ 1,0,0,1,1,0,0 }, // = 4
{ 0,1,0,0,1,0,0 }, // = 5
{ 0,1,0,0,0,0,0 }, // = 6
{ 0,0,0,1,1,1,1 }, // = 7
{ 0,0,0,0,0,0,0 }, // = 8
{ 0,0,0,0,1,0,0 }, // = 9
};
void setup(){
apc = apc | vol; //D0, D1, D2
apc = apc | 0x50; // D4& D6 select MIC REC
apc = apc | 0x80; // D7 AUX ON, comment enable AUD
apc = apc | 0x100; // D8 SPK OFF, comment enable SPK
apc = apc | 0x800; // D11 EOM ON, comment disable EOM
for(char i=2; i<9; i++){
pinMode(i,OUTPUT);
}
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
pinMode(A2,OUTPUT);
pinMode(tbLoketNext,INPUT);
pinMode(tbLoketR,INPUT);
digitalWrite(tbLoketNext,HIGH);
digitalWrite(tbLoketR,HIGH);
}
void loop(){
/******************
'*'ANTRIAN NOMOR
'1'SATU
'9'SEMBILAN
'A'SEPULUH
'B'SEBELAS
'C'BELAS
'D'PULUH
'E'RATUS
'F'SERATUS
*****************/
rat=noAntri/100;
pul=(noAntri%100)/10;
sat=(noAntri%100)%10;
tampil7Segment();
if (digitalRead(tbLoketNext)==0){
if ((millis() - lastButton) > delayAntiBouncing){
tunda=0;
noAntri++;
Next=1;
f_noUrut=0;
f_rat=0;
f_pul=0;
}
lastButton = millis();
}
else if(digitalRead(tbLoketR)==0){
if ((millis() - lastButton) > delayAntiBouncing){
tunda=0;
Next=1;
f_noUrut=0;
f_rat=0;
f_pul=0;
}
lastButton = millis();
}
if (Next==1){
if (f_noUrut==0) gotoISD_noUrut();
else if (f_noUrut==1 && f_rat==0)gotoISD_rat();
else if (f_rat==1 && f_pul==0)gotoISD_pul();
else if (f_pul==1)gotoISD_sat();
}
}
//=========================================
void gotoISD_noUrut(){
if(tunda==0 && f_noUrut==0){
angka='*';
data_ISD();
f_noUrut=1;
}
}
//=============================ratusan
void gotoISD_rat(){
//--------------200,300,400....dst
if (rat>1 && f_rat==0){
if (tunda==120){
angka=rat;
data_ISD();
}
else if (tunda==180){
angka='E';
data_ISD();
f_rat=1;
tunda=0;
}
}
//--------------100
else if(rat==1 && pul==0 && sat==0 && f_rat==0 && tunda==120){
angka='F';
data_ISD();
Next=0;
}
//--------------seratusan
else if(rat==1 && f_rat==0 && tunda==120){
angka='F';
data_ISD();
f_rat=1;
tunda=0;
}
//--------------ratusan=0
else if (rat==0 && f_rat==0 && tunda==120){
f_rat=1;
tunda=0;
}
}
//================================puluhan
void gotoISD_pul(){
//----------22 s/d 29, 32 s/d 39.....dst
if(pul>1 && sat>1 && f_pul==0){
if(tunda==60){
angka=pul;
data_ISD();
}
else if(tunda==120){
angka='D';
data_ISD();
f_pul=1;
tunda=0;
}
}
//--------------------12 s/d 19
else if(pul>0 && sat>1 && f_pul==0){
if(tunda==60){
angka=sat;
data_ISD();
}
else if(tunda==120){
angka='C';
data_ISD();
f_pul=1;
tunda=0;
}
}
//--------------sebelas
else if(pul==1 && sat==1 && f_pul==0 && tunda==60){
angka='B';
data_ISD();
f_pul=1;
tunda=0;
}
//--------------sepuluh
else if(pul==1 && f_pul==0 && tunda==60){
angka='A';
data_ISD();
f_pul=1;
tunda=0;
}
//--------------20,21,30,31,40,41....dst
else if(pul>1 && sat>=0 && f_pul==0){
if(tunda==60){
angka=pul;
data_ISD();
}
else if(tunda==120){
angka='D';
data_ISD();
f_pul=1;
tunda=0;
}
}
//----------101 s/d 109, 201 s/d 209...dst
else if(pul==0 && sat>0 && tunda==60){
angka=sat;
data_ISD();
Next=0;
}
}
//=================================satuan
void gotoISD_sat(){
//---------------1 s/d 9
if(sat>0 && pul!=1 && tunda==60){
angka=sat;
data_ISD();
Next=0;
}
}
//==============================data ISD
void data_ISD(){
switch(angka){
chip.pu();
case '*':
chip.pu();
startAddr=0x15;
endAddr =0x1E;
chip.set_play(startAddr,endAddr);
break;
case 1:
//------------SATU
chip.pu();
startAddr=0x21;
endAddr =0x24;
chip.set_play(startAddr,endAddr);
break;
case 2:
//-------------DUA
chip.pu();
startAddr=0x29;
endAddr =0x2C;
chip.set_play(startAddr,endAddr);
break;
case 3:
//-------------TIGA
chip.pu();
startAddr=0x30;
endAddr =0x33;
chip.set_play(startAddr,endAddr);
break;
case 4:
//------------EMPAT
chip.pu();
startAddr=0x38;
endAddr =0x3A;
chip.set_play(startAddr,endAddr);
break;
case 5:
//------------LIMA
chip.pu();
startAddr=0x3F;
endAddr =0x41;
chip.set_play(startAddr,endAddr);
break;
case 6:
//------------ENAM
chip.pu();
startAddr=0x46;
endAddr =0x49;
chip.set_play(startAddr,endAddr);
break;
case 7:
//------------TUJUH
chip.pu();
startAddr=0x4E;
endAddr =0x50;
chip.set_play(startAddr,endAddr);
break;
case 8:
//------------DELAPAN
chip.pu();
startAddr=0x55;
endAddr =0x58;
chip.set_play(startAddr,endAddr);
break;
case 9:
//------------SEMBILAN
chip.pu();
startAddr=0x5D;
endAddr =0x60;
chip.set_play(startAddr,endAddr);
break;
case 'A':
//------------SEPULUH
chip.pu();
startAddr=0x65;
endAddr =0x68;
chip.set_play(startAddr,endAddr);
break;
case'B':
//------------SEBELAS
chip.pu();
startAddr=0x6D;
endAddr =0x70;
chip.set_play(startAddr,endAddr);
break;
case'C':
//------------BELAS
chip.pu();
startAddr=0x75;
endAddr =0x78;
chip.set_play(startAddr,endAddr);
break;
case'D':
//------------PULUH
chip.pu();
startAddr=0x7C;
endAddr =0x80;
chip.set_play(startAddr,endAddr);
break;
case'E':
//------------RATUS
chip.pu();
startAddr=0x84;
endAddr =0x88;
chip.set_play(startAddr,endAddr);
break;
case'F':
//------------SERATUS
chip.pu();
startAddr=0x8D;
endAddr =0x90;
chip.set_play(startAddr,endAddr);
break;
}
}
void tampil7Segment(){
if(rat>0){
digitalWrite(A0,LOW); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH);
sevenSegWrite(rat);
delay(5);
}
if(pul>0 || rat>0){
digitalWrite(A0,HIGH); digitalWrite(A1,LOW);
digitalWrite(A2,HIGH);
sevenSegWrite(pul);
delay(5);
}
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,LOW);
sevenSegWrite(sat);
delay(5);
tunda++;
}
void sevenSegWrite(byte segment){
byte pin = 2;
for (byte segCount = 0; segCount < 7; ++segCount) {
digitalWrite(pin, seven_seg_digits[segment][segCount]);
++pin;
}
}
#define tbLoketNext A4
#define tbLoketR A5
ISD1700 chip(10); // Initialize chipcorder with
// SS at Arduino's digital pin 10
int apc=0;
int vol=0; //volume 0=MAX, 7=min
int startAddr=0x10;
int endAddr =0x2DF;
char angka;
byte rat,pul,sat,Next;
byte f_noUrut,f_rat,f_pul;
word tunda;
word noAntri=0;
long lastButton = 0;
long delayAntiBouncing = 50;
byte seven_seg_digits[10][7] = { { 0,0,0,0,0,0,1 }, // = 0
{ 1,0,0,1,1,1,1 }, // = 1
{ 0,0,1,0,0,1,0 }, // = 2
{ 0,0,0,0,1,1,0 }, // = 3
{ 1,0,0,1,1,0,0 }, // = 4
{ 0,1,0,0,1,0,0 }, // = 5
{ 0,1,0,0,0,0,0 }, // = 6
{ 0,0,0,1,1,1,1 }, // = 7
{ 0,0,0,0,0,0,0 }, // = 8
{ 0,0,0,0,1,0,0 }, // = 9
};
void setup(){
apc = apc | vol; //D0, D1, D2
apc = apc | 0x50; // D4& D6 select MIC REC
apc = apc | 0x80; // D7 AUX ON, comment enable AUD
apc = apc | 0x100; // D8 SPK OFF, comment enable SPK
apc = apc | 0x800; // D11 EOM ON, comment disable EOM
for(char i=2; i<9; i++){
pinMode(i,OUTPUT);
}
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
pinMode(A2,OUTPUT);
pinMode(tbLoketNext,INPUT);
pinMode(tbLoketR,INPUT);
digitalWrite(tbLoketNext,HIGH);
digitalWrite(tbLoketR,HIGH);
}
void loop(){
/******************
'*'ANTRIAN NOMOR
'1'SATU
'9'SEMBILAN
'A'SEPULUH
'B'SEBELAS
'C'BELAS
'D'PULUH
'E'RATUS
'F'SERATUS
*****************/
rat=noAntri/100;
pul=(noAntri%100)/10;
sat=(noAntri%100)%10;
tampil7Segment();
if (digitalRead(tbLoketNext)==0){
if ((millis() - lastButton) > delayAntiBouncing){
tunda=0;
noAntri++;
Next=1;
f_noUrut=0;
f_rat=0;
f_pul=0;
}
lastButton = millis();
}
else if(digitalRead(tbLoketR)==0){
if ((millis() - lastButton) > delayAntiBouncing){
tunda=0;
Next=1;
f_noUrut=0;
f_rat=0;
f_pul=0;
}
lastButton = millis();
}
if (Next==1){
if (f_noUrut==0) gotoISD_noUrut();
else if (f_noUrut==1 && f_rat==0)gotoISD_rat();
else if (f_rat==1 && f_pul==0)gotoISD_pul();
else if (f_pul==1)gotoISD_sat();
}
}
//=========================================
void gotoISD_noUrut(){
if(tunda==0 && f_noUrut==0){
angka='*';
data_ISD();
f_noUrut=1;
}
}
//=============================ratusan
void gotoISD_rat(){
//--------------200,300,400....dst
if (rat>1 && f_rat==0){
if (tunda==120){
angka=rat;
data_ISD();
}
else if (tunda==180){
angka='E';
data_ISD();
f_rat=1;
tunda=0;
}
}
//--------------100
else if(rat==1 && pul==0 && sat==0 && f_rat==0 && tunda==120){
angka='F';
data_ISD();
Next=0;
}
//--------------seratusan
else if(rat==1 && f_rat==0 && tunda==120){
angka='F';
data_ISD();
f_rat=1;
tunda=0;
}
//--------------ratusan=0
else if (rat==0 && f_rat==0 && tunda==120){
f_rat=1;
tunda=0;
}
}
//================================puluhan
void gotoISD_pul(){
//----------22 s/d 29, 32 s/d 39.....dst
if(pul>1 && sat>1 && f_pul==0){
if(tunda==60){
angka=pul;
data_ISD();
}
else if(tunda==120){
angka='D';
data_ISD();
f_pul=1;
tunda=0;
}
}
//--------------------12 s/d 19
else if(pul>0 && sat>1 && f_pul==0){
if(tunda==60){
angka=sat;
data_ISD();
}
else if(tunda==120){
angka='C';
data_ISD();
f_pul=1;
tunda=0;
}
}
//--------------sebelas
else if(pul==1 && sat==1 && f_pul==0 && tunda==60){
angka='B';
data_ISD();
f_pul=1;
tunda=0;
}
//--------------sepuluh
else if(pul==1 && f_pul==0 && tunda==60){
angka='A';
data_ISD();
f_pul=1;
tunda=0;
}
//--------------20,21,30,31,40,41....dst
else if(pul>1 && sat>=0 && f_pul==0){
if(tunda==60){
angka=pul;
data_ISD();
}
else if(tunda==120){
angka='D';
data_ISD();
f_pul=1;
tunda=0;
}
}
//----------101 s/d 109, 201 s/d 209...dst
else if(pul==0 && sat>0 && tunda==60){
angka=sat;
data_ISD();
Next=0;
}
}
//=================================satuan
void gotoISD_sat(){
//---------------1 s/d 9
if(sat>0 && pul!=1 && tunda==60){
angka=sat;
data_ISD();
Next=0;
}
}
//==============================data ISD
void data_ISD(){
switch(angka){
chip.pu();
case '*':
chip.pu();
startAddr=0x15;
endAddr =0x1E;
chip.set_play(startAddr,endAddr);
break;
case 1:
//------------SATU
chip.pu();
startAddr=0x21;
endAddr =0x24;
chip.set_play(startAddr,endAddr);
break;
case 2:
//-------------DUA
chip.pu();
startAddr=0x29;
endAddr =0x2C;
chip.set_play(startAddr,endAddr);
break;
case 3:
//-------------TIGA
chip.pu();
startAddr=0x30;
endAddr =0x33;
chip.set_play(startAddr,endAddr);
break;
case 4:
//------------EMPAT
chip.pu();
startAddr=0x38;
endAddr =0x3A;
chip.set_play(startAddr,endAddr);
break;
case 5:
//------------LIMA
chip.pu();
startAddr=0x3F;
endAddr =0x41;
chip.set_play(startAddr,endAddr);
break;
case 6:
//------------ENAM
chip.pu();
startAddr=0x46;
endAddr =0x49;
chip.set_play(startAddr,endAddr);
break;
case 7:
//------------TUJUH
chip.pu();
startAddr=0x4E;
endAddr =0x50;
chip.set_play(startAddr,endAddr);
break;
case 8:
//------------DELAPAN
chip.pu();
startAddr=0x55;
endAddr =0x58;
chip.set_play(startAddr,endAddr);
break;
case 9:
//------------SEMBILAN
chip.pu();
startAddr=0x5D;
endAddr =0x60;
chip.set_play(startAddr,endAddr);
break;
case 'A':
//------------SEPULUH
chip.pu();
startAddr=0x65;
endAddr =0x68;
chip.set_play(startAddr,endAddr);
break;
case'B':
//------------SEBELAS
chip.pu();
startAddr=0x6D;
endAddr =0x70;
chip.set_play(startAddr,endAddr);
break;
case'C':
//------------BELAS
chip.pu();
startAddr=0x75;
endAddr =0x78;
chip.set_play(startAddr,endAddr);
break;
case'D':
//------------PULUH
chip.pu();
startAddr=0x7C;
endAddr =0x80;
chip.set_play(startAddr,endAddr);
break;
case'E':
//------------RATUS
chip.pu();
startAddr=0x84;
endAddr =0x88;
chip.set_play(startAddr,endAddr);
break;
case'F':
//------------SERATUS
chip.pu();
startAddr=0x8D;
endAddr =0x90;
chip.set_play(startAddr,endAddr);
break;
}
}
void tampil7Segment(){
if(rat>0){
digitalWrite(A0,LOW); digitalWrite(A1,HIGH);
digitalWrite(A2,HIGH);
sevenSegWrite(rat);
delay(5);
}
if(pul>0 || rat>0){
digitalWrite(A0,HIGH); digitalWrite(A1,LOW);
digitalWrite(A2,HIGH);
sevenSegWrite(pul);
delay(5);
}
digitalWrite(A0,HIGH); digitalWrite(A1,HIGH);
digitalWrite(A2,LOW);
sevenSegWrite(sat);
delay(5);
tunda++;
}
void sevenSegWrite(byte segment){
byte pin = 2;
for (byte segCount = 0; segCount < 7; ++segCount) {
digitalWrite(pin, seven_seg_digits[segment][segCount]);
++pin;
}
}
How it Works
1. Connect the Arduino with Peripherals needed.
2. Plug in the Power Source on the device.
3. Add some library if needed
4. Compile and upload the script program above to your arduino.5. The first display on the seven segment
6. Press the Next button, so the queue number increases 1 and ISD issues a queue noise According to
the one in the display
6. Press the Return button to redial the queue number without adding the queue sequence number.
Video for Project I - 13. Queue Machine (1 Counters) with 7 Segment Display Based on Arduino
Requred file
No comments:
Post a Comment