מכונת הצבעה אלקטרונית עם מודול כרטיס SD

נסה את הכלי שלנו לביטול בעיות





בפוסט זה אנו הולכים לבנות מעגל למכונת הצבעה אלקטרונית באמצעות מודול Arduino וכרטיס SD שבו נתוני הבחירות נשמרים בכרטיס SD.

על ידי



עדכון:

מעגל זה שודרג לגרסה משופרת בה ניתן לצפות בתוצאות על גבי צג LCD צמוד, ניתן לקבל את הפרטים בחלק התחתון של ההודעה

שימוש בתצוגה 16x2 LCD

תצוגה של 16x2 מראה את מצב מכונת ההצבעה וכאשר תצביעו, שם המועמד יוצג יחד עם הפעלת נורית הזמזם.



הערה: הפרויקט המוצע מיועד למטרה חינוכית בלבד ואינו מיועד לשימוש אמיתי בבחירות.

מכונות הצבעה אלקטרוניות מיושמות כדי לזרז את תהליך הבחירות ולהפחית את נייר השימוש והסיבות הללו מצמצמות בעקיפין את ההוצאות הקשורות לבחירות.

מכונות הצבעה אלקטרוניות מספקות אבטחה מעולה לפני שיטת ההצבעה המסורתית בנייר.

הובלת קלפיות אלה היא מסוכנת מאשר הובלת מכונות קומפקטיות, שבהן הונאות לכידת רכב אינן יכולות לשנות את הנתונים ב- EVM (מכונת ההצבעה האלקטרונית) למרות שמסוגל לתפוס את הרכב.

מדינות מסוימות מגלות עניין במכוניות חשמליות מתוצרת הודו בגלל אבטחה מעולה. מדינות כמו ארה'ב עדיין מקפידות על שיטת ההצבעה המסורתית לנייר לבחירותיהן בגלל סיכון גבוה יותר לפריצה ולשינוי נתוני הבחירות.

אז מה גרם להודו להפוך EVMs לבטוחים יותר? ובכן, ארה'ב ייצרה מכונות הצבעה עמוסות במערכת הפעלה של Windows ומרושתות בשרתים כדי להקל על ספירת ההצבעה. זה פותח הרבה פרצות עבור האקרים לשנות את נתוני הבחירות.

רכיבי EVM מתוצרת הודו הם מכשירים עצמאיים ואינם מחוברים לאינטרנט או לשרתים. לספירת הקולות המכונות מועברות לתא ספירה, שם יוכרזו התוצאות ולא איש ביניים.

הפרויקט המוצע תוכנן עם פונקציונליות דומה של EVMs הודי, אך נעשו הרבה שינויים.

עכשיו בואו נעבור לפרטים קונסטרוקטיביים של הפרויקט.

פריסת מעגל:

דיאגרמת פריסת EVM

מעגל ה- EVM המוצע יכול להכיל רק 6 מועמדים. כפתור בקרה מסופק בדומה ליחידת הבקרה במכוניות חשמליות אמיתיות. לאחר שאדם מסיר את הצבעתו, כפתורי ההצבעה מושבתים.

כפתורי ההצבעה מופעלים שוב רק לאחר לחיצה על כפתור הבקרה. כפתור הבקרה יוצב ליד האחראי ששולט בתא הבחירות.

לאחר שאדם הצביע, הוא / ה מודה / ת באמצעות הפעלת נורית הזמזם. האדם יכול גם לאשר את ההצבעה שאליה הוא / היא הציב בתצוגה, זה יראה את שם המועמד או את שם המפלגה למשך כמה שניות. תכונה זו עדיין לא קיימת במכוניות חשמליות אמיתיות.

תרשים סכמטי:

ארדואינו המציג קישוריות:




מעגל EVM של Arduino להצגת קישוריות

המעגל מחולק לשני חלקים כדי למנוע בלבול תוך שכפול הפרויקט. המעגל לעיל מתאר את החיווט בין תצוגת LCD לארדואינו. כוון את הנגד המשתנה לקבלת ניגודיות אופטימלית.

מעגל מכונות הצבעה אלקטרוניות עם מודול כרטיס SD וארדואינו

