Electronic Voting Machine¶
Uses¶
LED Display, radio
Description¶
In this project, you will make an electronic voting machine that will take in votes for 2 candidates by pressing the corresponding buttons. It will also have an ability to display the current vote tally, and send will be able to send the data to a remote command center (another micro:bit) to tally the overall votes.
Electronic voting (also known as e-voting) refers to voting using electronic means to either aid or take care of the chores of casting and counting votes. Depending on the particular implementation, e-voting may use standalone electronic voting machines (also called EVM) or computers connected to the Internet. It may encompass a range of Internet services, from basic transmission of tabulated results to full-function online voting through common connectable household devices. The degree of automation may be limited to marking a paper ballot, or may be a comprehensive system of vote input, vote recording, data encryption and transmission to servers, and consolidation and tabulation of election results.
For this project, you will use 2 or more micro:bits, 1 micro:bit will act as the command center take all the results from other micro:bits via radio, and tally the overall result. The other micro:bits will be use as an voting machine, capable of taking in votes of each participant, store the tally locally, and be able to send the data to the command center where it will aggregate all the data and tabulate the overall tally.
Basic Task¶
For the voting machine:
- Initialize variables, and turn on radio. Also set the channel number for the radio. Should be the same channel as the command center.
- Display a welcome message and inform the voter to press A to vote for candidate A or B to vote for candidate B.
- Tally the result locally for each candidate.
- If
pin2andGNDare touched, display the current tally for each candidate. - If
pin0andGNDare touched, send the data to the micro:bit designated as the remote command center. Send the data as text with a space separating the tally for candidate A and B. - Change the radio channel number for the micro:bit so that it can only send out the data once.
For the remote command center:
- Initialize variables, and turn on radio. Also set the channel number for the radio. Should be the same channel as the remote voting machines.
- Listen to the radio and receive the data by storing it to a variable message. Remember, if no data is received,
radio.receive()value is None. - If the variable message doesnt contain None, convert the string message into integers. Remember to split first the string using the
split()function, convert it to a list, and convert ach element into a string. You will now have a list of integer values representing the votes for each candidate. - Tally up the result for each candidate, so that you will have an overall count.
- Pressing button A will display the overall tally of votes.
Extra Task¶
Improve the implementation of the electronic voting machine by making it more secure and robust.

