Tuesday, May 31, 2011

Simple arduino project: Push-button Counter and Calculator

As a hobby project, i decided to build a calculator. Inputs should be given from keypad and outputs should be displayed in two 7 segment displays. In the first stage i had to make two 7 segments work simultaneously. Best solution was to use the concept of time sharing and i did so, each segments turning "on" and "off" in every 5 ms complementary. Then i added a push button in the circuit so that it counted from 0 to 99 and back to 0. 
 
figure: push-button circuit.

In every pulse of push button, value of count increases by 1. When value of count becomes 99, arrival of one pulse reset it to 00. People are suggested to watch this video for the detail of what is happening.  
 
video: pushbutton counter

After push-button, calculator was not so far. I added three more push-buttons. I assigned first push-button to take input of first number, second push-button to take input of second number, third push-button for operation selection and fourth push-button for output or result display. Operation selection logic of third push-button is as follows:
                00 = addition;         01 = subtraction;         02 = multiplication;      03 = division
Please watch what is happening in the circuit.

video: demonstration of calculator

This calculator is able to perform addition, subtraction, multiplication and division of two digit decimal number. Input at the push-button must be given sequentially (i.e. 0-1-2-3-...-99 and back to 0). During the arithmetic operation overflow can occur; so it displays only first two LSB's. Circuit diagrams are as shown below. 
figure: Circuit connection in breadboard and arduino

 
figure: pin configuration of connection in breadboard and arduino

Interested can view the source code, click here.

6 comments:

Visualization of Electromagnetic wave in MATLAB

Wave is imaginary and mysterious thing to us. Many of them are invisible and we even don’t know their pres...