הנה שאר המעגל המורכב מסוללת 9 וולט, מתג, שבעה לחצני כפתור, נורית, זמזם וחשוב מכך מודול כרטיס SD.

כרטיס ה- SD יאחסן את הנתונים מיד לאחר הצבעת ההצבעה. לאחר סיום הבחירות כרטיס SD מוכנס למחשב כדי להכריז על ספירת הקולות והתוצאה.

התכנון המוצע יכול להקליט עד 4,294,967,295 (שהם יותר מ -4 מיליארד) קולות למועמד ו -25,769,803,770 (יותר מ -25 מיליארד שהם יותר משלוש אנשים מאוכלוסיית העולם הנוכחית) קולות למכונה ועדיין יותר מ -99.9% כרטיס SD עדיין ריק. .

זה הרבה יותר יעיל ממכוניות חשמליות אמיתיות שיכולות להקליט 3840 קולות למכונה.

תכנית:

//--------Program Developed by R.Girish------//
#include
#include
#include
LiquidCrystal lcd(7, 6, 5, 4, 3, 2)
//----------------------------------------------------//
String Party1 = 'MODI'
String Party2 = 'TRUMP'
String Party3 = 'PUTIN' // Place the Candidate Names Here.
String Party4 = 'Abdul Kalam'
String Party5 = 'Girish'
String Party6 = 'Swagatam'
//-----------------------------------------------------//
const int btn_1 = A0
const int btn_2 = A1
const int btn_3 = A2
const int btn_4 = A3
const int btn_5 = A4
const int btn_6 = A5
const int ctrl_btn = 8
const int cs = 10
const int LED = 9
boolean ballot = false
File Party1File
File Party2File
File Party3File
File Party4File
File Party5File
File Party6File
unsigned long int Party1_Count = 0
unsigned long int Party2_Count = 0
unsigned long int Party3_Count = 0
unsigned long int Party4_Count = 0
unsigned long int Party5_Count = 0
unsigned long int Party6_Count = 0
void setup()
{
pinMode(btn_1,INPUT)
pinMode(btn_2,INPUT)
pinMode(btn_3,INPUT)
pinMode(btn_4,INPUT)
pinMode(btn_5,INPUT)
pinMode(btn_6,INPUT)
pinMode(ctrl_btn,INPUT)
pinMode(cs,OUTPUT)
pinMode(LED,OUTPUT)
digitalWrite(btn_1,HIGH)
digitalWrite(btn_2,HIGH)
digitalWrite(btn_3,HIGH)
digitalWrite(btn_4,HIGH)
digitalWrite(btn_5,HIGH)
digitalWrite(btn_6,HIGH)
digitalWrite(ctrl_btn,HIGH)
lcd.begin(16,2)
lcd.clear()
lcd.setCursor(0,0)
lcd.print(' Electronic')
lcd.setCursor(0,1)
lcd.print(' Voting Machine')
delay(2000)
if (!SD.begin(cs))
{
lcd.clear()
lcd.setCursor(0,0)
lcd.print('SD Card failed')
lcd.setCursor(0,1)
lcd.print('or not present')
while(true)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
}
lcd.clear()
lcd.setCursor(0,0)
lcd.print('Machine Status:')
lcd.setCursor(0,1)
lcd.print('Initialized !!!')
digitalWrite(LED,HIGH)
delay(2000)
digitalWrite(LED,LOW)
lcd.clear()
lcd.setCursor(0,0)
lcd.print('Machine is ready')
lcd.setCursor(0,1)
lcd.print('----------------')
while(!ballot)
{
if(digitalRead(ctrl_btn) == LOW)
{
ballot = true
for(int y = 0 y <3 y++)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
lcd.clear()
lcd.setCursor(0,0)
lcd.print('Cast Your Vote')
lcd.setCursor(0,1)
lcd.print('----------------')
}
}
}
void loop()
{
while(ballot)
{
if(digitalRead(btn_1) == LOW)
{
Party_1()
}
if(digitalRead(btn_2) == LOW)
{
Party_2()
}
if(digitalRead(btn_3) == LOW)
{
Party_3()
}
if(digitalRead(btn_4) == LOW)
{
Party_4()
}
if(digitalRead(btn_5) == LOW)
{
Party_5()
}
if(digitalRead(btn_6) == LOW)
{
Party_6()
}
}
}
void Party_1()
{
ballot = false
SD.remove('Party1.txt')
Party1File = SD.open('Party1.txt', FILE_WRITE)
if(Party1File)
{
Party1_Count = Party1_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party1)
Party1File.println('------------------------------------')
Party1File.print('Result for: ')
Party1File.println(Party1)
Party1File.print('------------------------------------')
Party1File.println(' ')
Party1File.print('Number of Votes = ')
Party1File.print(Party1_Count)
Party1File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_2()
{
ballot = false
SD.remove('Party2.txt')
Party2File = SD.open('Party2.txt', FILE_WRITE)
if(Party2File)
{
Party2_Count = Party2_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party2)
Party2File.println('------------------------------------')
Party2File.print('Result for: ')
Party2File.println(Party2)
Party2File.print('------------------------------------')
Party2File.println(' ')
Party2File.print('Number of Votes = ')
Party2File.print(Party2_Count)
Party2File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_3()
{
ballot = false
SD.remove('Party3.txt')
Party3File = SD.open('Party3.txt', FILE_WRITE)
if(Party3File)
{
Party3_Count = Party3_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party3)
Party3File.println('------------------------------------')
Party3File.print('Result for: ')
Party3File.println(Party3)
Party3File.print('------------------------------------')
Party3File.println(' ')
Party3File.print('Number of Votes = ')
Party3File.print(Party3_Count)
Party3File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_4()
{
ballot = false
SD.remove('Party4.txt')
Party4File = SD.open('Party4.txt', FILE_WRITE)
if(Party4File)
{
Party4_Count = Party4_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party4)
Party4File.println('------------------------------------')
Party4File.print('Result for: ')
Party4File.println(Party4)
Party4File.print('------------------------------------')
Party4File.println(' ')
Party4File.print('Number of Votes = ')
Party4File.print(Party4_Count)
Party4File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_5()
{
ballot = false
SD.remove('Party5.txt')
Party5File = SD.open('Party5.txt', FILE_WRITE)
if(Party5File)
{
Party5_Count = Party5_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party5)
Party5File.println('------------------------------------')
Party5File.print('Result for: ')
Party5File.println(Party5)
Party5File.print('------------------------------------')
Party5File.println(' ')
Party5File.print('Number of Votes = ')
Party5File.print(Party5_Count)
Party5File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_6()
{
ballot = false
SD.remove('Party6.txt')
Party6File = SD.open('Party6.txt', FILE_WRITE)
if(Party6File)
{
Party6_Count = Party6_Count + 1
lcd.clear()
lcd.setCursor(0,0)
lcd.print('You voted for:')
lcd.setCursor(0,1)
lcd.print(Party6)
Party6File.println('------------------------------------')
Party6File.print('Result for: ')
Party6File.println(Party6)
Party6File.print('------------------------------------')
Party6File.println(' ')
Party6File.print('Number of Votes = ')
Party6File.print(Party6_Count)
Party6File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Error()
{
lcd.clear()
lcd.setCursor(0,0)
lcd.print('Unable to log')
lcd.setCursor(0,1)
lcd.print('data to SD card')
for(int x = 0 x <100 x++)
{
digitalWrite(LED, HIGH)
delay(250)
digitalWrite(LED, LOW)
delay(250)
}
}
void Tone()
{
digitalWrite(LED, HIGH)
delay(1000)
digitalWrite(LED, LOW)
delay(1500)
lcd.clear()
lcd.setCursor(0,0)
lcd.print(' Thanks for')
lcd.setCursor(0,1)
lcd.print(' Voting!!!')
delay(1500)
lcd.clear()
lcd.setCursor(0,0)
lcd.print(' Not Ready')
lcd.setCursor(0,1)
lcd.print('----------------')
}
void ctrl()
{
while(!ballot)
{
if(digitalRead(ctrl_btn) == LOW)
{
ballot = true
for(int y = 0 y <3 y++)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
lcd.clear()
lcd.setCursor(0,0)
lcd.print('Cast Your Vote')
lcd.setCursor(0,1)
lcd.print('----------------')
}
}
}
//--------Program Developed by R.Girish------//

……… זו תוכנית מסיבית.

כיצד להפעיל את מעגל ה- EVM הזה:

• הפעל את המכונה, היא תאשר בצפצוף המציין שהכל בסדר. אם המכונה לא בסדר, היא מצפצפת במהירות ומציגה את הודעת השגיאה על גבי LCD.
• לחץ על כפתור הבקרה, כעת הוא מוכן להקליט קול אחד.
לאחר שההצבעה תוקלט היא תפעיל נורית LED ותצפצף לרגע ותציג את שם המועמד אליו הצבעת למשך שניות.
• כדי להקליט את ההצבעה הבאה יש ללחוץ שוב על כפתור הבקרה. בכל פעם שלוחצים על כפתור הבקרה, הבאזר נותן 3 צפצופים קצרים.
• יש להמשיך בכך עד שהמצביע האחרון הצביע. אין צורך ללחוץ על כפתור השליטה לאחר שהמצביע האחרון מחליט את ההצבעה.
• לאחר הגשת ההצבעה האחרונה, יש לכבות את המכונה באופן מיידי באמצעות מתג כיבוי ולהסיר את כרטיס ה- SD. כדי שלא ישתנו נתונים.
• חבר את כרטיס ה- SD למחשב ותוכל לראות 6 קבצי טקסט כמוצג להלן:

תוצאת כרטיס SD המאוחסנת במחשב

פתיחת קובץ תציג את שם המועמד ומספר ההצבעה, כפי שמוצג להלן:

אב הטיפוס של המחבר:

איור של מודול כרטיס SD:

הערה 1: כל הפרעה באספקת החשמל תאפס את ספירת הקולות לאפס.
הערה 2: אנא שנה את שם המועמד בתוכנית.
מחרוזת Party1 = 'MODI'
מחרוזת Party2 = 'TRUMP'
Party String3 = 'PUTIN' // הצב כאן את שמות המועמדים.
מפלגת מיתרים 4 = 'עבדול קאלאם'
מחרוזת מפלגה 5 = 'גירית'
Party String6 = 'Swagatam'
הערה 3: אם אין הצבעה למפלגה / מועמד מסוים קובץ הטקסט לא יופיע בכרטיס ה- SD.

שדרוג העיצוב הנ'ל

את הגרסה המשודרגת המסוימת הזו של פרויקט מכונות ההצבעה האלקטרונית ביקש סומש צ'וראסיה, שהוא קורא נלהב של אתר זה.

פרויקט זה מהווה שיפור ביחס למכונת ההצבעה האלקטרונית שהוסברה לעיל. החיסרון העיקרי של ה- EVM (מכונת הצבעה אלקטרונית) לעיל היה שלא ניתן היה לראות את התוצאה בתצוגת LCD בגודל 16x2, אך ניתן לראות אותה רק במחשב.

בפרויקט זה אנו הולכים להפיל את התיקון המוזכר ועם העיצוב המוצע החדש אנו יכולים להציג את התוצאה של 6 המועמדים על גבי תצוגת LCD באופן מיידי.

קשיים שנתקלנו בהם:

כל סיכות הקלט / הפלט (של Arduino) של פרויקט EVM הקודם נוצלו על ידי תצוגה 16x2, מודול כרטיס SD, כפתורי הצבעה, כפתור בקרה וזמזם. לא נותר עוד מקום לחיבור כל כפתור חדש.

לאחר מחקר מצאנו שניתן לשנות כל סיכות קלט / פלט ליציאה לקלט ולהיפך בכל נקודה.

לאחר תצפית מדוקדקת בחרנו בסיכת LED / זמזם ככפתור שמירה. עכשיו הסיכה הזו מתוכנתת כקלט (לחצן שמור) ופלט (זמזם).

שים לב שסיכת השמירה / זמזם מוקצה בכל אחת מהמצבים ברגע כלומר פלט או קלט.

המעגל:

חיבור LCD לארדואינו:

פשוט חבר לפי הסכימות הקודמות והשתמש בפוטנציומטר 10K להתאמת ניגודיות הצפייה בשאר המעגל זה מובן מאליו.

S1 עד S6 הם לחצני הצבעה שדרכם הבוחרים מכניסים את בחירתם. יש להרחיק את כפתור השמירה והשליטה מיחידת ההצבעה (בשליטה של ​​עמדת הקלפי האחראית).

תוכנית חדשה:
//--------Program Developed by R.Girish------//
#include
#include
#include
LiquidCrystal lcd(7, 6, 5, 4, 3, 2)
//----------------------------------------------------//
String Party1 = 'MODI'
String Party2 = 'TRUMP'
String Party3 = 'PUTIN' // Place the Candidate Names Here.
String Party4 = 'Abdul Kalam'
String Party5 = 'Girish'
String Party6 = 'Swagatam'
//-----------------------------------------------------//
const int btn_1 = A0
const int btn_2 = A1
const int btn_3 = A2
const int btn_4 = A3
const int btn_5 = A4
const int btn_6 = A5
const int ctrl_btn = 8
const int cs = 10
int LED = 9
int saveTest = 0
int A = 0
int B = 0
int C = 0
int D = 0
int E = 0
int F = 0
boolean ballot = false
File Party1File
File Party2File
File Party3File
File Party4File
File Party5File
File Party6File
File save
unsigned long int Party1_Count = 0
unsigned long int Party2_Count = 0
unsigned long int Party3_Count = 0
unsigned long int Party4_Count = 0
unsigned long int Party5_Count = 0
unsigned long int Party6_Count = 0
void setup()
{
pinMode(btn_1, INPUT)
pinMode(btn_2, INPUT)
pinMode(btn_3, INPUT)
pinMode(btn_4, INPUT)
pinMode(btn_5, INPUT)
pinMode(btn_6, INPUT)
pinMode(ctrl_btn, INPUT)
pinMode(cs, OUTPUT)
pinMode(LED, OUTPUT)
digitalWrite(btn_1, HIGH)
digitalWrite(btn_2, HIGH)
digitalWrite(btn_3, HIGH)
digitalWrite(btn_4, HIGH)
digitalWrite(btn_5, HIGH)
digitalWrite(btn_6, HIGH)
digitalWrite(ctrl_btn, HIGH)
lcd.begin(16, 2)
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F(' Electronic'))
lcd.setCursor(0, 1)
lcd.print(F(' Voting Machine'))
delay(2000)
if (!SD.begin(cs))
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('SD Card failed'))
lcd.setCursor(0, 1)
lcd.print('or not present')
while (true)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
}
if (SD.exists('save.txt'))
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Opening Results'))
lcd.setCursor(0, 1)
lcd.print(F('----------------'))
delay(1500)
DisplayResult()
}
else
{
Party1File = SD.open('Party1.txt', FILE_WRITE)
if (Party1File)
{
Party1File.println('--------Null-------')
Party1File.close()
}
else
{
Error()
}
Party2File = SD.open('Party2.txt', FILE_WRITE)
if (Party2File)
{
Party2File.println('--------Null-------')
Party2File.close()
}
else
{
Error()
}
Party3File = SD.open('Party3.txt', FILE_WRITE)
if (Party3File)
{
Party3File.println('--------Null-------')
Party3File.close()
}
else
{
Error()
}
Party4File = SD.open('Party4.txt', FILE_WRITE)
if (Party4File)
{
Party4File.println('--------Null-------')
Party4File.close()
}
else
{
Error()
}
Party5File = SD.open('Party5.txt', FILE_WRITE)
if (Party5File)
{
Party5File.println('--------Null-------')
Party5File.close()
}
else
{
Error()
}
Party6File = SD.open('Party6.txt', FILE_WRITE)
if (Party6File)
{
Party6File.println('--------Null-------')
Party6File.close()
}
else
{
Error()
}
}
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Machine Status:'))
lcd.setCursor(0, 1)
lcd.print(F('Initialized !!!'))
digitalWrite(LED, HIGH)
delay(2000)
digitalWrite(LED, LOW)
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Machine is ready'))
lcd.setCursor(0, 1)
lcd.print(F('----------------'))
while (!ballot)
{
if (digitalRead(ctrl_btn) == LOW)
{
ballot = true
for (int y = 0 y <3 y++)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Cast Your Vote'))
lcd.setCursor(0, 1)
lcd.print(F('----------------'))
}
}
}
void loop()
{
pinMode(LED, INPUT)
if (digitalRead(LED) == HIGH)
{
save = SD.open('save.txt', FILE_WRITE)
if (save)
{
save.println('Results File')
save.close()
}
else
{
Error()
}
}
if (SD.exists('save.txt'))
{
while (true)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Results Saved'))
lcd.setCursor(0, 1)
lcd.print(F('Successfully.'))
delay(1500)
lcd.setCursor(0, 0)
lcd.print(F('Disconnect the'))
lcd.setCursor(0, 1)
lcd.print(F('Power Supply'))
delay(1500)
}
}
if (digitalRead(btn_1) == LOW)
{
Party_1()
}
if (digitalRead(btn_2) == LOW)
{
Party_2()
}
if (digitalRead(btn_3) == LOW)
{
Party_3()
}
if (digitalRead(btn_4) == LOW)
{
Party_4()
}
if (digitalRead(btn_5) == LOW)
{
Party_5()
}
if (digitalRead(btn_6) == LOW)
{
Party_6()
}
}
void Party_1()
{
ballot = false
SD.remove('Party1.txt')
Party1File = SD.open('Party1.txt', FILE_WRITE)
if (Party1File)
{
Party1_Count = Party1_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party1)
Party1File.print(Party1_Count)
Party1File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_2()
{
ballot = false
SD.remove('Party2.txt')
Party2File = SD.open('Party2.txt', FILE_WRITE)
if (Party2File)
{
Party2_Count = Party2_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party2)
Party2File.print(Party2_Count)
Party2File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_3()
{
ballot = false
SD.remove('Party3.txt')
Party3File = SD.open('Party3.txt', FILE_WRITE)
if (Party3File)
{
Party3_Count = Party3_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party3)
Party3File.print(Party3_Count)
Party3File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_4()
{
ballot = false
SD.remove('Party4.txt')
Party4File = SD.open('Party4.txt', FILE_WRITE)
if (Party4File)
{
Party4_Count = Party4_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party4)
Party4File.print(Party4_Count)
Party4File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_5()
{
ballot = false
SD.remove('Party5.txt')
Party5File = SD.open('Party5.txt', FILE_WRITE)
if (Party5File)
{
Party5_Count = Party5_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party5)
Party5File.print(Party5_Count)
Party5File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Party_6()
{
ballot = false
SD.remove('Party6.txt')
Party6File = SD.open('Party6.txt', FILE_WRITE)
if (Party6File)
{
Party6_Count = Party6_Count + 1
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('You voted for:'))
lcd.setCursor(0, 1)
lcd.print(Party6)
Party6File.print(Party6_Count)
Party6File.close()
Tone()
ctrl()
}
else
{
Error()
}
}
void Error()
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Unable to log'))
lcd.setCursor(0, 1)
lcd.print(F('data to SD card'))
for (int x = 0 x <100 x++)
{
digitalWrite(LED, HIGH)
delay(250)
digitalWrite(LED, LOW)
delay(250)
}
}
void Tone()
{
pinMode(LED, OUTPUT)
digitalWrite(LED, HIGH)
delay(1000)
digitalWrite(LED, LOW)
delay(1500)
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F(' Thanks for'))
lcd.setCursor(0, 1)
lcd.print(F(' Voting!!!'))
delay(1500)
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F(' Not Ready'))
lcd.setCursor(0, 1)
lcd.print('----------------')
}
void ctrl()
{
while (!ballot)
{
pinMode(LED, INPUT)
if (digitalRead(LED) == HIGH)
{
save = SD.open('save.txt', FILE_WRITE)
if (save)
{
save.println('Results File')
save.close()
}
else
{
Error()
}
}
if (SD.exists('save.txt'))
{
while (true)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Results Saved'))
lcd.setCursor(0, 1)
lcd.print(F('Successfully.'))
delay(1500)
lcd.setCursor(0, 0)
lcd.print(F('Disconnect the'))
lcd.setCursor(0, 1)
lcd.print(F('Power Supply'))
delay(1500)
}
}
if (digitalRead(ctrl_btn) == LOW)
{
ballot = true
for (int y = 0 y <3 y++)
{
digitalWrite(LED, HIGH)
delay(100)
digitalWrite(LED, LOW)
delay(100)
}
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(F('Cast Your Vote'))
lcd.setCursor(0, 1)
lcd.print(F('----------------'))
}
}
}
void DisplayResult()
{
while (true)
{
Party1File = SD.open('party1.txt')
if(Party1File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party1)
while (Party1File.available())
{
lcd.setCursor(A, 1)
lcd.write(Party1File.read())
A = A + 1
}
}
A = 0
delay(2000)
Party1File.close()
Party2File = SD.open('party2.txt')
if(Party2File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party2)
while (Party2File.available())
{
lcd.setCursor(B, 1)
lcd.write(Party2File.read())
B = B + 1
}
}
B = 0
delay(2000)
Party2File.close()
Party3File = SD.open('party3.txt')
if(Party3File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party3)
while (Party3File.available())
{
lcd.setCursor(C, 1)
lcd.write(Party3File.read())
C = C + 1
}
}
C = 0
delay(2000)
Party3File.close()
Party4File = SD.open('party4.txt')
if(Party4File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party4)
while (Party4File.available())
{
lcd.setCursor(D, 1)
lcd.write(Party4File.read())
D = D + 1
}
}
D = 0
delay(2000)
Party4File.close()
Party5File = SD.open('party5.txt')
if(Party5File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party5)
while (Party5File.available())
{
lcd.setCursor(E, 1)
lcd.write(Party5File.read())
E = E + 1
}
}
E = 0
delay(2000)
Party5File.close()
Party6File = SD.open('party6.txt')
if(Party6File)
{
lcd.clear()
lcd.setCursor(0, 0)
lcd.print(Party6)
while (Party6File.available())
{
lcd.setCursor(F, 1)
lcd.write(Party6File.read())
F = F + 1
}
}
F = 0
delay(2000)
Party6File.close()
}
}
//--------Program Developed by R.Girish------//

