Hey guys in this tutorial I will tell you that How to Make Simple Arduino Based Calculator Project using Arduino its very simple you need few components and some coding.

Don’t worry this project Arduino based Calculator Project Using Keypad is a very simple and interesting project you will learn lots of basics things from this project.

Using this project you guys will be able to run and connect Arduino LCD you will also understand how you can perform Arithmetic Operations like (Addition, Multiplication, Division, and Subtractions).

Also, you can modify the project according to your need you can add the options like percentage modulus integration differentiation whatever you want it just depends on your need and on your coding skills. So Before Starting this Project Let me tell you what you will need to make this Project.[adsforwp id=”3715″]

Arduino Based Calculator

Components Required:

for Arduino Based Calculator Project:

  • Arduino UNO
  • 4×4 Keypad
  • 10k Potentiometer
  • 16×2 Arduino LCD
  • Breadboard
  • Jumper Wires

[adsforwp id=”3715″]

Software Required:

for Arduino Based Calculator Project Using Keypad:

  • Arduino IDE (Integrated Development Environment).

Circuit Diagram:

of Arduino Based Calculator Project Using Keypad:

Arduino based Calculator Diagram

Note:(Download the Diagram and Zoom for Understanding the connections)

[adsforwp id=”3725″]

How to Install Code?

for Arduino Based Calculator project using keypad?

Now you have connected all the components like this if not then Make sure you connect all the connections like this. After connecting all the connections like this click below and download the

ARDUINO CALCULATOR CODE

KEYPAD.RAR

LiquidCrystal_I2C.RAR 

After downloading these files, extract the RAR files and copy these libraries and paste it to the address C:\users\yourPCname\Documents\Arduino\Libraries for example in my case.

address of arduino
[adsforwp id=”3725″]

Now Open your Arduino IDE if you don’t have then click here. After download Arduino IDE open it and copy the code from ARDUINO BASED CALCULATOR PROJECT CODE and paste it into the IDE. Then simply click on UPLOAD.

ARDUINO BASED CALCULATOR PROJECT USING KEYPAD CODE:


[adsforwp id=”3713″]

// Studentsheart.com
// calculator
// Sohail Anwar
#include <LiquidCrystal.h>
#include <Keypad.h>

LiquidCrystal lcd(0, 1, 2, 3, 4, 5);
const byte ROWS = 4;
const byte COLS = 4;

char keys [ROWS] [COLS] = {
{'1', '2', '3', '+'},
{'4', '5', '6', '-'},
{'7', '8', '9', '*'},
{'C', '0', '=', '/'}
};
byte rowPins[ROWS] = {13,12,11,10};
byte colPins[COLS] = {9,8,7,6};

Keypad myKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

boolean presentValue = false;
boolean next = false;
boolean final = false;
String num1, num2;
int answer;
char op;

void setup()
{
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print(" Studentsheart.com");
lcd.setCursor(0,1);
lcd.print(" Calculator");
delay(3000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" by ");
lcd.setCursor(0,1);
lcd.print(" Sohail Anwar" );
delay(3000);
lcd.clear();
}

void loop(){
char key = myKeypad.getKey();

if (key != NO_KEY && (key=='1'||key=='2'||key=='3'||key=='4'||key=='5'||key=='6'||key=='7'||key=='8'||key=='9'||key=='0'))
{
if (presentValue != true)
{
num1 = num1 + key;
int numLength = num1.length();
lcd.setCursor(15 - numLength, 0); //to adjust one whitespace for operator
lcd.print(num1);
}
else
{
num2 = num2 + key;
int numLength = num2.length();
lcd.setCursor(15 - numLength, 1);
lcd.print(num2);
final = true;
}
}

else if (presentValue == false && key != NO_KEY && (key == '/' || key == '*' || key == '-' || key == '+'))
{
if (presentValue == false)
{
presentValue = true;
op = key;
lcd.setCursor(15,0);
lcd.print(op);
}
}

else if (final == true && key != NO_KEY && key == '='){
if (op == '+'){
answer = num1.toInt() + num2.toInt();
}
else if (op == '-'){
answer = num1.toInt() - num2.toInt();
}
else if (op == '*'){
answer = num1.toInt() * num2.toInt();
}
else if (op == '/'){
answer = num1.toInt() / num2.toInt();
}
lcd.clear();
lcd.setCursor(15,0);
lcd.autoscroll();
lcd.print(answer);
lcd.noAutoscroll();
}
else if (key != NO_KEY && key == 'C'){
lcd.clear();
presentValue = false;
final = false;
num1 = "";
num2 = "";
answer = 0;
op = ' ';
}
}

Read More: What is the Duty Cycle?

Now you are ready to enjoy your Arduino Calculator Project you can simply perform all arithmetic operation on this calculator by using a keypad.

Also See: Latest 500+ Final Year Projects For Electronics Engineering Students


[adsforwp id=”3723″]
You can also make a security system from this concept modify the code and make your project on a higher level. This is all for today If you guys like our post Make Simple Arduino Based Calculator Project using Keypad than comment below and share this post with your friends.

Want to Learn: How to Interface IR Sensor with Arduino Step by Step GUIDE
Want to learn and make Arduino Based Radar System.
Want to learn and make Arduino Based Line Following Robot.
Want to learn and make IR Remote tester Project Control LED on Remote.
Want to learn and make Visitor Counter Using LDR and 7 Segment Display.

Thanks for Visiting StudentsHeart.com Stay connected. Thanks!

 

Sending
User Review
0 (0 votes)