in one of my previous Instructable tutorial, we learnt how to interface an OLED with Arduino and basics of it, now its time to step up the game and make some project based on OLED, so in this tutorial, we will learn how to make a simple yet slinky arduino calculator.

Supplies for making arduino calculator:

A.Components
  1. OLED Display
  2. Arduino
  3. Arduino Keypad
  4. 3.7v, 200mAH Lithium Polymer Battery
  5. Switch
B. Tools
  1. Soldering Iron
  2. hot glue gun
  3. Soldering Wire
  4. Wire Stripper
C. Software

1. Arduino IDE

Step 1: Watch the Video!

Step 2: Choice of Material!

to make a arduino calculator, we will need some kind of Processor.

for which we can use Arduino, since this is a small project and needs large memory space for complicated code, we will use Arduino NANO.

for taking input number, we can use a 4×4 keypad with membrane switches, which has 4 rows and 4 columns, if we open up this sticker from behind, the flexible membrane PCB is visible, which has connections going from ROWS and COLUMNS to connecting pins via flexible PCB. When any membrane switch is pressed, the rows and column pins process the data as a Matrix and identify the location of key pressed.(Remember, left side pins are row pins and right side pins are column pins.)

for display we can use either OLED or LCD display.

but I would like to use OLED, since the resolution of OLED is far better, we can have longer strings of numbers to operate, if we choose OLED.

Step 3: Complete the Connections

since we discussed the choice of material, connections should be very straight forward.

so follow the following steps to complete the connections:
  1. connect Keypad to any digital pins on Arduino Nano ( preferably D2 to D9).
  2. Then connect OLEDs SCL to Arduinos A5.
  3. connect OLEDs SDA to Arduinos A4.
  4.  Then connect OLEDs VCC to Arduinos 5v.
  5. connect OLEDs GND to Arduinos GND.
  6. Then Connect a Switch between Positive of Lithium Polymer Battery.
  7.  And Connect Lipo to 5V and Gnd pins of Arduino.

and that all for connections!

Step 4: Upload the Code

in this code,

we will need the following Libraries.
Steps for making an arduino calculator:
  1. First we included Keypad library,
  2. next we will add SPI wire,Adafruit GFX and Adafruit SSD1306 libraries for OLED.
  3. Then we will initialize the OLED.
  4. Define Rows and Columns,
  5. Define Variables.
  6. Map out the Keypad in form of matrix, where in our A key is replaced by + operator, B with minus, c with multiplier, D with Divisor, hash with equals and finally star with clear.
  7. in byte rowPins and colPins we define the pin out of keypad and initialize the Keypad,
  8. next we have a startup animation Screen set up in this sub-code.
  9. In the loop section, we will use cases for each operator and do the calculation keeping in mind the operators.

you can download the code here!

Step 5: Test the Project

Once this code is uploaded to Arduino, we can see a startup animation screen saying Arduino Calculator by Mission Critical, followed by blank screen.

which we will use for operations. So we can now add numbers, subtract act them, multiply them, divide them, we can also use obtained answer and perform operations on it!

Step 6: Create an Enclosure

But let’s leave this project hanging and make a simple enclosure for it. I had this small box with me, which I used as base for this enclosure. I want this project to be portable, so I used a Lithium Ion Battery to power Arduino, which I soldered along with a little switch to Arduino’s 5v pin and ground pin, and stuffed everything inside, finally used a little hot glue to place OLED and Keypad at required location.

Step 7: Thank You!

After this coding and wiring mess, the end result looks absolutely charming and of course functional.

So I hope you guys enjoyed this simple Arduino calculator project tutorial.

and I hope you guys learnt something from this tutorial, and if you liked it, make sure to check out our other work on youtube, you can also support us for following Mission Critical on social media or becoming our patreon.

Patreon – https://www.patreon.com/missioncritical
Twitter @ akshaymomaya1 Instagram @officialmissioncritical Facebook https://www.facebook.com/officialmissioncritical/

arduino calculator

Minov

A Market Place for your Innovations

0