כיצד להפעיל מכונת הצבעה אלקטרונית זו:

  • עם הגדרת החומרה שהושלמה, העלה את הקוד עם שמות המועמדים שלך.
  • הפעל את המכונה, אם הכל בסדר זה ייתן צפצוף ארוך.
  • כעת לחץ על כפתור הבקרה ועכשיו הוא יכול להקליט הצבעה בודדת.
  • לאחר כל הצבעה יש ללחוץ על כפתור הבקרה פעם אחת.
  • לאחר הגשת ההצבעה האחרונה, לחץ על כפתור השמירה זה יחסוך את התוצאות וינחה אותך לנתק את ספק הכוח (כך שתוכל להציג את התוצאות באופן פרטי).
  • חבר מחדש את האספקה ​​שהוא יתחיל להציג את התוצאות באופן אוטומטי. אם מועמד לא קיבל שום הצבעה הוא מציג 'אפס'.
  • כדי לערוך בחירות נוספות, עליך לעצב את כרטיס ה- SD / למחוק את כל הקבצים שנוצרו על ידי EVM זה.

לידיעתך, EVM זה זקוק לחשמל ללא הפרעה, כל הפרעה תביא להגדלת ספירת הקולות לאפס.

אנא כתוב את שמות המועמדים בקוד (מקסימום 16 אותיות):

// ------------------------------------------------ ---- //

מחרוזת Party1 = 'MODI'

מחרוזת Party2 = 'TRUMP'

Party String3 = 'PUTIN' // הצב כאן את שמות המועמדים.

מפלגת מיתרים 4 = 'עבדול קאלאם'

מחרוזת מפלגה 5 = 'גירית'

Party String6 = 'Swagatam'

// ------------------------------------------------ ----- //

זה מסיים את הפרויקט, אם יש לך שאלות בנוגע לפרויקט זה אתה מוזמן לבטא בסעיף ההערות, ייתכן שתקבל תשובה מהירה.




קודם: מעגל חיישן מים במיכל לרכב הבא: 3 מעגלי אספקת חשמל מתכווננים עם יחיד מצב IC IC 220V